class Restforce::Bulk::Builder::Csv

Attributes

operation[RW]

Public Class Methods

new(operation) click to toggle source
# File lib/restforce/bulk/builder/csv.rb, line 7
def initialize(operation)
  self.operation = operation
end

Public Instance Methods

generate(data) click to toggle source
# File lib/restforce/bulk/builder/csv.rb, line 19
def generate(data)
  ::CSV.generate do |csv|
    csv << data.first.keys

    data.each do |attributes|
      csv << attributes.values
    end
  end
end
query(data) click to toggle source
# File lib/restforce/bulk/builder/csv.rb, line 15
def query(data)
  data
end
transform(data, operation, content_type) click to toggle source
# File lib/restforce/bulk/builder/csv.rb, line 11
def transform(data, operation, content_type)
  operation == 'query' ? query(data) : generate(data)
end