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, screenshot_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, screenshot_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, screenshot_url) ⇒ Object
Creates a new email template.
14 15 16 17 18 19 20 21 22 |
# File 'lib/createsend/template.rb', line 14 def self.create(client_id, name, html_url, zip_url, screenshot_url) = { :body => { :Name => name, :HtmlPageURL => html_url, :ZipFileURL => zip_url, :ScreenshotURL => screenshot_url }.to_json } response = CreateSend.post "/templates/#{client_id}.json", response.parsed_response end |
Instance Method Details
#delete ⇒ Object
Deletes this email template.
41 42 43 |
# File 'lib/createsend/template.rb', line 41 def delete response = CreateSend.delete "/templates/#{template_id}.json", {} end |
#details ⇒ Object
Gets the details of this email template.
25 26 27 28 |
# File 'lib/createsend/template.rb', line 25 def details response = CreateSend.get "/templates/#{template_id}.json", {} Hashie::Mash.new(response) end |
#update(name, html_url, zip_url, screenshot_url) ⇒ Object
Updates this email template.
31 32 33 34 35 36 37 38 |
# File 'lib/createsend/template.rb', line 31 def update(name, html_url, zip_url, screenshot_url) = { :body => { :Name => name, :HtmlPageURL => html_url, :ZipFileURL => zip_url, :ScreenshotURL => screenshot_url }.to_json } response = CreateSend.put "/templates/#{template_id}.json", end |