Class: ACTV::Response::ParseJson
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- ACTV::Response::ParseJson
- Defined in:
- lib/actv/response/parse_json.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
21 22 23 24 25 |
# File 'lib/actv/response/parse_json.rb', line 21 def on_complete(env) if respond_to?(:parse) env[:body] = parse(env[:body]) unless [204, 304].include?(env[:status]) end end |
#parse(body) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/actv/response/parse_json.rb', line 8 def parse(body) case body when '' nil when 'true' true when 'false' false else MultiJson.load(body, :symbolize_keys => true) end end |