遇到Tumblr API v2问题需要获取仪表板请求

时间:2011-11-01 05:36:50

标签: ruby-on-rails ruby ruby-on-rails-3 tumblr

不确定我做错了什么,但在尝试从信息中心获取帖子时,我一直收到=> #<Net::HTTPOK 200 OK readbody=true>

  consumer = OAuth::Consumer.new( key, secret, {
    :site               => "http://www.tumblr.com",
    :scheme             => :header,
    :http_method        => :post,
    :request_token_path => "/oauth/request_token",
    :access_token_path  => "/oauth/access_token",
    :authorize_path     => "/oauth/authorize"
  })

  request_token = consumer.get_request_token

  # pasting this in url and getting oauth_verifier
  # request_token.authorize_url

  access_token = request_token.get_access_token({:oauth_verifier => 
                                                 params[:oauth_verifier]})
  puts access_token.get('api.tumblr.com/v2/user/dashboard')

1 个答案:

答案 0 :(得分:1)

已更改response = access_token.get('http://api.tumblr.com/v2/user/dashboard'),然后JSON.parse(response.body)正常工作。