Class: AruxApp::API::Auth::AccessToken

Inherits:
Object
  • Object
show all
Defined in:
lib/arux_app/api/auth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AccessToken

Returns a new instance of AccessToken.



10
11
12
13
14
15
16
17
18
# File 'lib/arux_app/api/auth.rb', line 10

def initialize(options = {})
  self.token = options[:token]
  self.auth = options[:auth]
  self.scope = options[:scope]

  raise API::InitializerError.new(:token, "can't be blank") if self.token.to_s.empty?
  raise API::InitializerError.new(:auth, "can't be blank") if self.auth.nil?
  raise API::InitializerError.new(:auth, "must be of class type AruxApp::API::Auth") if !self.auth.is_a?(AruxApp::API::Auth)
end

Instance Attribute Details

#authObject

Returns the value of attribute auth.



8
9
10
# File 'lib/arux_app/api/auth.rb', line 8

def auth
  @auth
end

#scopeObject

Returns the value of attribute scope.



8
9
10
# File 'lib/arux_app/api/auth.rb', line 8

def scope
  @scope
end

#tokenObject

Returns the value of attribute token.



8
9
10
# File 'lib/arux_app/api/auth.rb', line 8

def token
  @token
end

Instance Method Details

#user_data(params = {}) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/arux_app/api/auth.rb', line 20

def user_data(params = {})
  if @user_data.nil? and !@token.nil?
    acc = AruxApp::API::Account.new(:access_token => self)
    @user_data = acc.owner(params)["user"]
  end
  @user_data
end