0

我在我的 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 和专辑名称,但除此之外,它是响应的精确副本。

任何人都可以帮忙吗?

4

1 回答 1

0

解决了这个问题。只需按一下Page Down键,Flickr 的其余结果就一直存在!

于 2013-10-28T22:03:58.883 回答