Class: PFS::Resources::Authentication::Token

Inherits:
Base
  • Object
show all
Defined in:
lib/pfs/resources/authentication/token.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#response

Instance Method Summary collapse

Methods inherited from Base

map

Constructor Details

#initialize(response, attributes = {}) ⇒ Token

Returns a new instance of Token.



13
14
15
16
# File 'lib/pfs/resources/authentication/token.rb', line 13

def initialize(response, attributes = {})
  super(response, attributes)
  @expires_on = Time.now + expires_in
end

Instance Attribute Details

#accessTokenObject Also known as: access_token

Returns the value of attribute accessToken.



7
8
9
# File 'lib/pfs/resources/authentication/token.rb', line 7

def accessToken
  @accessToken
end

#expiresInObject Also known as: expires_in

Returns the value of attribute expiresIn.



7
8
9
# File 'lib/pfs/resources/authentication/token.rb', line 7

def expiresIn
  @expiresIn
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/pfs/resources/authentication/token.rb', line 18

def valid?
  @expires_on > Time.now
end