Class: BigShift::AccessToken

Inherits:
Object
  • Object
show all
Defined in:
lib/big_shift/models/access_token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ AccessToken

Returns a new instance of AccessToken.



5
6
7
8
9
# File 'lib/big_shift/models/access_token.rb', line 5

def initialize(hash = {})
  @access_token = hash['access_token']
  @expires      = hash['expires_in']
  @created      = Time.now
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



3
4
5
# File 'lib/big_shift/models/access_token.rb', line 3

def access_token
  @access_token
end

#expiresObject

Returns the value of attribute expires.



3
4
5
# File 'lib/big_shift/models/access_token.rb', line 3

def expires
  @expires
end

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/big_shift/models/access_token.rb', line 11

def expired?
  Time.now - @created > (expires - 10)
end