Class: Mailtrap::Mail::FromTemplate

Inherits:
Base
  • Object
show all
Defined in:
lib/mailtrap/mail/from_template.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#attachments, #bcc, #category, #cc, #custom_variables, #from, #headers, #html, #subject, #text, #to

Instance Method Summary collapse

Methods inherited from Base

#add_attachment, #to_json

Constructor Details

#initialize(from: nil, to: [], cc: [], bcc: [], attachments: [], headers: {}, custom_variables: {}, template_uuid: nil, template_variables: {}) ⇒ FromTemplate

rubocop:disable Metrics/ParameterLists, Metrics/MethodLength



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/mailtrap/mail/from_template.rb', line 8

def initialize( # rubocop:disable Metrics/ParameterLists, Metrics/MethodLength
  from: nil,
  to: [],
  cc: [],
  bcc: [],
  attachments: [],
  headers: {},
  custom_variables: {},
  template_uuid: nil,
  template_variables: {}
)
  super(
    from: from,
    to: to,
    cc: cc,
    bcc: bcc,
    attachments: attachments,
    headers: headers,
    custom_variables: custom_variables
  )
  @template_uuid = template_uuid
  @template_variables = template_variables
end

Instance Attribute Details

#template_uuidObject

Returns the value of attribute template_uuid.



6
7
8
# File 'lib/mailtrap/mail/from_template.rb', line 6

def template_uuid
  @template_uuid
end

#template_variablesObject

Returns the value of attribute template_variables.



6
7
8
# File 'lib/mailtrap/mail/from_template.rb', line 6

def template_variables
  @template_variables
end

Instance Method Details

#as_jsonObject



32
33
34
35
36
37
38
39
# File 'lib/mailtrap/mail/from_template.rb', line 32

def as_json
  super.merge(
    {
      'template_uuid' => template_uuid,
      'template_variables' => template_variables
    }
  ).compact
end