Module: Millionsend::Templates
- Defined in:
- lib/millionsend/templates.rb
Overview
Email templates, addressable by id or alias. Templates are always published: publish is kept as a no-op for resend-ruby compatibility.
Class Method Summary collapse
-
.create(params) ⇒ Object
POST /templates — name, html, subject, text, alias.
-
.duplicate(id_or_alias) ⇒ Object
POST /templates/:id_or_alias/duplicate — returns the copy's id.
-
.get(id_or_alias) ⇒ Object
GET /templates/:id_or_alias.
-
.list(options = {}) ⇒ Object
GET /templates — accepts limit:/after:/before:.
-
.publish(id_or_alias) ⇒ Object
POST /templates/:id_or_alias/publish.
-
.remove(id_or_alias) ⇒ Object
DELETE /templates/:id_or_alias.
-
.update(id_or_alias, params) ⇒ Object
PATCH /templates/:id_or_alias — name, html, subject, text, alias; nil clears subject/text/alias.
Class Method Details
.create(params) ⇒ Object
POST /templates — name, html, subject, text, alias.
9 10 11 |
# File 'lib/millionsend/templates.rb', line 9 def create(params) Millionsend::Request.new(method: :post, path: "/templates", body: params).perform end |
.duplicate(id_or_alias) ⇒ Object
POST /templates/:id_or_alias/duplicate — returns the copy's id.
35 36 37 |
# File 'lib/millionsend/templates.rb', line 35 def duplicate(id_or_alias) Millionsend::Request.new(method: :post, path: "#{member_path(id_or_alias)}/duplicate").perform end |
.get(id_or_alias) ⇒ Object
GET /templates/:id_or_alias
14 15 16 |
# File 'lib/millionsend/templates.rb', line 14 def get(id_or_alias) Millionsend::Request.new(method: :get, path: member_path(id_or_alias)).perform end |
.list(options = {}) ⇒ Object
GET /templates — accepts limit:/after:/before:.
19 20 21 |
# File 'lib/millionsend/templates.rb', line 19 def list( = {}) Millionsend::Request.new(method: :get, path: "/templates", query: Millionsend::Util.list_query()).perform end |
.publish(id_or_alias) ⇒ Object
POST /templates/:id_or_alias/publish
30 31 32 |
# File 'lib/millionsend/templates.rb', line 30 def publish(id_or_alias) Millionsend::Request.new(method: :post, path: "#{member_path(id_or_alias)}/publish").perform end |
.remove(id_or_alias) ⇒ Object
DELETE /templates/:id_or_alias
40 41 42 |
# File 'lib/millionsend/templates.rb', line 40 def remove(id_or_alias) Millionsend::Request.new(method: :delete, path: member_path(id_or_alias)).perform end |
.update(id_or_alias, params) ⇒ Object
PATCH /templates/:id_or_alias — name, html, subject, text, alias; nil clears subject/text/alias.
25 26 27 |
# File 'lib/millionsend/templates.rb', line 25 def update(id_or_alias, params) Millionsend::Request.new(method: :patch, path: member_path(id_or_alias), body: params).perform end |