123456789_123456789_123456789_123456789_123456789_

Module: Octokit::Client::RateLimit

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/octokit/client/rate_limit.rb

Overview

Methods for API rate limiting info

Instance Method Summary

Instance Method Details

#rate_limit(_options = {}) ⇒ Octokit::RateLimit Also known as: #ratelimit

Get rate limit info from last response if available or make a new request to fetch rate limit

[ GitHub ]

  
# File 'lib/octokit/client/rate_limit.rb', line 14

def rate_limit(_options = {})
  return rate_limit! if last_response.nil?

  Octokit::RateLimit.from_response(last_response)
end

#rate_limit!(_options = {}) ⇒ Octokit::RateLimit Also known as: #ratelimit!

Refresh rate limit info by making a new request

[ GitHub ]

  
# File 'lib/octokit/client/rate_limit.rb', line 35

def rate_limit!(_options = {})
  get 'rate_limit'
  Octokit::RateLimit.from_response(last_response)
end

#rate_limit_remaining(_options = {}) ⇒ Integer Also known as: #ratelimit_remaining

Get number of rate limted requests remaining

Returns:

  • (Integer)

    Number of requests remaining in this period

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/rate_limit.rb', line 25

def rate_limit_remaining(_options = {})
  octokit_warn 'Deprecated: Please use .rate_limit.remaining'
  rate_limit.remaining
end

#rate_limit_remaining!(_options = {}) ⇒ Integer Also known as: #ratelimit_remaining!

Refresh rate limit info and get number of rate limted requests remaining

Returns:

  • (Integer)

    Number of requests remaining in this period

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/rate_limit.rb', line 45

def rate_limit_remaining!(_options = {})
  octokit_warn 'Deprecated: Please use .rate_limit!.remaining'
  rate_limit!.remaining
end

#ratelimit(_options = {})

Alias for #rate_limit.

[ GitHub ]

  
# File 'lib/octokit/client/rate_limit.rb', line 19

alias ratelimit rate_limit

#ratelimit!(_options = {})

Alias for #rate_limit!.

[ GitHub ]

  
# File 'lib/octokit/client/rate_limit.rb', line 39

alias ratelimit! rate_limit!

#ratelimit_remaining(_options = {})

[ GitHub ]

  
# File 'lib/octokit/client/rate_limit.rb', line 29

alias ratelimit_remaining rate_limit_remaining

#ratelimit_remaining!(_options = {})

[ GitHub ]

  
# File 'lib/octokit/client/rate_limit.rb', line 49

alias ratelimit_remaining! rate_limit_remaining!