Exception: RateLimitMockServer::RateLimitError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rate_limit_mock_server/rate_limit_error.rb

Constant Summary collapse

MESSAGE_TEMPLATE =
'Received requests @%0.1f rps! Max allowed: %d rps'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rate:, limit:) ⇒ RateLimitError

Returns a new instance of RateLimitError.



9
10
11
12
13
14
# File 'lib/rate_limit_mock_server/rate_limit_error.rb', line 9

def initialize(rate:, limit:)
  @rate = rate
  @limit = limit

  super format(MESSAGE_TEMPLATE, rate, limit)
end

Instance Attribute Details

#limitObject (readonly)

Returns the value of attribute limit.



7
8
9
# File 'lib/rate_limit_mock_server/rate_limit_error.rb', line 7

def limit
  @limit
end

#rateObject (readonly)

Returns the value of attribute rate.



7
8
9
# File 'lib/rate_limit_mock_server/rate_limit_error.rb', line 7

def rate
  @rate
end