Cant figure out how to format post request to post image to twitter


#1

I’m successfully posting a tweet via:
response = access_token.request(:post,https://api.twitter.com/1.1/statuses/update.json, :status=>“tweet”).

This line was taken and altered from the examples at
https://dev.twitter.com/oauth/overview/single-user using their ruby Oauth example.

But what I want to do is:
response = access_token.request(:post,https://upload.twitter.com/1.1/media/upload.json, :media=>“filepath/file.png”).

But I get: {“request”:"/1.1/media/upload.json",“error”:“media type unrecognized.”}

I’m thinking I’m not formatting my request correctly, with content-type and so on.
Can someone give me an example? I only find twurl command examples on twitter dev.
But currently on a old production server with ruby 1.8.7 so twurl wont install.