Sha256: 951c75c953e962a2a114045cb0b8689e27571506d788733980123b8661acf6b5

Contents?: true

Size: 779 Bytes

Versions: 4

Compression:

Stored size: 779 Bytes

Contents

require 'pp'
require 'pathname'
dir = Pathname(__FILE__).dirname.expand_path
require (dir + '..' + 'lib' + 'twitter').expand_path
require dir + 'helpers' + 'config_store'

config  = ConfigStore.new("#{ENV['HOME']}/.twitter")
oauth   = Twitter::OAuth.new(config['token'], config['secret'])
rtoken  = oauth.request_token.token
rsecret = oauth.request_token.secret

puts "> redirecting you to twitter to authorize..."
%x(open #{oauth.request_token.authorize_url})

print "> what was the PIN twitter provided you with? "
pin = gets.chomp

begin
  oauth.authorize_from_request(rtoken, rsecret, pin)
  
  twitter = Twitter::Base.new(oauth)
  twitter.user_timeline.each do |tweet|
    puts "#{tweet.user.screen_name}: #{tweet.text}"
  end
rescue OAuth::Unauthorized
  puts "> FAIL!"
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
erwaller-twitter-0.6.15.1 examples/oauth.rb
erwaller-twitter-0.6.15 examples/oauth.rb
jnunemaker-twitter-0.6.15 examples/oauth.rb
sml-twitter-0.7.3 examples/oauth.rb