Class: Qualtrics::PanelImport
- Defined in:
- lib/qualtrics/panel_import.rb
Instance Attribute Summary collapse
-
#panel ⇒ Object
Returns the value of attribute panel.
-
#recipients ⇒ Object
Returns the value of attribute recipients.
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(options = {}) ⇒ PanelImport
constructor
A new instance of PanelImport.
- #save ⇒ Object
Methods inherited from Entity
#configuration, configuration, #get, get, #library_id, #library_id=, #persisted?, post, #post, #success?, underscore_attributes
Constructor Details
#initialize(options = {}) ⇒ PanelImport
Returns a new instance of PanelImport.
7 8 9 10 |
# File 'lib/qualtrics/panel_import.rb', line 7 def initialize(={}) @panel = [:panel] @recipients = [:recipients] end |
Instance Attribute Details
#panel ⇒ Object
Returns the value of attribute panel.
5 6 7 |
# File 'lib/qualtrics/panel_import.rb', line 5 def panel @panel end |
#recipients ⇒ Object
Returns the value of attribute recipients.
5 6 7 |
# File 'lib/qualtrics/panel_import.rb', line 5 def recipients @recipients end |
Instance Method Details
#headers ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/qualtrics/panel_import.rb', line 21 def headers {}.tap do |import_headers| Qualtrics::RecipientImportRow.fields.each_with_index.map do |field, index| import_headers[field] = index + 1 end end end |
#save ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/qualtrics/panel_import.rb', line 12 def save payload = headers payload['LibraryID'] = library_id payload['ColumnHeaders'] = 1 file = Qualtrics::PanelImportFile.new(@recipients) post 'importPanel', payload, File.read(file.temp_file) true end |