Class: Mailersend::Templates
- Inherits:
-
Object
- Object
- Mailersend::Templates
- Defined in:
- lib/mailersend/templates/templates.rb
Overview
Templates endpoint from MailerSend API.
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#page ⇒ Object
Returns the value of attribute page.
-
#template_id ⇒ Object
Returns the value of attribute template_id.
Instance Method Summary collapse
- #delete(template_id:) ⇒ Object
-
#initialize(client = Mailersend::Client.new) ⇒ Templates
constructor
A new instance of Templates.
- #list(domain_id: nil, page: nil, limit: nil) ⇒ Object
- #single(template_id:) ⇒ Object
Constructor Details
#initialize(client = Mailersend::Client.new) ⇒ Templates
Returns a new instance of Templates.
11 12 13 14 15 16 |
# 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 |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/mailersend/templates/templates.rb', line 6 def client @client end |
#limit ⇒ Object
Returns the value of attribute limit.
6 7 8 |
# File 'lib/mailersend/templates/templates.rb', line 6 def limit @limit end |
#page ⇒ Object
Returns the value of attribute page.
6 7 8 |
# File 'lib/mailersend/templates/templates.rb', line 6 def page @page end |
#template_id ⇒ Object
Returns the value of attribute template_id.
6 7 8 |
# File 'lib/mailersend/templates/templates.rb', line 6 def template_id @template_id end |
Instance Method Details
#delete(template_id:) ⇒ Object
33 34 35 |
# File 'lib/mailersend/templates/templates.rb', line 33 def delete(template_id:) client.http.delete("#{MAILERSEND_API_URL}/templates/#{template_id}") end |
#list(domain_id: nil, page: nil, limit: nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# 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 } client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/templates', query: URI.encode_www_form(hash))) end |
#single(template_id:) ⇒ Object
29 30 31 |
# File 'lib/mailersend/templates/templates.rb', line 29 def single(template_id:) client.http.get("#{MAILERSEND_API_URL}/templates/#{template_id}") end |