class Qualtrics::PanelImportFile

Attributes

recipients[R]

Public Class Methods

new(recipients) click to toggle source
# File lib/qualtrics/panel_import_file.rb, line 9
def initialize(recipients)
  @recipients = recipients
end

Public Instance Methods

temp_file() click to toggle source
# File lib/qualtrics/panel_import_file.rb, line 13
def temp_file
  if @temp_file.nil?
    tmp_file = Tempfile.new('panel_import')
    csv_path = tmp_file.path
    tmp_file.close
    CSV.open(csv_path, 'wb', :force_quotes => true, :write_headers => true, :headers => Qualtrics::RecipientImportRow.fields) do |csv|
      @recipients.each do |recipient|
        csv << Qualtrics::RecipientImportRow.new(recipient).to_a
      end
    end
    @temp_file = csv_path
  end
  @temp_file
end