Class: Gemfury::Client::ParseJson
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Gemfury::Client::ParseJson
- Defined in:
- lib/gemfury/client/middleware.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(response) ⇒ Object
19 20 21 22 |
# File 'lib/gemfury/client/middleware.rb', line 19 def on_complete(response) ok = response.request_headers['Accept'] =~ /json\z/ response.body = parse(response.body) if ok end |
#parse(body) ⇒ Object
15 16 17 |
# File 'lib/gemfury/client/middleware.rb', line 15 def parse(body) body =~ /\A\s*\z/ ? nil : MultiJson.decode(body) end |