Class: Emarsys::Email
- Inherits:
-
DataObject
- Object
- DataObject
- Emarsys::Email
- Defined in:
- lib/emarsys/data_objects/email.rb
Overview
Methods for the Email API
Class Method Summary collapse
-
.collection(account: nil, **params) ⇒ Hash
List email campaigns.
-
.create(account: nil, **params) ⇒ Hash
Create a new email campaign.
-
.delivery_status(id, account: nil, **params) ⇒ Hash
Returns the delivery status of an email.
-
.email_launches(id, account: nil) ⇒ Object
TODO POST /getlaunchesofemail.
-
.export_responses(distribution_method:, time_range:, contact_fields:, sources:, analysis_fields:, account: nil, **params) ⇒ Hash
Exports the selected fields of all contacts who responded to emails within the specified time range.
-
.launch(id, account: nil, **params) ⇒ Hash
Launches an email.
-
.preview(id, version: 'html', account: nil) ⇒ Hash
Preview an email.
-
.resource(id, account: nil) ⇒ Hash
Get Email attirbutes of a specific email.
-
.response_summary(id, account: nil) ⇒ Hash
View response summary of an email.
-
.send_test_mail(id, account: nil, **params) ⇒ Hash
Instruct emarsys to send a test mail.
Methods inherited from DataObject
delete, get, parameterize_params, post, put, #request
Class Method Details
.collection(account: nil, **params) ⇒ Hash
List email campaigns
20 21 22 |
# File 'lib/emarsys/data_objects/email.rb', line 20 def collection(account: nil, **params) get account, 'email', params end |
.create(account: nil, **params) ⇒ Hash
Create a new email campaign
56 57 58 |
# File 'lib/emarsys/data_objects/email.rb', line 56 def create(account: nil, **params) post account, "email", params end |
.delivery_status(id, account: nil, **params) ⇒ Hash
Returns the delivery status of an email
119 120 121 |
# File 'lib/emarsys/data_objects/email.rb', line 119 def delivery_status(id, account: nil, **params) post account, "email/#{id}/getdeliverystatus", params end |
.email_launches(id, account: nil) ⇒ Object
TODO POST /getlaunchesofemail
124 125 126 |
# File 'lib/emarsys/data_objects/email.rb', line 124 def email_launches(id, account: nil) raise "Not implemented yet" end |
.export_responses(distribution_method:, time_range:, contact_fields:, sources:, analysis_fields:, account: nil, **params) ⇒ Hash
Exports the selected fields of all contacts who responded to emails within the specified time range.
146 147 148 149 150 151 152 153 154 155 |
# File 'lib/emarsys/data_objects/email.rb', line 146 def export_responses(distribution_method:, time_range:, contact_fields:, sources:, analysis_fields:, account: nil, **params) params.merge!( :distribution_method => distribution_method, :time_range => time_range, :contact_fields => Emarsys::ParamsConverter.new(contact_fields).convert_to_ids, :sources => sources, :analysis_fields => analysis_fields ) post account, "email/getresponses", params end |
.launch(id, account: nil, **params) ⇒ Hash
Launches an email
69 70 71 |
# File 'lib/emarsys/data_objects/email.rb', line 69 def launch(id, account: nil, **params) post account, "email/#{id}/launch", params end |
.preview(id, version: 'html', account: nil) ⇒ Hash
Preview an email
80 81 82 |
# File 'lib/emarsys/data_objects/email.rb', line 80 def preview(id, version: 'html', account: nil) post account, "email/#{id}/preview", {:version => version} end |
.resource(id, account: nil) ⇒ Hash
Get Email attirbutes of a specific email
30 31 32 |
# File 'lib/emarsys/data_objects/email.rb', line 30 def resource(id, account: nil) get account, "email/#{id}", {} end |
.response_summary(id, account: nil) ⇒ Hash
View response summary of an email
90 91 92 |
# File 'lib/emarsys/data_objects/email.rb', line 90 def response_summary(id, account: nil) get account, "email/#{id}/responsesummary", {} end |
.send_test_mail(id, account: nil, **params) ⇒ Hash
Instruct emarsys to send a test mail
Only one of the three parameters must be sent.
106 107 108 |
# File 'lib/emarsys/data_objects/email.rb', line 106 def send_test_mail(id, account: nil, **params) post account, "email/#{id}/sendtestmail", params end |