Class: ApiKeyTools::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/api_key_tools.rb

Constant Summary collapse

TIME_THRESHOLD =

5 minutes or 300 seconds

60 * 5

Instance Method Summary collapse

Constructor Details

#initialize(encoder, value) ⇒ Validator

Returns a new instance of Validator.



27
28
29
30
# File 'lib/api_key_tools.rb', line 27

def initialize(encoder, value)
  @encoder = encoder
  @value = value
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/api_key_tools.rb', line 32

def valid?
  within_time_limit? && @encoder.to_s == @value
end