Class: Heya::Campaigns::Action
- Inherits:
-
Object
- Object
- Heya::Campaigns::Action
- Defined in:
- lib/heya/campaigns/action.rb
Direct Known Subclasses
Heya::Campaigns::Actions::Block, Heya::Campaigns::Actions::Email
Instance Attribute Summary collapse
-
#step ⇒ Object
readonly
Returns the value of attribute step.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #build ⇒ Object
- #deliver_later ⇒ Object
- #deliver_now ⇒ Object
-
#initialize(user:, step:) ⇒ Action
constructor
A new instance of Action.
Constructor Details
#initialize(user:, step:) ⇒ Action
Returns a new instance of Action.
6 7 8 |
# File 'lib/heya/campaigns/action.rb', line 6 def initialize(user:, step:) @user, @step = user, step end |
Instance Attribute Details
#step ⇒ Object (readonly)
Returns the value of attribute step.
10 11 12 |
# File 'lib/heya/campaigns/action.rb', line 10 def step @step end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
10 11 12 |
# File 'lib/heya/campaigns/action.rb', line 10 def user @user end |
Instance Method Details
#build ⇒ Object
12 13 14 |
# File 'lib/heya/campaigns/action.rb', line 12 def build raise NotImplementedError, "Please implement #build on subclass of Heya::Campaigns::Action." end |
#deliver_later ⇒ Object
20 21 22 23 24 |
# File 'lib/heya/campaigns/action.rb', line 20 def deliver_later StepActionJob .set(queue: step.queue) .perform_later(step.campaign.class.name, user, step) end |
#deliver_now ⇒ Object
16 17 18 |
# File 'lib/heya/campaigns/action.rb', line 16 def deliver_now build.deliver end |