Class: Qualtrics::Distribution
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/qualtrics/distribution.rb
Instance Attribute Summary collapse
-
#emails_bounced ⇒ Object
Returns the value of attribute emails_bounced.
-
#emails_failed ⇒ Object
Returns the value of attribute emails_failed.
-
#emails_opened ⇒ Object
Returns the value of attribute emails_opened.
-
#emails_responded ⇒ Object
Returns the value of attribute emails_responded.
-
#emails_sent ⇒ Object
Returns the value of attribute emails_sent.
-
#emails_skipped ⇒ Object
Returns the value of attribute emails_skipped.
-
#id ⇒ Object
Returns the value of attribute id.
-
#message_id ⇒ Object
Returns the value of attribute message_id.
-
#survey_id ⇒ Object
Returns the value of attribute survey_id.
Class Method Summary collapse
- .attributes ⇒ Object
- .get_distribution_with_panel(panel, survey, library_id = configuration.default_library_id) ⇒ Object
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Distribution
constructor
A new instance of Distribution.
- #refresh ⇒ Object
- #set_email_response_data(options = {}) ⇒ Object
Methods inherited from Entity
#configuration, configuration, #get, get, #library_id, #library_id=, #persisted?, post, #post, #success?, underscore_attributes
Constructor Details
#initialize(options = {}) ⇒ Distribution
Returns a new instance of Distribution.
14 15 16 17 18 19 |
# File 'lib/qualtrics/distribution.rb', line 14 def initialize(={}) @id = [:id] = [:message_id] @survey_id = [:survey_id] set_email_response_data() end |
Instance Attribute Details
#emails_bounced ⇒ Object
Returns the value of attribute emails_bounced.
10 11 12 |
# File 'lib/qualtrics/distribution.rb', line 10 def emails_bounced @emails_bounced end |
#emails_failed ⇒ Object
Returns the value of attribute emails_failed.
10 11 12 |
# File 'lib/qualtrics/distribution.rb', line 10 def emails_failed @emails_failed end |
#emails_opened ⇒ Object
Returns the value of attribute emails_opened.
10 11 12 |
# File 'lib/qualtrics/distribution.rb', line 10 def emails_opened @emails_opened end |
#emails_responded ⇒ Object
Returns the value of attribute emails_responded.
10 11 12 |
# File 'lib/qualtrics/distribution.rb', line 10 def emails_responded @emails_responded end |
#emails_sent ⇒ Object
Returns the value of attribute emails_sent.
10 11 12 |
# File 'lib/qualtrics/distribution.rb', line 10 def emails_sent @emails_sent end |
#emails_skipped ⇒ Object
Returns the value of attribute emails_skipped.
10 11 12 |
# File 'lib/qualtrics/distribution.rb', line 10 def emails_skipped @emails_skipped end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/qualtrics/distribution.rb', line 10 def id @id end |
#message_id ⇒ Object
Returns the value of attribute message_id.
10 11 12 |
# File 'lib/qualtrics/distribution.rb', line 10 def end |
#survey_id ⇒ Object
Returns the value of attribute survey_id.
10 11 12 |
# File 'lib/qualtrics/distribution.rb', line 10 def survey_id @survey_id end |
Class Method Details
.attributes ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/qualtrics/distribution.rb', line 30 def self.attributes { 'EmailDistributionID' => :id, 'MessageID' => :message_id, 'SurveyID' => :survey_id, 'EmailsSent' => :emails_sent, 'EmailsFailed' => :emails_failed, 'EmailsResponded' => :emails_responded, 'EmailsBounced' => :emails_bounced, 'EmailsOpened' => :emails_opened, 'EmailsSkipped' => :emails_skipped } end |
.get_distribution_with_panel(panel, survey, library_id = configuration.default_library_id) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/qualtrics/distribution.rb', line 62 def self.get_distribution_with_panel(panel, survey, library_id = configuration.default_library_id) response = get('getDistributions', { 'SurveyID' => survey.id, 'PanelID' => panel.id, 'LibraryID' => library_id } ) if response.success? response.result['Distributions'].map do |distribution| Qualtrics::Distribution.new(response_hash(distribution)) end else false end end |
Instance Method Details
#refresh ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/qualtrics/distribution.rb', line 44 def refresh response = get('getDistributions', { 'SurveyID' => survey_id, 'DistributionID' => id, 'LibraryID' => library_id } ) if response.success? distribution_hash = response.result['Distributions'] set_email_response_data(self.class.response_hash(distribution_hash )) true else false end end |
#set_email_response_data(options = {}) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/qualtrics/distribution.rb', line 21 def set_email_response_data(={}) @emails_sent = [:emails_sent] @emails_failed = [:emails_failed] @emails_responded = [:emails_responded] @emails_bounced = [:emails_bounced] @emails_opened = [:emails_opened] @emails_skipped = [:emails_skipped] end |