lib/api-client/parser.rb in api-client-1.8.1 vs lib/api-client/parser.rb in api-client-1.8.2
- old
+ new
@@ -1,15 +1,17 @@
+require 'json'
+
# ApiClient::Parser provides a method to parse the request response.
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)
raise_exception(response.code)
begin
- object = JSON.parse(response.body)
- rescue JSON::ParserError, TypeError
+ object = ::JSON.parse(response.body)
+ rescue ::JSON::ParserError, TypeError
object = {}
end
object
end