Class: AzIdentity::Identity::Credentials
- Inherits:
-
Object
- Object
- AzIdentity::Identity::Credentials
- Defined in:
- lib/az_identity/identity/credentials.rb
Constant Summary collapse
- EXPIRATION_BUFFER =
600
Instance Attribute Summary collapse
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token, expires_at) ⇒ Credentials
constructor
A new instance of Credentials.
- #refresh_needed? ⇒ Boolean
Constructor Details
#initialize(token, expires_at) ⇒ Credentials
Returns a new instance of Credentials.
10 11 12 13 |
# File 'lib/az_identity/identity/credentials.rb', line 10 def initialize(token, expires_at) @token = token @expires_at = expires_at end |
Instance Attribute Details
#expires_at ⇒ Object
Returns the value of attribute expires_at.
6 7 8 |
# File 'lib/az_identity/identity/credentials.rb', line 6 def expires_at @expires_at end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/az_identity/identity/credentials.rb', line 6 def token @token end |
Instance Method Details
#refresh_needed? ⇒ Boolean
15 16 17 18 19 |
# File 'lib/az_identity/identity/credentials.rb', line 15 def refresh_needed? return true unless expires_at Time.now >= expires_at - EXPIRATION_BUFFER end |