Class: Notisend::Resources::Templates
- Defined in:
- lib/notisend/resources/templates.rb
Overview
Email templates and template-based sending: /email/templates
Instance Method Summary collapse
- #create(from_email:, subject:, html:, text: nil, from_name: nil, name: nil, preset_params: nil) ⇒ Object
- #deliver(template_id:, to:, params: nil, payment: nil, attachments: nil) ⇒ Object
- #get(id:) ⇒ Object
- #list(page_number: nil, page_size: nil) ⇒ Object
- #to_pending(id:) ⇒ 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, name: nil, preset_params: nil) ⇒ Object
7 8 9 10 |
# File 'lib/notisend/resources/templates.rb', line 7 def create(from_email:, subject:, html:, text: nil, from_name: nil, name: nil, preset_params: nil) payload = { from_email:, subject:, html:, text:, from_name:, name:, preset_params: }.compact client.post(email_path('templates'), payload) end |
#deliver(template_id:, to:, params: nil, payment: nil, attachments: nil) ⇒ Object
24 25 26 27 |
# File 'lib/notisend/resources/templates.rb', line 24 def deliver(template_id:, to:, params: nil, payment: nil, attachments: nil) payload = { to:, params:, payment: }.compact client.post(email_path('templates', template_id, 'messages'), payload, attachments: ) end |
#get(id:) ⇒ Object
16 17 18 |
# File 'lib/notisend/resources/templates.rb', line 16 def get(id:) client.get(email_path('templates', id)) end |
#list(page_number: nil, page_size: nil) ⇒ Object
12 13 14 |
# File 'lib/notisend/resources/templates.rb', line 12 def list(page_number: nil, page_size: nil) paginated(email_path('templates'), page_params(page_number:, page_size:)) end |
#to_pending(id:) ⇒ Object
20 21 22 |
# File 'lib/notisend/resources/templates.rb', line 20 def to_pending(id:) client.patch(email_path('templates', id, 'to_pending')) end |