Search code examples
rubytumblr

tumblr_client post function hash passed as array


I am trying to use the tumblr_client gem to post images to a tumblr, but when I use the photo function as it is described in the examples I get an error saying that I am passing a Array not a Hash.

This is the line that breaks it

client.photo("blahblah.tumblr.com", {:data => "path.jpg", :tag => "tags"})

and the error I get is

/var/lib/gems/1.8/gems/tumblr_client-0.8.2/lib/tumblr/helpers.rb:17:in `validate_options': undefined method `keys' for [[:data, "path.jpg"], [:tag, "tags"]]:Array (NoMethodError)

I'm pretty sure i am passing a hash but uh... anyone got any ideas what is going on here?


Solution

  • The tumblr client is expecting the :data value to be an array, eg:

    client.photo("codingjester.tumblr.com", {:data => ['/path/to/pic.jpg', '/path/to/pic.jpg']})
    

    Check out the tumblr_client README for more examples