class DeskApi::RateLimit

{DeskApi::RateLimit} deciphers rate limiting headers in responses from desk.com API.

@author Thomas Stachl <tstachl@salesforce.com> @copyright Copyright © 2013-2016 Salesforce.com @license BSD 3-Clause License

Public Class Methods

new(attrs = {}) click to toggle source
# File lib/desk_api/rate_limit.rb, line 37
def initialize(attrs = {})
  @attrs = attrs
end

Public Instance Methods

limit() click to toggle source

Max requests that can be made in this period

@return [Integer]

# File lib/desk_api/rate_limit.rb, line 44
def limit
  limit = @attrs['x-rate-limit-limit']
  limit.to_i if limit
end
remaining() click to toggle source

Request that are remaining during this period

@return [Integer]

# File lib/desk_api/rate_limit.rb, line 52
def remaining
  remaining = @attrs['x-rate-limit-remaining']
  remaining.to_i if remaining
end
reset_in() click to toggle source

Seconds until the rate limit will be reset

@return [Integer]

# File lib/desk_api/rate_limit.rb, line 60
def reset_in
  reset_in = @attrs['x-rate-limit-reset']
  reset_in.to_i if reset_in
end
Also aliased as: retry_after
retry_after()
Alias for: reset_in