Class: TableauRestApi::Token
- Inherits:
-
Object
- Object
- TableauRestApi::Token
- Defined in:
- lib/tableau_rest_api/util/token.rb
Overview
Representation of a x_auth_tableau token These tokens have a finite lifespan, the default is 4 hours.
Instance Attribute Summary collapse
-
#expires ⇒ Object
readonly
Returns the value of attribute expires.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#initialize(token, duration) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(token, duration) ⇒ Token
Returns a new instance of Token.
7 8 9 10 |
# File 'lib/tableau_rest_api/util/token.rb', line 7 def initialize(token, duration) @value = token @expires = duration.from_now end |
Instance Attribute Details
#expires ⇒ Object (readonly)
Returns the value of attribute expires.
5 6 7 |
# File 'lib/tableau_rest_api/util/token.rb', line 5 def expires @expires end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/tableau_rest_api/util/token.rb', line 5 def value @value end |
Instance Method Details
#expired? ⇒ Boolean
12 13 14 |
# File 'lib/tableau_rest_api/util/token.rb', line 12 def expired? @value ? Time.now > @expires : true end |