Class: CreateEmailVariants

Inherits:
Scrivener
  • Object
show all
Defined in:
lib/shareprogress/filters/create_email_variants.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#button_templateObject

Returns the value of attribute button_template.



2
3
4
# File 'lib/shareprogress/filters/create_email_variants.rb', line 2

def button_template
  @button_template
end

#emailObject

Returns the value of attribute email.



2
3
4
# File 'lib/shareprogress/filters/create_email_variants.rb', line 2

def email
  @email
end

Instance Method Details

#validateObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/shareprogress/filters/create_email_variants.rb', line 4

def validate
  assert_member :button_template, %w{sp_em_small sp_em_large}

  if assert_present :email
    email.each do |e|

      if assert !e["email_subject"].nil?, [:email_subject, :nil]
        assert !e["email_subject"].empty?, [:email_subject, :empty]
      end

      if assert !e["email_body"].nil?, [:email_body, :nil]

        if assert !e["email_body"].empty?, [:email_body, :empty]
          assert e["email_body"].include?("{LINK}"), [:email_body, :link_not_included]
        end

      end

    end
  end

end