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.
-
#handle ⇒ Object
Returns the value of attribute handle.
-
#retry_after ⇒ Object
Returns the value of attribute retry_after.
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.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/prop/rate_limited.rb', line 5 def initialize() handle = .fetch(:handle) cache_key = .fetch(:cache_key) interval = .fetch(:interval).to_i strategy = .fetch(:strategy) super(strategy.threshold_reached()) self.description = [:description] self.handle = handle self.cache_key = cache_key self.retry_after = interval - Time.now.to_i % interval end |
Instance Attribute Details
#cache_key ⇒ Object
Returns the value of attribute cache_key.
3 4 5 |
# File 'lib/prop/rate_limited.rb', line 3 def cache_key @cache_key end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/prop/rate_limited.rb', line 3 def description @description end |
#handle ⇒ Object
Returns the value of attribute handle.
3 4 5 |
# File 'lib/prop/rate_limited.rb', line 3 def handle @handle end |
#retry_after ⇒ Object
Returns the value of attribute retry_after.
3 4 5 |
# File 'lib/prop/rate_limited.rb', line 3 def retry_after @retry_after end |
Instance Method Details
#config ⇒ Object
19 20 21 |
# File 'lib/prop/rate_limited.rb', line 19 def config Prop.configurations[@handle] end |