class Urbanairship::Common::Response

Public Class Methods

check_code(response_code, response) click to toggle source

Parse Response Codes and trigger appropriate actions.

# File lib/urbanairship/common.rb, line 143
def self.check_code(response_code, response)
  if response_code == 401
    raise Unauthorized, 'Client is not authorized to make this request. The authorization credentials are incorrect or missing.'
  elsif response_code == 403
    raise Forbidden, 'Client is forbidden from making this request. The application does not have the proper entitlement to access this feature.'
  elsif !((200...300).include?(response_code))
    raise AirshipFailure.new.from_response(response)
  end
end