Class: Qualtrics::SurveyImport
- Defined in:
- lib/qualtrics/survey_import.rb
Instance Attribute Summary collapse
-
#survey ⇒ Object
Returns the value of attribute survey.
-
#survey_data_location ⇒ Object
Returns the value of attribute survey_data_location.
-
#survey_name ⇒ Object
Returns the value of attribute survey_name.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ SurveyImport
constructor
A new instance of SurveyImport.
- #save ⇒ Object
Methods inherited from Entity
#configuration, configuration, #get, get, #library_id, #library_id=, #persisted?, post, #post, #success?, underscore_attributes
Constructor Details
#initialize(options = {}) ⇒ SurveyImport
Returns a new instance of SurveyImport.
5 6 7 8 9 |
# File 'lib/qualtrics/survey_import.rb', line 5 def initialize(={}) @survey_name = [:survey_name] @survey_data_location = [:survey_data_location] @survey = Qualtrics::Survey.new(survey_name: survey_name) end |
Instance Attribute Details
#survey ⇒ Object
Returns the value of attribute survey.
3 4 5 |
# File 'lib/qualtrics/survey_import.rb', line 3 def survey @survey end |
#survey_data_location ⇒ Object
Returns the value of attribute survey_data_location.
3 4 5 |
# File 'lib/qualtrics/survey_import.rb', line 3 def survey_data_location @survey_data_location end |
#survey_name ⇒ Object
Returns the value of attribute survey_name.
3 4 5 |
# File 'lib/qualtrics/survey_import.rb', line 3 def survey_name @survey_name end |
Instance Method Details
#save ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/qualtrics/survey_import.rb', line 11 def save payload = {} payload['Name'] = survey.survey_name payload['Data'] = Faraday::UploadIO.new(survey_data_location, 'text/xml') response = post 'importSurvey', payload if response.success? survey.id = response.result['SurveyID'] true else false end end |