mwunsch/tumblr

Cannot upload photo

metamn opened this issue · 1 comments

Ahoy,

I'm able to upload regular posts but no photos. It seems your gem deals only with :source and ignores :data
Here is my test file:

    ---
    type: photo
    state: queue
    tags: webdesign, inspiration
    data: /home/cs/work/ruby/inspiration/images/wsurippleeffectitstartswithyou.png
    ---

And my irb:

ruby-1.9.2-head > d = File.open('tumblr.test', 'r') {|f| f.read}
=> "---\ntype: photo\nstate: queue\ntags: webdesign, inspiration\ndata: /home/cs/work/ruby/inspiration/images/wsurippleeffectitstartswithyou.png\n---\n\n"

ruby-1.9.2-head > r = Tumblr.new('user', 'pwd').post(d)
=> #<Weary::Request:0x8df8b14 @uri=#<URI::HTTP:0x8df8920 URL:http://www.tumblr.com/api/write>, @http_verb=:post, @with="generator=The%20Tumblr%20Gem%20v1.3.0&email=user&password=pwd&type=photo&tags=webdesign%2C%20inspiration&state=queue&source=", @headers={"User-Agent"=>"TumblrGem/1.3.0 (+http://github.com/mwunsch/tumblr)"}, @follows=true>

ruby-1.9.2-head > r.perform
=> Please select a photo to upload.

And the error:

we have an empty 'source=' instead of 'data=<my_url>' in the api call
I've tried with a source instead of data and works.

Yes, this is a known limitation and is addressed in the TODO on the Readme:

TODO:

File-uploading for Photos, Videos, Audio (needs to get into Weary)