Class: Heya::Campaigns::Actions::Email

Inherits:
Heya::Campaigns::Action show all
Defined in:
lib/heya/campaigns/actions/email.rb

Constant Summary collapse

VALID_PARAMS =
%w[subject from reply_to bcc layout to headers]

Instance Attribute Summary

Attributes inherited from Heya::Campaigns::Action

#step, #user

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Heya::Campaigns::Action

#deliver_later, #deliver_now, #initialize

Constructor Details

This class inherits a constructor from Heya::Campaigns::Action

Class Method Details

.validate_step(step) ⇒ Object



9
10
11
12
13
14
# File 'lib/heya/campaigns/actions/email.rb', line 9

def self.validate_step(step)
  step.params.assert_valid_keys(VALID_PARAMS)
  unless step.params["subject"].present? || I18n.exists?("#{step.campaign_name.underscore}.#{step.name.underscore}.subject")
    raise ArgumentError.new(%("subject" is required))
  end
end

Instance Method Details

#buildObject



16
17
18
19
20
# File 'lib/heya/campaigns/actions/email.rb', line 16

def build
  CampaignMailer
    .with(user: user, step: step)
    .build
end