class UniOne::Template

Attributes

attachments[RW]
body[RW]
editor_type[RW]
from[RW]
global_substitutions[RW]
headers[RW]
inline_attachments[RW]
name[RW]
options[RW]
subject[RW]
template_engine[RW]

Public Class Methods

new() click to toggle source
# File lib/unione/helpers/template/template.rb, line 6
def initialize
  @global_substitutions = {}
  @from = {}
  @attachments = []
  @inline_attachments = []
end

Public Instance Methods

to_json(*) click to toggle source
# File lib/unione/helpers/template/template.rb, line 13
def to_json(*)
  {
    template: {
      id: '',
      name: self.name,
      editor_type: self.editor_type,
      subject: self.subject,
      template_engine: self.template_engine,
      global_substitutions: self.global_substitutions,
      headers: self.headers,
      body: self.body,
      attachments: self.attachments,
      inline_attachments: self.inline_attachments,
      options: self.options
    }.merge(self.from)
      .delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {}}
  }
end