Method: PacerApi::Translation#decode_response

Defined in:
lib/pacer_api/translation.rb

#decode_response(body) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/pacer_api/translation.rb', line 22

def decode_response(body)
  result = ResponseTranslator.translate(JSON.parse(body))
  if ENV.key?("DEBUG")
    puts "<<<<"
    pp result
  end
  result
rescue JSON::ParserError => e
  raise PacerApi::DecodeError, "#{e.class} #{e.message}", e.backtrace
end