Method: X::ResponseParser#parse
- Defined in:
- lib/x/response_parser.rb
#parse(response:, array_class: nil, object_class: nil) ⇒ Hash, ...
Parse an HTTP response
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/x/response_parser.rb', line 51 def parse(response:, array_class: nil, object_class: nil) raise error(response) unless response.is_a?(Net::HTTPSuccess) return if response.instance_of?(Net::HTTPNoContent) begin JSON.parse(response.body, array_class:, object_class:) rescue JSON::ParserError nil end end |