Class: Mailchimp::Templates
- Inherits:
-
Object
- Object
- Mailchimp::Templates
- Defined in:
- lib/mailchimp/api.rb
Instance Attribute Summary collapse
-
#master ⇒ Object
Returns the value of attribute master.
Instance Method Summary collapse
-
#add(name, html, folder_id = nil) ⇒ Hash
Create a new user template, <strong>NOT</strong> campaign content.
-
#del(template_id) ⇒ Hash
Delete (deactivate) a user template.
-
#info(template_id, type = 'user') ⇒ Hash
Pull details for a specific template to help support editing.
-
#initialize(master) ⇒ Templates
constructor
A new instance of Templates.
-
#list(types = [], filters = []) ⇒ Hash
Retrieve various templates available in the system, allowing some thing similar to our template gallery to be created.
-
#undel(template_id) ⇒ Hash
Undelete (reactivate) a user template.
-
#update(template_id, values) ⇒ Hash
Replace the content of a user template, <strong>NOT</strong> campaign content.
Constructor Details
#initialize(master) ⇒ Templates
Returns a new instance of Templates.
59 60 61 |
# File 'lib/mailchimp/api.rb', line 59 def initialize(master) @master = master end |
Instance Attribute Details
#master ⇒ Object
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 |