Class: ChalkRuby::Token
- Inherits:
-
Object
- Object
- ChalkRuby::Token
- Defined in:
- lib/chalk_ruby/token.rb
Instance Attribute Summary collapse
-
#engines ⇒ Object
Returns the value of attribute engines.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#initialize(exchange_credentials_response) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(exchange_credentials_response) ⇒ Token
6 7 8 9 10 11 |
# File 'lib/chalk_ruby/token.rb', line 6 def initialize(exchange_credentials_response) @token = exchange_credentials_response[:access_token] @expires_at = DateTime.parse(exchange_credentials_response[:expires_at]) @environment = exchange_credentials_response[:primary_environment] @engines = exchange_credentials_response[:engines] end |
Instance Attribute Details
#engines ⇒ Object
Returns the value of attribute engines.
3 4 5 |
# File 'lib/chalk_ruby/token.rb', line 3 def engines @engines end |
#environment ⇒ Object
Returns the value of attribute environment.
3 4 5 |
# File 'lib/chalk_ruby/token.rb', line 3 def environment @environment end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
3 4 5 |
# File 'lib/chalk_ruby/token.rb', line 3 def expires_at @expires_at end |
#token ⇒ Object
Returns the value of attribute token.
3 4 5 |
# File 'lib/chalk_ruby/token.rb', line 3 def token @token end |
Instance Method Details
#expired? ⇒ Boolean
13 14 15 |
# File 'lib/chalk_ruby/token.rb', line 13 def expired? DateTime.now.advance({ seconds: 60 }) > @expires_at end |