Class: Alula::TokenExchange::ImpersonatedToken

Inherits:
Object
  • Object
show all
Defined in:
lib/alula/resources/token_exchange.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ ImpersonatedToken

Returns a new instance of ImpersonatedToken.



22
23
24
25
26
27
28
29
30
31
# File 'lib/alula/resources/token_exchange.rb', line 22

def initialize(attributes)
  @raw_response = attributes

  @date_created = Time.parse(attributes['dateCreated'])
  @access_token = attributes['accessToken']
  @expires_at = Time.parse(attributes['expires'])
  @expires_in = (@expires_at - Time.now.utc).to_i
  @refresh_token = attributes['refresh_token']
  @scope = attributes['scope']
end

Instance Attribute Details

#access_tokenObject (readonly)

Simple Oauth::Response reader object



20
21
22
# File 'lib/alula/resources/token_exchange.rb', line 20

def access_token
  @access_token
end

#date_createdObject (readonly)

Simple Oauth::Response reader object



20
21
22
# File 'lib/alula/resources/token_exchange.rb', line 20

def date_created
  @date_created
end

#expires_atObject (readonly)

Simple Oauth::Response reader object



20
21
22
# File 'lib/alula/resources/token_exchange.rb', line 20

def expires_at
  @expires_at
end

#expires_inObject (readonly)

Simple Oauth::Response reader object



20
21
22
# File 'lib/alula/resources/token_exchange.rb', line 20

def expires_in
  @expires_in
end

#refresh_tokenObject (readonly)

Simple Oauth::Response reader object



20
21
22
# File 'lib/alula/resources/token_exchange.rb', line 20

def refresh_token
  @refresh_token
end

#scopeObject (readonly)

Simple Oauth::Response reader object



20
21
22
# File 'lib/alula/resources/token_exchange.rb', line 20

def scope
  @scope
end