Skip to content

Instantly share code, notes, and snippets.

@timhaines timhaines/gist:547403 forked from gotwalt/gist:528586
Created Aug 24, 2010

Embed
What would you like to do?
require "nestful"
require "roauth"
def upload(path_to_file)
twitpic_key = "my_twitpic_api_key"
oauth_url = "https://api.twitter.com/1/account/verify_credentials.json"
oauth = {
:access_key => "account_access_key",
:access_secret => "account_access_secret",
:consumer_key => "application_key",
:consumer_secret => "application_secret"
}
oauth_result = ::ROAuth.header(oauth, oauth_url, {})
headers = {
"X-Auth-Service-Provider" => oauth_url,
"X-Verify-Credentials-Authorization" => oauth_result
}
params = {
:media => File.open(path_to_file),
:key => twitpic_key
}
result = Nestful.post(endpoint_url, :format => :multipart, :headers => headers, :params => params)
JSON.parse(result)
end
@crm114

This comment has been minimized.

Copy link

crm114 commented Oct 12, 2010

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.