Class: Kameleoon::Network::ExpiringToken
- Inherits:
-
Object
- Object
- Kameleoon::Network::ExpiringToken
- Defined in:
- lib/kameleoon/network/access_token_source.rb
Instance Attribute Summary collapse
-
#expiration_time ⇒ Object
readonly
Returns the value of attribute expiration_time.
-
#obsolescence_time ⇒ Object
readonly
Returns the value of attribute obsolescence_time.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #expired?(now) ⇒ Boolean
-
#initialize(value, expiration_time, obsolescence_time) ⇒ ExpiringToken
constructor
A new instance of ExpiringToken.
- #obsolete?(now) ⇒ Boolean
Constructor Details
#initialize(value, expiration_time, obsolescence_time) ⇒ ExpiringToken
Returns a new instance of ExpiringToken.
124 125 126 127 128 |
# File 'lib/kameleoon/network/access_token_source.rb', line 124 def initialize(value, expiration_time, obsolescence_time) @value = value @expiration_time = expiration_time @obsolescence_time = obsolescence_time end |
Instance Attribute Details
#expiration_time ⇒ Object (readonly)
Returns the value of attribute expiration_time.
122 123 124 |
# File 'lib/kameleoon/network/access_token_source.rb', line 122 def expiration_time @expiration_time end |
#obsolescence_time ⇒ Object (readonly)
Returns the value of attribute obsolescence_time.
122 123 124 |
# File 'lib/kameleoon/network/access_token_source.rb', line 122 def obsolescence_time @obsolescence_time end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
122 123 124 |
# File 'lib/kameleoon/network/access_token_source.rb', line 122 def value @value end |
Instance Method Details
#expired?(now) ⇒ Boolean
130 131 132 |
# File 'lib/kameleoon/network/access_token_source.rb', line 130 def expired?(now) now >= @expiration_time end |
#obsolete?(now) ⇒ Boolean
134 135 136 |
# File 'lib/kameleoon/network/access_token_source.rb', line 134 def obsolete?(now) now >= @obsolescence_time end |