Class: SparkApi::ResoFaradayMiddleware
- Inherits:
-
FaradayMiddleware
- Object
- Faraday::Response::Middleware
- FaradayMiddleware
- SparkApi::ResoFaradayMiddleware
- Defined in:
- lib/spark_api/reso_faraday_middleware.rb
Instance Method Summary collapse
Methods inherited from FaradayMiddleware
Methods included from PaginateHelper
Constructor Details
This class inherits a constructor from SparkApi::FaradayMiddleware
Instance Method Details
#on_complete(env) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/spark_api/reso_faraday_middleware.rb', line 6 def on_complete(env) body = decompress_body(env) begin body = MultiJson.decode(body) if body["D"] super(env) return end env[:body] = body rescue MultiJson::ParseError => e # We will allow the client to choose their XML parser, but should do # some minor format verification raise e if body.strip[/\A<\?xml/].nil? end end |