Class: Restforce::Bulk::Builder::ZipCsv

Inherits:
Csv
  • Object
show all
Defined in:
lib/restforce/bulk/builder/zip_csv.rb

Instance Attribute Summary

Attributes inherited from Csv

#operation

Instance Method Summary collapse

Methods inherited from Csv

#generate, #initialize, #query

Constructor Details

This class inherits a constructor from Restforce::Bulk::Builder::Csv

Instance Method Details

#create_request_txt(data) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/restforce/bulk/builder/zip_csv.rb', line 10

def create_request_txt(data)
  ::CSV.generate do |csv|
    csv << %w{Name ParentId Body}

    data.each do |item|
      csv << [item[:filename], item[:parent_id], "##{item[:filename]}"]
    end
  end
end

#transform(data, operation, content_type) ⇒ Object



5
6
7
8
# File 'lib/restforce/bulk/builder/zip_csv.rb', line 5

def transform(data, operation, content_type)
  zipper = Restforce::Bulk::Zipper.new(data, content_type)
  File.read(zipper.zip)
end