Module: Resend::Templates

Defined in:
lib/resend/templates.rb

Overview

Templates api wrapper

Class Method Summary collapse

Class Method Details

.create(params = {}) ⇒ Object



8
9
10
11
# File 'lib/resend/templates.rb', line 8

def create(params = {})
  path = "templates"
  Resend::Request.new(path, params, "post").perform
end

.duplicate(template_id = "") ⇒ Object



32
33
34
35
# File 'lib/resend/templates.rb', line 32

def duplicate(template_id = "")
  path = "templates/#{template_id}/duplicate"
  Resend::Request.new(path, {}, "post").perform
end

.get(template_id = "") ⇒ Object



14
15
16
17
# File 'lib/resend/templates.rb', line 14

def get(template_id = "")
  path = "templates/#{template_id}"
  Resend::Request.new(path, {}, "get").perform
end

.list(params = {}) ⇒ Object



38
39
40
41
# File 'lib/resend/templates.rb', line 38

def list(params = {})
  path = Resend::PaginationHelper.build_paginated_path("templates", params)
  Resend::Request.new(path, {}, "get").perform
end

.publish(template_id = "") ⇒ Object



26
27
28
29
# File 'lib/resend/templates.rb', line 26

def publish(template_id = "")
  path = "templates/#{template_id}/publish"
  Resend::Request.new(path, {}, "post").perform
end

.remove(template_id = "") ⇒ Object



44
45
46
47
# File 'lib/resend/templates.rb', line 44

def remove(template_id = "")
  path = "templates/#{template_id}"
  Resend::Request.new(path, {}, "delete").perform
end

.update(template_id, params = {}) ⇒ Object



20
21
22
23
# File 'lib/resend/templates.rb', line 20

def update(template_id, params = {})
  path = "templates/#{template_id}"
  Resend::Request.new(path, params, "patch").perform
end