Sha256: 8462bc5b2db73a0dcdf4c723283519fe099a78c1ec61e578611224478e2f82cf

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

#!/usr/bin/ruby

# Script to ease muddy oauth application verification
# from http://github.com/jnunemaker/twitter/blob/master/examples/oauth.rb

require 'rubygems'
require 'muddyit_fu'
require 'launchy'

puts "> enter consumer key"
token = gets.chomp
puts "> enter consumer secret"
secret = gets.chomp

oauth   = Muddyit::OAuth.new(token, secret)
rtoken  = oauth.request_token.token
rsecret = oauth.request_token.secret

puts "> redirecting you to muddy to authorize"
puts "> opening #{oauth.request_token.authorize_url}"
Launchy.open(oauth.request_token.authorize_url)

puts "> authorize in the browser and then press enter"
waiting = gets.chomp

begin
  stoken,ssecret = oauth.authorize_from_request(rtoken, rsecret)

  puts "Access Details"
  puts
  puts "Token : #{stoken}"
  puts "Secret : #{ssecret}"
  puts

  puts "Account collections"
  puts
  
  muddyit =  Muddyit.new(:consumer_key => token,
                         :consumer_secret => secret,
                         :access_token => stoken,
                         :access_token_secret => ssecret)
  
  muddyit.collections.find(:all).each do |collection|
    puts "#{collection.label} has token #{collection.token}"
  end

rescue OAuth::Unauthorized
  puts "> FAIL!"
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
muddyit_fu-0.2.14 examples/oauth.rb
muddyit_fu-0.2.13 examples/oauth.rb
muddyit_fu-0.2.12 examples/oauth.rb
muddyit_fu-0.2.11 examples/oauth.rb
muddyit_fu-0.2.10 examples/oauth.rb
muddyit_fu-0.2.9 examples/oauth.rb