Class: KrakenClient::Requests::Limiter
- Inherits:
-
Object
- Object
- KrakenClient::Requests::Limiter
- Defined in:
- lib/kraken_client/requests/limiter.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#current_count ⇒ Object
readonly
Returns the value of attribute current_count.
-
#endpoint_name ⇒ Object
readonly
Returns the value of attribute endpoint_name.
-
#previous_timestamps ⇒ Object
readonly
Returns the value of attribute previous_timestamps.
Instance Method Summary collapse
-
#initialize(config) ⇒ Limiter
constructor
A new instance of Limiter.
- #update(endpoint_name) ⇒ Object
Constructor Details
#initialize(config) ⇒ Limiter
Returns a new instance of Limiter.
7 8 9 10 11 |
# File 'lib/kraken_client/requests/limiter.rb', line 7 def initialize(config) @config = config @previous_timestamps = Time.now @current_count = counter_total end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/kraken_client/requests/limiter.rb', line 5 def config @config end |
#current_count ⇒ Object (readonly)
Returns the value of attribute current_count.
5 6 7 |
# File 'lib/kraken_client/requests/limiter.rb', line 5 def current_count @current_count end |
#endpoint_name ⇒ Object (readonly)
Returns the value of attribute endpoint_name.
5 6 7 |
# File 'lib/kraken_client/requests/limiter.rb', line 5 def endpoint_name @endpoint_name end |
#previous_timestamps ⇒ Object (readonly)
Returns the value of attribute previous_timestamps.
5 6 7 |
# File 'lib/kraken_client/requests/limiter.rb', line 5 def @previous_timestamps end |
Instance Method Details
#update(endpoint_name) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/kraken_client/requests/limiter.rb', line 13 def update(endpoint_name) return unless config.limiter @endpoint_name = endpoint_name decrement_current_count end |