Class: ContextIO::Response::ParseJson Private

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/context-io/response/parse_json.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Faraday middleware for parsing JSON in the response body

Instance Method Summary collapse

Instance Method Details

#parse(body) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parse the response body into JSON



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/context-io/response/parse_json.rb', line 15

def parse(body)
  case body
  when ''
    nil
  when 'true'
    true
  when 'false'
    false
  else
    ::MultiJson.decode(body)
  end
end