Advertisement
Guest User

Untitled

a guest
Mar 25th, 2012
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.72 KB | None | 0 0
  1.   consumer = OAuth::Consumer.new(
  2.     CONSUMER_KEY, SECRET_KEY,
  3.     :site               => "https://www.tumblr.com/",
  4.     :access_token_path  => "/oauth/access_token",
  5.     :http_method        => :post,
  6.   )
  7.  
  8.   access_token = consumer.get_access_token(
  9.     nil, {},
  10.     :x_auth_mode => 'client_auth',
  11.     :x_auth_username => EMAIL,
  12.     :x_auth_password => PASSWORD,
  13.   )
  14.  
  15.   print "got token, sending request... "
  16.   response = access_token.post(
  17.     "http://api.tumblr.com/v2/blog/#{BLOG_URL}/post",
  18.     "generator" => "tumbl.rb",
  19.     "type"      => "photo",
  20.     "private"   => "0",
  21.     "slug"      => "",
  22.     "state"     => "",
  23.     "tags"      => file.tags,
  24.     "data"      => File.open(file.name, "rb").read.force_encoding('ASCII-8BIT'),
  25.   )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement