class Mailersend::Templates

Templates endpoint from MailerSend API.

Attributes

client[RW]
limit[RW]
page[RW]
template_id[RW]

Public Class Methods

new(client = Mailersend::Client.new) click to toggle source
# File lib/mailersend/templates/templates.rb, line 11
def initialize(client = Mailersend::Client.new)
  @client = client
  @page = page
  @limit = limit
  @template_id = template_id
end

Public Instance Methods

delete(template_id:) click to toggle source
# File lib/mailersend/templates/templates.rb, line 35
def delete(template_id:)
  response = client.http.delete("#{API_URL}/templates/#{template_id}")
  puts response
end
list(domain_id: nil, page: nil, limit: nil) click to toggle source
# File lib/mailersend/templates/templates.rb, line 18
def list(domain_id: nil, page: nil, limit: nil)
  hash = {
    'domain_id' => domain_id,
    'page' => page,
    'limit' => limit
  }

  response = client.http.get(URI::HTTPS.build(host: API_BASE_HOST, path: '/v1/templates',
                                              query: URI.encode_www_form(hash)))
  puts response
end
single(template_id:) click to toggle source
# File lib/mailersend/templates/templates.rb, line 30
def single(template_id:)
  response = client.http.get("#{API_URL}/templates/#{template_id}")
  puts response
end