Class: Qualtrics::PanelImportFile
- Inherits:
-
Object
- Object
- Qualtrics::PanelImportFile
- Defined in:
- lib/qualtrics/panel_import_file.rb
Instance Attribute Summary collapse
-
#recipients ⇒ Object
readonly
Returns the value of attribute recipients.
Instance Method Summary collapse
-
#initialize(recipients) ⇒ PanelImportFile
constructor
A new instance of PanelImportFile.
- #temp_file ⇒ Object
Constructor Details
#initialize(recipients) ⇒ PanelImportFile
Returns a new instance of PanelImportFile.
9 10 11 |
# File 'lib/qualtrics/panel_import_file.rb', line 9 def initialize(recipients) @recipients = recipients end |
Instance Attribute Details
#recipients ⇒ Object (readonly)
Returns the value of attribute recipients.
7 8 9 |
# File 'lib/qualtrics/panel_import_file.rb', line 7 def recipients @recipients end |
Instance Method Details
#temp_file ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# 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 |