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

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

Returns:

See Also:



14
15
16
17
18
# File 'lib/ohanakapa/client/rate_limit.rb', line 14

def rate_limit(options = {})
  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

Returns:

See Also:



26
27
28
29
# File 'lib/ohanakapa/client/rate_limit.rb', line 26

def rate_limit!(options = {})
  get "rate_limit"
  Ohanakapa::RateLimit.from_response(last_response)
end