lib/3scale/client.rb in 3scale_client-2.8.2 vs lib/3scale/client.rb in 3scale_client-2.9.0

- old
+ new

@@ -90,11 +90,11 @@ case http_response when Net::HTTPSuccess,Net::HTTPConflict build_authorize_response(http_response.body) when Net::HTTPClientError - build_error_response(http_response.body) + build_error_response(http_response.body, AuthorizeResponse) else raise ServerError.new(http_response) end end @@ -216,11 +216,11 @@ case http_response when Net::HTTPSuccess,Net::HTTPConflict build_authorize_response(http_response.body) when Net::HTTPClientError - build_error_response(http_response.body) + build_error_response(http_response.body, AuthorizeResponse) else raise ServerError.new(http_response) end end @@ -265,11 +265,11 @@ case http_response when Net::HTTPSuccess,Net::HTTPConflict build_authorize_response(http_response.body) when Net::HTTPClientError - build_error_response(http_response.body) + build_error_response(http_response.body, AuthorizeResponse) else raise ServerError.new(http_response) end end @@ -372,14 +372,14 @@ end response end - def build_error_response(body) + def build_error_response(body, klass = Response) doc = Nokogiri::XML(body) node = doc.at_css('error') - response = Response.new + response = klass.new response.error!(node.content.to_s.strip, node['code'].to_s.strip) response end end end