Class: Faraday::Response::ParseCSV Private

Inherits:
Middleware
  • Object
show all
Defined in:
lib/faraday/response/parse_csv.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Parses response bodies as CSV

Examples:


require 'faraday/csv'

connection = Faraday.new('https://example.org/') do |faraday|
  faraday.response :csv, headers: :first_row
  faraday.adapter Faraday.default_adapter
end

response = connection.get('/data.csv')
response.body.first #=> <CSV::Row "foo":"bar">

Instance Method Summary collapse

Constructor Details

#initialize(app = nil, opts = {}) ⇒ ParseCSV

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new instance of CSV parsing middleware

Parameters:

  • app (#call, nil) (defaults to: nil)

    Rack app

  • opts (Hash) (defaults to: {})

    CSV parsing options

See Also:

  • CSV.new


33
34
35
36
37
# File 'lib/faraday/response/parse_csv.rb', line 33

def initialize(app = nil, opts = {})
  @opts = opts

  super(app)
end