Sha256: a74d9119ec1f0aa76dd33fddd7675e49ab577fc812c51186512a33eac1aba736

Contents?: true

Size: 702 Bytes

Versions: 10

Compression:

Stored size: 702 Bytes

Contents

require "qualtrics/panel_import_file"

module Qualtrics
  class PanelImport < Entity
    attr_accessor :panel, :recipients

    def initialize(options={})
      @panel = options[:panel]
      @recipients = options[:recipients]
    end

    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

    def headers
      {}.tap do |import_headers|
        Qualtrics::RecipientImportRow.fields.each_with_index.map do |field, index|
          import_headers[field] = index + 1
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
qualtrics-0.6.0 lib/qualtrics/panel_import.rb
qualtrics-0.5.9b lib/qualtrics/panel_import.rb
qualtrics-0.5.9 lib/qualtrics/panel_import.rb
qualtrics-0.5.8 lib/qualtrics/panel_import.rb
qualtrics-0.5.7 lib/qualtrics/panel_import.rb
qualtrics-0.5.6 lib/qualtrics/panel_import.rb
qualtrics-0.5.5 lib/qualtrics/panel_import.rb
qualtrics-0.5.4 lib/qualtrics/panel_import.rb
qualtrics-0.5.3 lib/qualtrics/panel_import.rb
qualtrics-0.5.2 lib/qualtrics/panel_import.rb