Module: Eson::ResponseParser
- Defined in:
- lib/eson/modules/response_parser.rb
Overview
A plugins that parses HTTP responses as json and returns the json
Defined Under Namespace
Classes: JSONParseError
Instance Method Summary collapse
-
#call(*args) ⇒ Hash, Array
Evaluate the plugin.
-
#parse(response) ⇒ Hash, Array
Parse the response.
Instance Method Details
#call(*args) ⇒ Hash, Array
Evaluate the plugin.
15 16 17 |
# File 'lib/eson/modules/response_parser.rb', line 15 def call(*args) parse(super) end |
#parse(response) ⇒ Hash, Array
Parse the response.
24 25 26 27 28 29 30 31 32 |
# File 'lib/eson/modules/response_parser.rb', line 24 def parse(response) begin MultiJson.decode(response.body) if response.body rescue MultiJson::DecodeError => e error = JSONParseError.new(e., response) error.source = response.body raise error end end |