Module: ApiClient::Parser
- Defined in:
- lib/api-client/parser.rb
Overview
ApiClient::Parser provides a method to parse the request response.
Class Method Summary collapse
-
.response(response, url) ⇒ Hash
Parse the JSON response.
Class Method Details
.response(response, url) ⇒ Hash
Parse the JSON response.
10 11 12 13 14 15 16 17 18 |
# File 'lib/api-client/parser.rb', line 10 def self.response(response, url) raise_exception(response, url) begin object = ::JSON.parse(response.body) rescue ::JSON::ParserError, TypeError object = {} end object end |