Class: Sendgrid::API::Newsletter::MarketingEmails::Services
- Includes:
- Utils
- Defined in:
- lib/sendgrid/api/newsletter/marketing_emails.rb
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#add(marketing_email) ⇒ Entities::Response
Create a new Marketing Email.
-
#delete(marketing_email) ⇒ Entities::Response
Remove an existing Marketing Email.
-
#edit(marketing_email, newname = nil) ⇒ Entities::Response
Edit an existing Marketing Email.
-
#get(marketing_email) ⇒ Entities::MarketingEmail
Retrieve the contents of an existing Marketing Email.
-
#list ⇒ Array<Entities::MarketingEmail>
Retrieve a list of all existing Marketing Email.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Sendgrid::API::Service
Instance Method Details
#add(marketing_email) ⇒ Entities::Response
Create a new Marketing Email.
23 24 25 |
# File 'lib/sendgrid/api/newsletter/marketing_emails.rb', line 23 def add(marketing_email) perform_request(Entities::Response, 'newsletter/add.json', marketing_email.as_json) end |
#delete(marketing_email) ⇒ Entities::Response
Remove an existing Marketing Email.
62 63 64 65 |
# File 'lib/sendgrid/api/newsletter/marketing_emails.rb', line 62 def delete(marketing_email) params = { :name => extract_marketing_email(marketing_email) } perform_request(Entities::Response, 'newsletter/delete.json', params) end |
#edit(marketing_email, newname = nil) ⇒ Entities::Response
Edit an existing Marketing Email.
33 34 35 36 37 |
# File 'lib/sendgrid/api/newsletter/marketing_emails.rb', line 33 def edit(marketing_email, newname = nil) params = marketing_email.as_json params.merge!(:newname => newname) if newname perform_request(Entities::Response, 'newsletter/edit.json', params) end |
#get(marketing_email) ⇒ Entities::MarketingEmail
Retrieve the contents of an existing Marketing Email.
44 45 46 47 |
# File 'lib/sendgrid/api/newsletter/marketing_emails.rb', line 44 def get(marketing_email) params = { :name => extract_marketing_email(marketing_email) } perform_request(Entities::MarketingEmail, 'newsletter/get.json', params) end |
#list ⇒ Array<Entities::MarketingEmail>
Retrieve a list of all existing Marketing Email.
53 54 55 |
# File 'lib/sendgrid/api/newsletter/marketing_emails.rb', line 53 def list perform_request(Entities::MarketingEmail, 'newsletter/list.json') end |