Module: Activite::HTTP::OAuthClient
- Included in:
- Client
- Defined in:
- lib/activite/http/oauth.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ site: 'https://oauth.withings.com', proxy: nil, request_token_path: '/account/request_token', authorize_path: '/account/authorize', access_token_path: '/account/access_token', scheme: :query_string }
Instance Attribute Summary collapse
-
#consumer ⇒ Object
writeonly
Sets the attribute consumer.
-
#consumer_key ⇒ Object
Returns the value of attribute consumer_key.
-
#consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #access_token(token, secret, options = {}) ⇒ Object
- #authorize_url(token, secret, options = {}) ⇒ Object
- #connected? ⇒ Boolean
- #existing_access_token(token, secret) ⇒ Object
- #request_token(options = {}) ⇒ Object
Instance Attribute Details
#consumer=(value) ⇒ Object
Sets the attribute consumer
7 8 9 |
# File 'lib/activite/http/oauth.rb', line 7 def consumer=(value) @consumer = value end |
#consumer_key ⇒ Object
Returns the value of attribute consumer_key.
6 7 8 |
# File 'lib/activite/http/oauth.rb', line 6 def consumer_key @consumer_key end |
#consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
6 7 8 |
# File 'lib/activite/http/oauth.rb', line 6 def consumer_secret @consumer_secret end |
#secret ⇒ Object
Returns the value of attribute secret.
6 7 8 |
# File 'lib/activite/http/oauth.rb', line 6 def secret @secret end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/activite/http/oauth.rb', line 6 def token @token end |
Instance Method Details
#access_token(token, secret, options = {}) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/activite/http/oauth.rb', line 27 def access_token(token, secret, = {}) request_token = OAuth::RequestToken.new(consumer, token, secret) @access_token = request_token.get_access_token() @token = @access_token.token @secret = @access_token.secret @access_token end |
#authorize_url(token, secret, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/activite/http/oauth.rb', line 22 def (token, secret, = {}) request_token = OAuth::RequestToken.new(consumer, token, secret) request_token.() end |
#connected? ⇒ Boolean
39 40 41 |
# File 'lib/activite/http/oauth.rb', line 39 def connected? !@access_token.nil? end |
#existing_access_token(token, secret) ⇒ Object
35 36 37 |
# File 'lib/activite/http/oauth.rb', line 35 def existing_access_token(token, secret) OAuth::AccessToken.new(consumer, token, secret) end |
#request_token(options = {}) ⇒ Object
18 19 20 |
# File 'lib/activite/http/oauth.rb', line 18 def request_token( = {}) consumer.get_request_token() end |