Class: Txbr::EmailTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/txbr/email_template.rb

Constant Summary collapse

ITEM_TYPE =
'email_template'.freeze
TEMPLATE_KEYS =
%w(body subject preheader).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, tmpl_data) ⇒ EmailTemplate

Returns a new instance of EmailTemplate.



11
12
13
14
15
# File 'lib/txbr/email_template.rb', line 11

def initialize(project, tmpl_data)
  @project = project
  @tmpl_data = tmpl_data
  @email_template_id = tmpl_data['email_template_id']
end

Instance Attribute Details

#email_template_idObject (readonly)

Returns the value of attribute email_template_id.



9
10
11
# File 'lib/txbr/email_template.rb', line 9

def email_template_id
  @email_template_id
end

#projectObject (readonly)

Returns the value of attribute project.



9
10
11
# File 'lib/txbr/email_template.rb', line 9

def project
  @project
end

Instance Method Details

#each_resource(&block) ⇒ Object



17
18
19
20
# File 'lib/txbr/email_template.rb', line 17

def each_resource(&block)
  return to_enum(__method__) unless block_given?
  template_group.each_resource(&block)
end

#metadataObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/txbr/email_template.rb', line 22

def 
   ||= {
    item_type: ITEM_TYPE,
    template_name: template_name,
    template_id: email_template_id,
    last_edited: last_edited
  }
rescue => e
  {}
end