I'm learning to use API's and started with Kimonify extracting some page data from Amazon. In the view the data is coming through via the @response
variable.
How can I parse this and just show the Author Name
and Rank
which is #22
?
class HomeController < ApplicationController
def index
require 'rubygems'
require 'json'
require 'rest_client'
@response = RestClient.get 'https://www.kimonolabs.com/api/83x1k5ua?apikey=Gsj16resq87I8wRiaVjOrtzrs0WbAhZr'
end
end
index.html.erb
<h1>Home#index</h1>
<p>Find me in app/views/home/index.html.erb</p>
<p> <%= @response %> </p>
{ "name": "Tim Weed Sales Rank Colonial",
"count": 1,
"frequency":
"Every 15 mins",
"version": 11,
"newdata": true,
"lastrunstatus": "success",
"lastsuccess": "Tue Dec 23 2014 17:28:30 GMT+0000 (UTC)",
"thisversionstatus": "success",
"nextrun": "Tue Dec 23 2014 17:43:30 GMT+0000 (UTC)",
"results": { "Tim Weed Sales Rank Colonial": [ { "Title": "Will Poole's Island [Kindle Edition]",
"Colonial Historical Fiction Rank": "#22" } ]
}
}