lib/api-client/parser.rb in api-client-1.6.1 vs lib/api-client/parser.rb in api-client-1.7.0

- old
+ new

@@ -2,16 +2,14 @@ module ApiClient::Parser # Parse the JSON response. # # @param [HTTP] response HTTP object for the request. # @return [Array] the code and the body parsed. - def self.response(response, remote_object) + def self.response(response) raise_exception(response.code) begin object = JSON.parse(response.body) - object = object[remote_object] if object.key?(remote_object) - object = object[remote_object.pluralize] if object.key?(remote_object.pluralize) rescue JSON::ParserError, TypeError object = {} end object end @@ -27,6 +25,6 @@ when 502 then raise ApiClient::Exceptions::BadGateway when 503 then raise ApiClient::Exceptions::ServiceUnavailable else return end end -end \ No newline at end of file +end