Skip to content

Instantly share code, notes, and snippets.

@dsueiro
Created January 27, 2011 16:04
Show Gist options
  • Save dsueiro/798683 to your computer and use it in GitHub Desktop.
Save dsueiro/798683 to your computer and use it in GitHub Desktop.
Some notes on authentication and posting to Tumblr for future reference
@consumer=OAuth::Consumer.new( oauth_app_token,
oauth_app_secret,
{:site => 'http://www.tumblr.com'})
@request_token=@consumer.get_request_token
@request_token.authorize_url
@access_token = @request_token.get_access_token(:oauth_token => oauth_token,
:oauth_verifier => oauth_verifier )
result = @access_token.post('http://www.tumblr.com/api/write', :type => 'regular', :title => 'My first post', :body => 'This is my <b>second</b> post')
data = @access_token.get('http://www.tumblr.com/api/authenticate')
xml_doc = Nokogiri::XML(data.body)
xml_doc.xpath('.//tumblelog').first.attributes['url'].value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment