Class: TwiAuth::OAuth
- Inherits:
-
Object
- Object
- TwiAuth::OAuth
- Defined in:
- lib/twiauth/oauth.rb
Overview
oauth communication wrapper
Constant Summary collapse
- TWITTER_OAUTH_SPEC =
{ :site => 'https://api.twitter.com', :request_token_path => '/oauth/request_token', :access_token_path => '/oauth/access_token', :authorize_path => '/oauth/authorize' }
- ACCESS_TOKEN =
key for access token
'ACCESS_TOKEN'
Instance Method Summary collapse
- #drop_access_token ⇒ Object
- #get(path) ⇒ Object
-
#initialize(key, secret) ⇒ OAuth
constructor
A new instance of OAuth.
- #post(path, body = nil) ⇒ Object
Constructor Details
#initialize(key, secret) ⇒ OAuth
Returns a new instance of OAuth.
15 16 17 18 19 |
# File 'lib/twiauth/oauth.rb', line 15 def initialize(key, secret) @store = TwiAuth::Store.new @oauth_consumer = ::OAuth::Consumer.new(key, secret, TWITTER_OAUTH_SPEC) get_access_token end |
Instance Method Details
#drop_access_token ⇒ Object
29 30 31 |
# File 'lib/twiauth/oauth.rb', line 29 def drop_access_token @store.delete(ACCESS_TOKEN) end |
#get(path) ⇒ Object
21 22 23 |
# File 'lib/twiauth/oauth.rb', line 21 def get(path) @access_token.get(path) end |
#post(path, body = nil) ⇒ Object
25 26 27 |
# File 'lib/twiauth/oauth.rb', line 25 def post(path, body = nil) @access_token.post(path, body) end |