Class: Mailchimp::Templates

Inherits:
Object
  • Object
show all
Defined in:
lib/mailchimp/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Templates



59
60
61
# File 'lib/mailchimp/api.rb', line 59

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



57
58
59
# File 'lib/mailchimp/api.rb', line 57

def master
  @master
end

Instance Method Details

#add(name, html, folder_id = nil) ⇒ Hash

Create a new user template, <strong>NOT</strong> campaign content. These templates can then be applied while creating campaigns.



69
70
71
72
# File 'lib/mailchimp/api.rb', line 69

def add(name, html, folder_id=nil)
    _params = {:name => name, :html => html, :folder_id => folder_id}
    return @master.call 'templates/add', _params
end

#del(template_id) ⇒ Hash

Delete (deactivate) a user template



78
79
80
81
# File 'lib/mailchimp/api.rb', line 78

def del(template_id)
    _params = {:template_id => template_id}
    return @master.call 'templates/del', _params
end

#info(template_id, type = 'user') ⇒ Hash

Pull details for a specific template to help support editing



91
92
93
94
# File 'lib/mailchimp/api.rb', line 91

def info(template_id, type='user')
    _params = {:template_id => template_id, :type => type}
    return @master.call 'templates/info', _params
end

#list(types = [], filters = []) ⇒ Hash

Retrieve various templates available in the system, allowing some thing similar to our template gallery to be created.



135
136
137
138
# File 'lib/mailchimp/api.rb', line 135

def list(types=[], filters=[])
    _params = {:types => types, :filters => filters}
    return @master.call 'templates/list', _params
end

#undel(template_id) ⇒ Hash

Undelete (reactivate) a user template



144
145
146
147
# File 'lib/mailchimp/api.rb', line 144

def undel(template_id)
    _params = {:template_id => template_id}
    return @master.call 'templates/undel', _params
end

#update(template_id, values) ⇒ Hash

Replace the content of a user template, <strong>NOT</strong> campaign content.



157
158
159
160
# File 'lib/mailchimp/api.rb', line 157

def update(template_id, values)
    _params = {:template_id => template_id, :values => values}
    return @master.call 'templates/update', _params
end