Module: Nearmiss::Client::RateLimit
- Included in:
- Nearmiss::Client
- Defined in:
- lib/nearmiss-ruby/client/rate_limit.rb
Overview
Methods for API rate limiting info
Instance Method Summary collapse
-
#rate_limit(options = {}) ⇒ Nearmiss::RateLimit
(also: #ratelimit)
Get rate limit info from last response if available or make a new request to fetch rate limit.
-
#rate_limit!(options = {}) ⇒ Nearmiss::RateLimit
(also: #ratelimit!)
Refresh rate limit info by making a new request.
-
#rate_limit_remaining(options = {}) ⇒ Fixnum
(also: #ratelimit_remaining)
Get number of rate limted requests remaining.
-
#rate_limit_remaining!(options = {}) ⇒ Fixnum
(also: #ratelimit_remaining!)
Refresh rate limit info and get number of rate limted requests remaining.
Instance Method Details
#rate_limit(options = {}) ⇒ Nearmiss::RateLimit Also known as: ratelimit
Get rate limit info from last response if available or make a new request to fetch rate limit
14 15 16 17 18 |
# File 'lib/nearmiss-ruby/client/rate_limit.rb', line 14 def rate_limit( = {}) return rate_limit! if last_response.nil? Nearmiss::RateLimit.from_response(last_response) end |
#rate_limit!(options = {}) ⇒ Nearmiss::RateLimit Also known as: ratelimit!
Refresh rate limit info by making a new request
34 35 36 37 |
# File 'lib/nearmiss-ruby/client/rate_limit.rb', line 34 def rate_limit!( = {}) get "rate_limit" Nearmiss::RateLimit.from_response(last_response) end |
#rate_limit_remaining(options = {}) ⇒ Fixnum Also known as: ratelimit_remaining
Get number of rate limted requests remaining
25 26 27 28 |
# File 'lib/nearmiss-ruby/client/rate_limit.rb', line 25 def rate_limit_remaining( = {}) nearmiss_warn "Deprecated: Please use .rate_limit.remaining" rate_limit.remaining end |
#rate_limit_remaining!(options = {}) ⇒ Fixnum Also known as: ratelimit_remaining!
Refresh rate limit info and get number of rate limted requests remaining
43 44 45 46 |
# File 'lib/nearmiss-ruby/client/rate_limit.rb', line 43 def rate_limit_remaining!( = {}) nearmiss_warn "Deprecated: Please use .rate_limit!.remaining" rate_limit!.remaining end |