Class: Twitter::OAuth
- Inherits:
-
Object
- Object
- Twitter::OAuth
- Extended by:
- Forwardable
- Defined in:
- lib/twitter/oauth.rb
Instance Attribute Summary collapse
-
#csecret ⇒ Object
readonly
Returns the value of attribute csecret.
-
#ctoken ⇒ Object
readonly
Returns the value of attribute ctoken.
Instance Method Summary collapse
- #access_token ⇒ Object
- #authorize_from_access(atoken, asecret) ⇒ Object
- #authorize_from_request(rtoken, rsecret) ⇒ Object
- #consumer ⇒ Object
-
#initialize(ctoken, csecret) ⇒ OAuth
constructor
A new instance of OAuth.
- #request_token ⇒ Object
Constructor Details
#initialize(ctoken, csecret) ⇒ OAuth
Returns a new instance of OAuth.
8 9 10 |
# File 'lib/twitter/oauth.rb', line 8 def initialize(ctoken, csecret) @ctoken, @csecret = ctoken, csecret end |
Instance Attribute Details
#csecret ⇒ Object (readonly)
Returns the value of attribute csecret.
6 7 8 |
# File 'lib/twitter/oauth.rb', line 6 def csecret @csecret end |
#ctoken ⇒ Object (readonly)
Returns the value of attribute ctoken.
6 7 8 |
# File 'lib/twitter/oauth.rb', line 6 def ctoken @ctoken end |
Instance Method Details
#access_token ⇒ Object
26 27 28 |
# File 'lib/twitter/oauth.rb', line 26 def access_token @access_token ||= ::OAuth::AccessToken.new(consumer, @atoken, @asecret) end |
#authorize_from_access(atoken, asecret) ⇒ Object
30 31 32 |
# File 'lib/twitter/oauth.rb', line 30 def (atoken, asecret) @atoken, @asecret = atoken, asecret end |
#authorize_from_request(rtoken, rsecret) ⇒ Object
20 21 22 23 24 |
# File 'lib/twitter/oauth.rb', line 20 def (rtoken, rsecret) request_token = ::OAuth::RequestToken.new(consumer, rtoken, rsecret) access_token = request_token.get_access_token @atoken, @asecret = access_token.token, access_token.secret end |
#consumer ⇒ Object
12 13 14 |
# File 'lib/twitter/oauth.rb', line 12 def consumer @consumer ||= ::OAuth::Consumer.new(@ctoken, @csecret, {:site => 'http://twitter.com'}) end |
#request_token ⇒ Object
16 17 18 |
# File 'lib/twitter/oauth.rb', line 16 def request_token @request_token ||= consumer.get_request_token end |