Class: CloudFoundry::Client::Response::ParseJSON
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- CloudFoundry::Client::Response::ParseJSON
- Defined in:
- lib/cloudfoundry/client/response.rb
Overview
Faraday Response Middleware to parse cloud JSON responses.
Instance Method Summary collapse
-
#parse(body) ⇒ Hash
Parses a JSON response.
Instance Method Details
#parse(body) ⇒ Hash
Parses a JSON response.
12 13 14 15 16 17 18 19 |
# File 'lib/cloudfoundry/client/response.rb', line 12 def parse(body) case body when " " then nil else JSON.parse(body, :symbolize_names => true, :symbolize_keys => true) end rescue JSON::ParserError raise CloudFoundry::Client::Exception::BadResponse, "Can't parse response into JSON:" + body end |