lib/intercom/request.rb in intercom-2.1.4 vs lib/intercom/request.rb in intercom-2.1.5

- old
+ new

@@ -79,10 +79,12 @@ def raise_errors_on_failure(res) if res.code.to_i.eql?(404) raise Intercom::ResourceNotFound.new('Resource Not Found') elsif res.code.to_i.eql?(401) raise Intercom::AuthenticationError.new('Unauthorized') + elsif res.code.to_i.eql?(403) + raise Intercom::AuthenticationError.new('Forbidden') elsif res.code.to_i.eql?(500) raise Intercom::ServerError.new('Server Error') elsif res.code.to_i.eql?(502) raise Intercom::BadGatewayError.new('Bad Gateway Error') elsif res.code.to_i.eql?(503) @@ -98,10 +100,10 @@ error_context = { :http_code => parsed_http_code, :application_error_code => error_code } case error_code - when 'unauthorized' + when 'unauthorized', 'forbidden' raise Intercom::AuthenticationError.new(error_details['message'], error_context) when "bad_request", "missing_parameter", 'parameter_invalid' raise Intercom::BadRequestError.new(error_details['message'], error_context) when "not_found" raise Intercom::ResourceNotFound.new(error_details['message'], error_context)