class Desk::Error

Custom error class for rescuing from all Desk.com errors

Attributes

http_headers[R]

Public Class Methods

new(message, http_headers) click to toggle source
Calls superclass method
# File lib/desk/error.rb, line 6
def initialize(message, http_headers)
  http_headers ||= {}
  @http_headers = Hash[http_headers]
  super message
end

Public Instance Methods

ratelimit_limit() click to toggle source
# File lib/desk/error.rb, line 16
def ratelimit_limit
  @http_headers.values_at('x-rate-limit-limit', 'X-Rate-Limit-Limit').detect {|value| value }.to_i
end
ratelimit_remaining() click to toggle source
# File lib/desk/error.rb, line 20
def ratelimit_remaining
  @http_headers.values_at('x-rate-limit-remaining', 'X-Rate-Limit-Remaining').detect {|value| value }.to_i
end
ratelimit_reset() click to toggle source
# File lib/desk/error.rb, line 12
def ratelimit_reset
  @http_headers.values_at('x-rate-limit-reset', 'X-Rate-Limit-Reset').detect {|value| value }.to_i
end
retry_after() click to toggle source
# File lib/desk/error.rb, line 24
def retry_after
  ratelimit_reset
end