Created
January 27, 2011 16:04
-
-
Save dsueiro/798683 to your computer and use it in GitHub Desktop.
Some notes on authentication and posting to Tumblr for future reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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