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