Class: Evrythng::Response::ParseJson

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

Instance Method Summary collapse

Instance Method Details

#parse(body) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/evrythng/response/parse_json.rb', line 8

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