Class: Kameleoon::Network::ExpiringToken

Inherits:
Object
  • Object
show all
Defined in:
lib/kameleoon/network/access_token_source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, expiration_time, obsolescence_time) ⇒ ExpiringToken

Returns a new instance of ExpiringToken.



206
207
208
209
210
# File 'lib/kameleoon/network/access_token_source.rb', line 206

def initialize(value, expiration_time, obsolescence_time)
  @value = value
  @expiration_time = expiration_time
  @obsolescence_time = obsolescence_time
end

Instance Attribute Details

#expiration_timeObject (readonly)

Returns the value of attribute expiration_time.



204
205
206
# File 'lib/kameleoon/network/access_token_source.rb', line 204

def expiration_time
  @expiration_time
end

#obsolescence_timeObject (readonly)

Returns the value of attribute obsolescence_time.



204
205
206
# File 'lib/kameleoon/network/access_token_source.rb', line 204

def obsolescence_time
  @obsolescence_time
end

#valueObject (readonly)

Returns the value of attribute value.



204
205
206
# File 'lib/kameleoon/network/access_token_source.rb', line 204

def value
  @value
end

Instance Method Details

#expired?(now) ⇒ Boolean

Returns:

  • (Boolean)


212
213
214
# File 'lib/kameleoon/network/access_token_source.rb', line 212

def expired?(now)
  now >= @expiration_time
end

#obsolete?(now) ⇒ Boolean

Returns:

  • (Boolean)


216
217
218
# File 'lib/kameleoon/network/access_token_source.rb', line 216

def obsolete?(now)
  now >= @obsolescence_time
end