Method: PDC::Response::Parser#parse
- Defined in:
- lib/pdc/http/response/parser.rb
#parse(body) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pdc/http/response/parser.rb', line 10 def parse(body) logger.debug "\n.....parse to json ....................................." logger.debug self.class logger.debug '... parsing' + body.to_s.truncate(55) begin json = MultiJson.load(body, symbolize_keys: true) rescue MultiJson::ParseError => e raise PDC::JsonParseError, e end { data: extract_data(json), # Always an Array errors: extract_errors(json), # metadata: (json) # a hash } end |