Skip to content

Instantly share code, notes, and snippets.

@noqisofon
Created December 19, 2010 15:34
Show Gist options
  • Save noqisofon/747417 to your computer and use it in GitHub Desktop.
Save noqisofon/747417 to your computer and use it in GitHub Desktop.
Ruby で つぶやいてみるテスト。
#!/opt/local/bin/ruby
# -*- encoding: utf-8 -*-
require 'twitter'
APP_TAKEN = [ "あぷりのとーくん", "あぷりのしーくれっと" ]
PIN_CODE = 42
def get_atoken(oauth)
request_token = oauth.customer.get_request_token
return request_token.get_acccess_token( :oauth_verifier => PIN_CODE )
end
oauth = Twitter::OAuth.new( *APP_TOKEN )
atoken = get_atoken( oauth )
user_atoken = [ "#{atoken.token}", "#{atoken.secret}" ]
oauth.authorize_from_access( *user_token )
# ついったーアカウントを作成します。
account = Twitter::Base.new( get_oauth )
# TL を取得します。
timeline = account.friends_timeline
account.update( "うふふ…" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment