Class: Mandrill::Templates
- Inherits:
-
Object
- Object
- Mandrill::Templates
- Defined in:
- lib/mandrill/api.rb
Instance Attribute Summary collapse
-
#master ⇒ Object
Returns the value of attribute master.
Instance Method Summary collapse
-
#add(name, code, publish = true) ⇒ Hash
Add a new template.
-
#delete(name) ⇒ Hash
Delete a template.
-
#info(name) ⇒ Hash
Get the information for an existing template.
-
#initialize(master) ⇒ Templates
constructor
A new instance of Templates.
-
#list ⇒ Array
Return a list of all the templates available to this user.
-
#publish(name) ⇒ Hash
Publish the content for the template.
-
#render(template_name, template_content, merge_vars = nil) ⇒ Hash
Inject content and optionally merge fields into a template, returning the HTML that results.
-
#time_series(name) ⇒ Array
Return the recent history (hourly stats for the last 30 days) for a template.
-
#update(name, code, publish = true) ⇒ Hash
Update the code for an existing template.
Constructor Details
#initialize(master) ⇒ Templates
Returns a new instance of Templates.
7 8 9 |
# File 'lib/mandrill/api.rb', line 7 def initialize(master) @master = master end |
Instance Attribute Details
#master ⇒ Object
Returns the value of attribute master.
5 6 7 |
# File 'lib/mandrill/api.rb', line 5 def master @master end |
Instance Method Details
#add(name, code, publish = true) ⇒ Hash
Add a new template
24 25 26 27 |
# File 'lib/mandrill/api.rb', line 24 def add(name, code, publish=true) _params = {:name => name, :code => code, :publish => publish} return @master.call 'templates/add', _params end |
#delete(name) ⇒ Hash
Delete a template
90 91 92 93 |
# File 'lib/mandrill/api.rb', line 90 def delete(name) _params = {:name => name} return @master.call 'templates/delete', _params end |
#info(name) ⇒ Hash
Get the information for an existing template
40 41 42 43 |
# File 'lib/mandrill/api.rb', line 40 def info(name) _params = {:name => name} return @master.call 'templates/info', _params end |
#list ⇒ Array
Return a list of all the templates available to this user
106 107 108 109 |
# File 'lib/mandrill/api.rb', line 106 def list() _params = {} return @master.call 'templates/list', _params end |
#publish(name) ⇒ Hash
Publish the content for the template. Any new messages sent using this template will start using the content that was previously in draft.
74 75 76 77 |
# File 'lib/mandrill/api.rb', line 74 def publish(name) _params = {:name => name} return @master.call 'templates/publish', _params end |
#render(template_name, template_content, merge_vars = nil) ⇒ Hash
Inject content and optionally merge fields into a template, returning the HTML that results
142 143 144 145 |
# File 'lib/mandrill/api.rb', line 142 def render(template_name, template_content, merge_vars=nil) _params = {:template_name => template_name, :template_content => template_content, :merge_vars => merge_vars} return @master.call 'templates/render', _params end |
#time_series(name) ⇒ Array
Return the recent history (hourly stats for the last 30 days) for a template
125 126 127 128 |
# File 'lib/mandrill/api.rb', line 125 def time_series(name) _params = {:name => name} return @master.call 'templates/time-series', _params end |
#update(name, code, publish = true) ⇒ Hash
Update the code for an existing template
58 59 60 61 |
# File 'lib/mandrill/api.rb', line 58 def update(name, code, publish=true) _params = {:name => name, :code => code, :publish => publish} return @master.call 'templates/update', _params end |