Class: Teams::Auth::Token
- Inherits:
-
Object
- Object
- Teams::Auth::Token
- Defined in:
- lib/teams/auth/token.rb
Instance Attribute Summary collapse
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #expired?(skew: 60) ⇒ Boolean
-
#initialize(value) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(value) ⇒ Token
Returns a new instance of Token.
11 12 13 14 |
# File 'lib/teams/auth/token.rb', line 11 def initialize(value) @value = value @payload = decode_payload(value) end |
Instance Attribute Details
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
9 10 11 |
# File 'lib/teams/auth/token.rb', line 9 def payload @payload end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/teams/auth/token.rb', line 9 def value @value end |
Instance Method Details
#expired?(skew: 60) ⇒ Boolean
16 17 18 19 20 21 |
# File 'lib/teams/auth/token.rb', line 16 def expired?(skew: 60) exp = payload["exp"] return false unless exp Time.now.to_i >= exp.to_i - skew end |