Class: Procore::Auth::Token
- Inherits:
-
Object
- Object
- Procore::Auth::Token
- Defined in:
- lib/procore/auth/token.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#refresh_token ⇒ Object
readonly
Returns the value of attribute refresh_token.
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#initialize(access_token:, refresh_token:, expires_at:) ⇒ Token
constructor
A new instance of Token.
- #invalid? ⇒ Boolean
Constructor Details
#initialize(access_token:, refresh_token:, expires_at:) ⇒ Token
Returns a new instance of Token.
5 6 7 8 9 |
# File 'lib/procore/auth/token.rb', line 5 def initialize(access_token:, refresh_token:, expires_at:) @access_token = access_token @refresh_token = refresh_token @expires_at = expires_at end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/procore/auth/token.rb', line 4 def access_token @access_token end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
4 5 6 |
# File 'lib/procore/auth/token.rb', line 4 def expires_at @expires_at end |
#refresh_token ⇒ Object (readonly)
Returns the value of attribute refresh_token.
4 5 6 |
# File 'lib/procore/auth/token.rb', line 4 def refresh_token @refresh_token end |
Instance Method Details
#expired? ⇒ Boolean
15 16 17 |
# File 'lib/procore/auth/token.rb', line 15 def expired? expires_at.to_i < Time.now.to_i end |
#invalid? ⇒ Boolean
11 12 13 |
# File 'lib/procore/auth/token.rb', line 11 def invalid? access_token.nil? end |