Class: Faraday::Response::CSV
- Inherits:
-
FaradayMiddleware::ResponseMiddleware
- Object
- FaradayMiddleware::ResponseMiddleware
- Faraday::Response::CSV
- Defined in:
- lib/faraday/response/csv.rb
Instance Method Summary collapse
-
#initialize(app = nil, options = {}) ⇒ CSV
constructor
A new instance of CSV.
-
#parse(body) ⇒ Object
Parse the response body.
Constructor Details
#initialize(app = nil, options = {}) ⇒ CSV
Returns a new instance of CSV.
13 14 15 16 |
# File 'lib/faraday/response/csv.rb', line 13 def initialize(app = nil, = {}) super(app, ) @parser_options = [:parser_options] || {} end |
Instance Method Details
#parse(body) ⇒ Object
Parse the response body.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/faraday/response/csv.rb', line 19 def parse(body) if self.class.parser begin self.class.parser.call(body, @parser_options) rescue StandardError, SyntaxError => err raise err if err.is_a? SyntaxError and err.class.name != 'Psych::SyntaxError' raise Faraday::Error::ParsingError, err end else body end end |