Class: Kameleoon::Network::ExpiringToken

Inherits:
Object
  • Object
show all
Defined in:
lib/kameleoon/network/access_token_source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, expiration_time, obsolescence_time) ⇒ ExpiringToken

Returns a new instance of ExpiringToken.



124
125
126
127
128
# File 'lib/kameleoon/network/access_token_source.rb', line 124

def initialize(value, expiration_time, obsolescence_time)
  @value = value
  @expiration_time = expiration_time
  @obsolescence_time = obsolescence_time
end

Instance Attribute Details

#expiration_timeObject (readonly)

Returns the value of attribute expiration_time.



122
123
124
# File 'lib/kameleoon/network/access_token_source.rb', line 122

def expiration_time
  @expiration_time
end

#obsolescence_timeObject (readonly)

Returns the value of attribute obsolescence_time.



122
123
124
# File 'lib/kameleoon/network/access_token_source.rb', line 122

def obsolescence_time
  @obsolescence_time
end

#valueObject (readonly)

Returns the value of attribute value.



122
123
124
# File 'lib/kameleoon/network/access_token_source.rb', line 122

def value
  @value
end

Instance Method Details

#expired?(now) ⇒ Boolean

Returns:

  • (Boolean)


130
131
132
# File 'lib/kameleoon/network/access_token_source.rb', line 130

def expired?(now)
  now >= @expiration_time
end

#obsolete?(now) ⇒ Boolean

Returns:

  • (Boolean)


134
135
136
# File 'lib/kameleoon/network/access_token_source.rb', line 134

def obsolete?(now)
  now >= @obsolescence_time
end