Class: Notisend::Resources::Campaigns
- Defined in:
- lib/notisend/resources/campaigns.rb
Overview
Bulk campaigns: /email/campaigns
Instance Method Summary collapse
- #create(from_email:, subject:, html:, text: nil, from_name: nil, lists: nil, segment_id: nil, attachments: nil) ⇒ Object
- #deliver(id:) ⇒ Object
- #get(id:) ⇒ Object
- #list(statistic: nil, page_number: nil, page_size: nil) ⇒ Object
- #schedule(id:, start_at: nil, time_zone: nil) ⇒ Object
Methods inherited from Base
Constructor Details
This class inherits a constructor from Notisend::Resources::Base
Instance Method Details
#create(from_email:, subject:, html:, text: nil, from_name: nil, lists: nil, segment_id: nil, attachments: nil) ⇒ Object
7 8 9 10 11 |
# File 'lib/notisend/resources/campaigns.rb', line 7 def create(from_email:, subject:, html:, text: nil, from_name: nil, lists: nil, segment_id: nil, attachments: nil) payload = { from_email:, subject:, html:, text:, from_name:, lists:, segment_id: }.compact client.post(email_path('campaigns'), payload, attachments: ) end |
#deliver(id:) ⇒ Object
13 14 15 |
# File 'lib/notisend/resources/campaigns.rb', line 13 def deliver(id:) client.patch(email_path('campaigns', id, 'deliver')) end |
#get(id:) ⇒ Object
26 27 28 |
# File 'lib/notisend/resources/campaigns.rb', line 26 def get(id:) client.get(email_path('campaigns', id)) end |
#list(statistic: nil, page_number: nil, page_size: nil) ⇒ Object
21 22 23 24 |
# File 'lib/notisend/resources/campaigns.rb', line 21 def list(statistic: nil, page_number: nil, page_size: nil) params = { statistic: }.compact.merge(page_params(page_number:, page_size:)) paginated(email_path('campaigns'), params) end |
#schedule(id:, start_at: nil, time_zone: nil) ⇒ Object
17 18 19 |
# File 'lib/notisend/resources/campaigns.rb', line 17 def schedule(id:, start_at: nil, time_zone: nil) client.patch(email_path('campaigns', id, 'schedule'), { start_at:, time_zone: }.compact) end |