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

Instance Method Summary collapse

Instance Attribute Details

#consumer_keyObject

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_secretObject

Returns the value of attribute consumer_secret


6
7
8
# File 'lib/activite/http/oauth.rb', line 6

def consumer_secret
  @consumer_secret
end

#secretObject

Returns the value of attribute secret


6
7
8
# File 'lib/activite/http/oauth.rb', line 6

def secret
  @secret
end

#tokenObject

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


26
27
28
29
30
31
32
# File 'lib/activite/http/oauth.rb', line 26

def access_token(token, secret, options = {})
  request_token = OAuth::RequestToken.new(consumer, token, secret)
  @access_token = request_token.get_access_token(options)
  @token = @access_token.token
  @secret = @access_token.secret
  @access_token
end

#authorize_url(token, secret, options = {}) ⇒ Object


21
22
23
24
# File 'lib/activite/http/oauth.rb', line 21

def authorize_url(token, secret, options = {})
  request_token = OAuth::RequestToken.new(consumer, token, secret)
  request_token.authorize_url(options)
end

#connected?Boolean


38
39
40
# File 'lib/activite/http/oauth.rb', line 38

def connected?
  !@access_token.nil?
end

#existing_access_token(token, secret) ⇒ Object


34
35
36
# File 'lib/activite/http/oauth.rb', line 34

def existing_access_token(token, secret)
  OAuth::AccessToken.new(consumer, token, secret)
end

#request_token(options = {}) ⇒ Object


17
18
19
# File 'lib/activite/http/oauth.rb', line 17

def request_token(options = {})
  consumer.get_request_token(options)
end