Exception: Prop::RateLimited
- Inherits:
-
StandardError
- Object
- StandardError
- Prop::RateLimited
- Defined in:
- lib/prop/rate_limited.rb
Instance Attribute Summary collapse
-
#cache_key ⇒ Object
Returns the value of attribute cache_key.
-
#description ⇒ Object
Returns the value of attribute description.
-
#first_throttled ⇒ Object
Returns the value of attribute first_throttled.
-
#handle ⇒ Object
Returns the value of attribute handle.
-
#retry_after ⇒ Object
Returns the value of attribute retry_after.
-
#threshold ⇒ Object
Returns the value of attribute threshold.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(options) ⇒ RateLimited
constructor
A new instance of RateLimited.
Constructor Details
#initialize(options) ⇒ RateLimited
Returns a new instance of RateLimited.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/prop/rate_limited.rb', line 6 def initialize() self.handle = .fetch(:handle) self.cache_key = .fetch(:cache_key) self.first_throttled = .fetch(:first_throttled) self.description = [:description] interval = .fetch(:interval).to_i self.retry_after = interval - Time.now.to_i % interval self.threshold = .fetch(:threshold) super(.fetch(:strategy).threshold_reached()) end |
Instance Attribute Details
#cache_key ⇒ Object
Returns the value of attribute cache_key.
4 5 6 |
# File 'lib/prop/rate_limited.rb', line 4 def cache_key @cache_key end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/prop/rate_limited.rb', line 4 def description @description end |
#first_throttled ⇒ Object
Returns the value of attribute first_throttled.
4 5 6 |
# File 'lib/prop/rate_limited.rb', line 4 def first_throttled @first_throttled end |
#handle ⇒ Object
Returns the value of attribute handle.
4 5 6 |
# File 'lib/prop/rate_limited.rb', line 4 def handle @handle end |
#retry_after ⇒ Object
Returns the value of attribute retry_after.
4 5 6 |
# File 'lib/prop/rate_limited.rb', line 4 def retry_after @retry_after end |
#threshold ⇒ Object
Returns the value of attribute threshold.
4 5 6 |
# File 'lib/prop/rate_limited.rb', line 4 def threshold @threshold end |
Instance Method Details
#config ⇒ Object
20 21 22 |
# File 'lib/prop/rate_limited.rb', line 20 def config Prop.configurations.fetch(@handle) end |