Class: KynetxAmApi::Oauth

Inherits:
Object
  • Object
show all
Defined in:
lib/kynetx_am_api/oauth.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user = nil) ⇒ Oauth

Returns a new instance of Oauth.



14
15
16
17
18
19
# File 'lib/kynetx_am_api/oauth.rb', line 14

def initialize(user=nil)
  @user = KynetxAmApi::User.new(user)
  if @user.oauth_verifier
    access_tokens
  end
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



11
12
13
# File 'lib/kynetx_am_api/oauth.rb', line 11

def access_token
  @access_token
end

#account_consumerObject

Returns the value of attribute account_consumer.



8
9
10
# File 'lib/kynetx_am_api/oauth.rb', line 8

def 
  @account_consumer
end

#api_consumerObject

Returns the value of attribute api_consumer.



9
10
11
# File 'lib/kynetx_am_api/oauth.rb', line 9

def api_consumer
  @api_consumer
end

#request_tokenObject

Returns the value of attribute request_token.



7
8
9
# File 'lib/kynetx_am_api/oauth.rb', line 7

def request_token
  @request_token
end

#userObject

Returns the value of attribute user.



10
11
12
# File 'lib/kynetx_am_api/oauth.rb', line 10

def user
  @user
end

Class Method Details

.accounts_server_url=(v) ⇒ Object



32
33
34
# File 'lib/kynetx_am_api/oauth.rb', line 32

def self.accounts_server_url=(v)
  @@accounts_server_url = v
end

.api_server_url=(v) ⇒ Object



36
37
38
# File 'lib/kynetx_am_api/oauth.rb', line 36

def self.api_server_url=(v)
  @@api_server_url = v
end

.consumer_key=(v) ⇒ Object



40
41
42
# File 'lib/kynetx_am_api/oauth.rb', line 40

def self.consumer_key=(v)
  @@consumer_key = v
end

.consumer_secret=(v) ⇒ Object



44
45
46
# File 'lib/kynetx_am_api/oauth.rb', line 44

def self.consumer_secret=(v)
  @@consumer_secret = v
end

Instance Method Details

#get_access_tokenObject



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

def get_access_token
  return @access_token if @access_token
  return @access_token = OAuth::AccessToken.new(get_api_consumer, @user.access_token, @user.access_secret)
end

#get_request_tokenObject



26
27
28
29
# File 'lib/kynetx_am_api/oauth.rb', line 26

def get_request_token
  return @request_token if @request_token
  return @request_token = .get_request_token
end