Search code examples
ruby-on-railsrubyclientresponsetumblr

How do I call for specific tumblr responses?


I'm tryibg to only receive certain response from tumplr post or blogs. For example:

client = Tumblr::Client.new({
  :consumer_key => 'xxx',
  :consumer_secret => 'xxx',
  :oauth_token => 'xxx',
  :oauth_token_secret => 'xxx'
})

myblog = client.posts

puts myblog["posts"].each do |posts|
    puts posts["id"]
end

I get an error:

/Users/xxx/.rvm/gems/ruby-2.2.0/gems/tumblr_client-0.8.5/lib/tumblr/blog.rb:32:inposts': wrong number of arguments (0 for 1..2) (ArgumentError) from tumblr.rb:42:in <main>''

...I'm trying to be able to call specific responses instead of getting the whole lots of post info that you normally get back. Please and thanks for your help. :)


Solution

  • Try change:

    myblog = client.posts

    for

    myblog = client.posts("yourblog.tumblr.com")

    https://github.com/tumblr/tumblr_client/blob/master/README.md