Module: Ohanakapa::Client::RateLimit
- Included in:
- Ohanakapa::Client
- Defined in:
- lib/ohanakapa/client/rate_limit.rb
Overview
Methods for API rate limiting info
Instance Method Summary collapse
-
#rate_limit(options = {}) ⇒ Ohanakapa::RateLimit
(also: #ratelimit)
Get rate limit info from last response if available or make a new request to fetch rate limit.
-
#rate_limit!(options = {}) ⇒ Ohanakapa::RateLimit
(also: #ratelimit!)
Refresh rate limit info by making a new request.
Instance Method Details
#rate_limit(options = {}) ⇒ Ohanakapa::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/ohanakapa/client/rate_limit.rb', line 14 def rate_limit( = {}) return rate_limit! if last_response.nil? Ohanakapa::RateLimit.from_response(last_response) end |
#rate_limit!(options = {}) ⇒ Ohanakapa::RateLimit Also known as: ratelimit!
Refresh rate limit info by making a new request
26 27 28 29 |
# File 'lib/ohanakapa/client/rate_limit.rb', line 26 def rate_limit!( = {}) get "rate_limit" Ohanakapa::RateLimit.from_response(last_response) end |