Created
December 19, 2010 15:34
-
-
Save noqisofon/747417 to your computer and use it in GitHub Desktop.
Ruby で つぶやいてみるテスト。
This file contains hidden or 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
#!/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