我在Rails应用程序中运行了以下内容:
Flickr.collections_list
班级和方法是:
class Flickr
require 'httparty'
include HTTParty
API_KEY = '2fkjgdskjgksdjkgjrkbff3aee'
SECRET = '881fgregreg2b2'
USER_ID = '57rgrfgr266@N03'
RESPONSE_FORMAT = 'json'
base_uri 'http://api.flickr.com'
# Get list of all collections
def self.collections_list
response = get("/services/rest/",
:query => {
method: 'flickr.collections.getTree',
api_key: API_KEY,
user_id: USER_ID,
nojsoncallback: 1
}
)
JSON.parse(response.to_json.gsub('\"', '"'))
end
end
当在控制台中运行时,我得到的结果看起来不错,但结果有点让我得到一个半冒号。我可以退出它,我可以;看看其余的API结果。发生了什么事?
=> {"rsp"=> {"collections"=> {"collection"=> {"collection"=> [{"collection"=> [{"set"=> [{"id"=>"7215fffff81735", "title"=>"Album title", "description"=>"Album title"}, {"id"=>"72145645ffff464564606", "title"=>"Album title", "description"=> "Album title"}, {"id"=>"721545646760", "title"=>"Album title", "description"=> "Album title"}], "id"=>"5794562-721546456457291", "title"=>"Album title", "description"=>"", "iconlarge"=>"/images/collection_default_l.gif", "iconsmall"=>"/images/collection_default_s.gif"}, {"set"=> [{"id"=>"72145645635562", "title"=>"Album title", "description"=>""}, {"id"=>"72164564561696", "title"=>"Album title", "description"=>""}, {"id"=>"72157464546", "title"=>"Album title", "description"=>""}, {"id"=>"72154564642", "title"=>"Album title", "description"=>""}, {"id"=>"7215762456456644", "title"=> "Album title", "description"=>""}, {"id"=>"721546456489442", "title"=>"Album title", "description"=>""}, {"id"=>"7215464568", "title"=> "Album title", "description"=>""}, {"id"=>"721574645638", "title"=>"Album title", :
我已经更改了代码中的所有ID和专辑名称,但除此之外,它是响应的精确副本。
有人可以帮忙吗?
答案 0 :(得分:0)
解决了这个问题。只需按下Page Down
键,Flickr的其余结果一直都在那里!