lib/sorenson/services/base.rb in 360_services-1.0.5 vs lib/sorenson/services/base.rb in 360_services-1.0.6
- old
+ new
@@ -59,10 +59,15 @@
parse_response(client.delete)
end
def self.parse_response(response)
begin
- JSON.parse(response.body)
+ data = JSON.parse(response.body)
+ if data.is_a?(Hash)
+ HashWithIndifferentAccess.new.merge(data)
+ else
+ data
+ end
rescue JSON::ParserError => e
raise InvalidServerResponse.new("Sorenson::Services::InvalidServerResponse: #{e.message}")
end
end
end
\ No newline at end of file