Class: CreateSend::Template
- Inherits:
-
Object
- Object
- CreateSend::Template
- Defined in:
- lib/createsend/template.rb
Overview
Represents an email template and associated functionality.
Instance Attribute Summary collapse
-
#template_id ⇒ Object
readonly
Returns the value of attribute template_id.
Class Method Summary collapse
-
.create(client_id, name, html_url, zip_url) ⇒ Object
Creates a new email template.
Instance Method Summary collapse
-
#delete ⇒ Object
Deletes this email template.
-
#details ⇒ Object
Gets the details of this email template.
-
#initialize(template_id) ⇒ Template
constructor
A new instance of Template.
-
#update(name, html_url, zip_url) ⇒ Object
Updates this email template.
Constructor Details
#initialize(template_id) ⇒ Template
Returns a new instance of Template.
9 10 11 |
# File 'lib/createsend/template.rb', line 9 def initialize(template_id) @template_id = template_id end |
Instance Attribute Details
#template_id ⇒ Object (readonly)
Returns the value of attribute template_id.
7 8 9 |
# File 'lib/createsend/template.rb', line 7 def template_id @template_id end |
Class Method Details
.create(client_id, name, html_url, zip_url) ⇒ Object
Creates a new email template.
14 15 16 17 18 19 20 21 |
# File 'lib/createsend/template.rb', line 14 def self.create(client_id, name, html_url, zip_url) = { :body => { :Name => name, :HtmlPageURL => html_url, :ZipFileURL => zip_url }.to_json } response = CreateSend.post "/templates/#{client_id}.json", response.parsed_response end |
Instance Method Details
#delete ⇒ Object
Deletes this email template.
39 40 41 |
# File 'lib/createsend/template.rb', line 39 def delete response = CreateSend.delete "/templates/#{template_id}.json", {} end |
#details ⇒ Object
Gets the details of this email template.
24 25 26 27 |
# File 'lib/createsend/template.rb', line 24 def details response = CreateSend.get "/templates/#{template_id}.json", {} Hashie::Mash.new(response) end |
#update(name, html_url, zip_url) ⇒ Object
Updates this email template.
30 31 32 33 34 35 36 |
# File 'lib/createsend/template.rb', line 30 def update(name, html_url, zip_url) = { :body => { :Name => name, :HtmlPageURL => html_url, :ZipFileURL => zip_url }.to_json } response = CreateSend.put "/templates/#{template_id}.json", end |