Class: TableauRestApi::Token

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#expiresObject (readonly)

Returns the value of attribute expires.



5
6
7
# File 'lib/tableau_rest_api/util/token.rb', line 5

def expires
  @expires
end

#valueObject (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

Returns:

  • (Boolean)


12
13
14
# File 'lib/tableau_rest_api/util/token.rb', line 12

def expired?
  @value ? Time.now > @expires : true
end