Class: AbstractNotifier::AsyncAdapters::ActiveJob
- Inherits:
-
Object
- Object
- AbstractNotifier::AsyncAdapters::ActiveJob
- Defined in:
- lib/abstract_notifier/async_adapters/active_job.rb
Defined Under Namespace
Classes: DeliveryJob
Constant Summary collapse
- DEFAULT_QUEUE =
"notifiers"
Instance Attribute Summary collapse
-
#job ⇒ Object
readonly
Returns the value of attribute job.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
Instance Method Summary collapse
- #enqueue ⇒ Object
- #enqueue_delivery(delivery) ⇒ Object
-
#initialize(queue: DEFAULT_QUEUE, job: DeliveryJob) ⇒ ActiveJob
constructor
A new instance of ActiveJob.
Constructor Details
#initialize(queue: DEFAULT_QUEUE, job: DeliveryJob) ⇒ ActiveJob
Returns a new instance of ActiveJob.
16 17 18 19 |
# File 'lib/abstract_notifier/async_adapters/active_job.rb', line 16 def initialize(queue: DEFAULT_QUEUE, job: DeliveryJob) @job = job @queue = queue end |
Instance Attribute Details
#job ⇒ Object (readonly)
Returns the value of attribute job.
14 15 16 |
# File 'lib/abstract_notifier/async_adapters/active_job.rb', line 14 def job @job end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
14 15 16 |
# File 'lib/abstract_notifier/async_adapters/active_job.rb', line 14 def queue @queue end |
Instance Method Details
#enqueue ⇒ Object
21 22 23 |
# File 'lib/abstract_notifier/async_adapters/active_job.rb', line 21 def enqueue(...) job.set(queue:).perform_later(...) end |
#enqueue_delivery(delivery) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/abstract_notifier/async_adapters/active_job.rb', line 25 def enqueue_delivery(delivery, **) job.set(queue:, **).perform_later( delivery.notifier_class.name, delivery.action_name, **delivery.delivery_params ) end |