class VoiceBase::Client::Token

Attributes

created_at[RW]
timeout[RW]
token[RW]

Public Class Methods

new(token, timeout = Float::INFINITY) click to toggle source
# File lib/voicebase/client/token.rb, line 5
def initialize(token, timeout = Float::INFINITY)
  raise VoiceBase::AuthenticationError, "Authentication token cannot be empty" unless token
  @token      = token
  @created_at = Time.now
  @timeout    = timeout
end

Public Instance Methods

expired?() click to toggle source
# File lib/voicebase/client/token.rb, line 12
def expired?
  Time.now > created_at + (timeout / 1000.to_f)
end