class Smtpcom::Sendapi::Template
Constants
- MAPPINGS
Public Class Methods
all()
click to toggle source
# File lib/smtpcom/sendapi/template.rb, line 16 def all _get('/templates/get')['Data'].map do |row| build_from_response row end end
find(id)
click to toggle source
# File lib/smtpcom/sendapi/template.rb, line 22 def find(id) build_from_response _get('/template/get', TemplateID: id)['Data'] end
Public Instance Methods
delete()
click to toggle source
# File lib/smtpcom/sendapi/template.rb, line 44 def delete _post('/templates/delete', { TemplateID: @id }, :formatted) end
save()
click to toggle source
# File lib/smtpcom/sendapi/template.rb, line 27 def save attrs = { TemplateName: @name, From: @from, FromName: @from_name, Subject: @subject, Html: @html } res = if @id _post '/templates/update', attrs.merge(TemplateID: @id), :formatted else _post '/templates/add', attrs, :formatted end @id = res[:id] res end