class CreateSend::Template

Represents an email template and associated functionality.

Attributes

template_id[R]

Public Class Methods

create(auth, client_id, name, html_url, zip_url) click to toggle source

Creates a new email template.

# File lib/createsend/template.rb, line 12
def self.create(auth, client_id, name, html_url, zip_url)
  options = { :body => {
    :Name => name,
    :HtmlPageURL => html_url,
    :ZipFileURL => zip_url }.to_json }
  cs = CreateSend.new auth
  response = cs.post "/templates/#{client_id}.json", options
  response.parsed_response
end
new(auth, template_id) click to toggle source
Calls superclass method
# File lib/createsend/template.rb, line 6
def initialize(auth, template_id)
  @template_id = template_id
  super
end

Public Instance Methods

delete() click to toggle source

Deletes this email template.

Calls superclass method
# File lib/createsend/template.rb, line 38
def delete
  super "/templates/#{template_id}.json", {}
end
details() click to toggle source

Gets the details of this email template.

# 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) click to toggle source

Updates this email template.

# File lib/createsend/template.rb, line 29
def update(name, html_url, zip_url)
  options = { :body => {
    :Name => name,
    :HtmlPageURL => html_url,
    :ZipFileURL => zip_url }.to_json }
  put "/templates/#{template_id}.json", options
end