Class: Sendgrid::API::Newsletter::Emails::Services
- Includes:
- Utils
- Defined in:
- lib/sendgrid/api/newsletter/emails.rb
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#add(list, emails) ⇒ Entities::ResponseInsert
Add one or more emails to a Recipient List.
-
#delete(list, emails) ⇒ Entities::ResponseRemove
Remove one or more emails from a Recipient List.
-
#get(list, emails = nil) ⇒ Array<Entities::Email>
Get the email addresses and associated fields for a Recipient List.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Sendgrid::API::Service
Instance Method Details
#add(list, emails) ⇒ Entities::ResponseInsert
Add one or more emails to a Recipient List.
25 26 27 28 |
# File 'lib/sendgrid/api/newsletter/emails.rb', line 25 def add(list, emails) params = { :list => extract_listname(list), :data => map_emails(emails, :to_json) } perform_request(Entities::ResponseInsert, 'newsletter/lists/email/add.json', params) end |
#delete(list, emails) ⇒ Entities::ResponseRemove
Remove one or more emails from a Recipient List.
48 49 50 51 |
# File 'lib/sendgrid/api/newsletter/emails.rb', line 48 def delete(list, emails) params = { :list => extract_listname(list), :email => map_emails(emails, :email) } perform_request(Entities::ResponseRemove, 'newsletter/lists/email/delete.json', params) end |
#get(list, emails = nil) ⇒ Array<Entities::Email>
Get the email addresses and associated fields for a Recipient List.
36 37 38 39 40 |
# File 'lib/sendgrid/api/newsletter/emails.rb', line 36 def get(list, emails = nil) params = { :list => extract_listname(list) } params[:email] = map_emails(emails, :email) if emails perform_request(Entities::Email, 'newsletter/lists/email/get.json', params) end |