Class: Twitorious::Auth::OAuth
- Inherits:
-
Object
- Object
- Twitorious::Auth::OAuth
- Defined in:
- lib/twitorious/auth/oauth.rb
Instance Method Summary collapse
- #authorize_url ⇒ Object
- #get(url, path) ⇒ Object
- #get_access_token ⇒ Object
- #get_request_token ⇒ Object
-
#initialize ⇒ OAuth
constructor
A new instance of OAuth.
- #post(url, path, form_data) ⇒ Object
- #set_token(token, secret) ⇒ Object
Constructor Details
#initialize ⇒ OAuth
Returns a new instance of OAuth.
7 8 9 10 11 12 |
# File 'lib/twitorious/auth/oauth.rb', line 7 def initialize @consumer = ::OAuth::Consumer.new( "oZglZozO6F3p1Ed8n9F6fw", "onR6S9HS54D40Qg1KfI16c9A72KRoJKJwaXe73Tv0", { :site => "http://twitter.com" }) end |
Instance Method Details
#authorize_url ⇒ Object
19 20 21 |
# File 'lib/twitorious/auth/oauth.rb', line 19 def @request_token. end |
#get(url, path) ⇒ Object
33 34 35 36 |
# File 'lib/twitorious/auth/oauth.rb', line 33 def get(url, path) res = @access_token.get path return res.body end |
#get_access_token ⇒ Object
28 29 30 31 |
# File 'lib/twitorious/auth/oauth.rb', line 28 def get_access_token @access_token ||= ::OAuth::AccessToken.new(@consumer, @token, @secret) @access_token end |
#get_request_token ⇒ Object
14 15 16 17 |
# File 'lib/twitorious/auth/oauth.rb', line 14 def get_request_token @request_token = @consumer.get_request_token @request_token end |
#post(url, path, form_data) ⇒ Object
38 39 40 41 |
# File 'lib/twitorious/auth/oauth.rb', line 38 def post(url, path, form_data) res = @access_token.post path, form_data return res.body end |
#set_token(token, secret) ⇒ Object
23 24 25 26 |
# File 'lib/twitorious/auth/oauth.rb', line 23 def set_token(token, secret) @token, @secret = token, secret get_access_token end |