Class: WhatsAppNotifier::Jobs::SendMessageJob
- Inherits:
-
Object
- Object
- WhatsAppNotifier::Jobs::SendMessageJob
- Defined in:
- lib/whatsapp_notifier/jobs/send_message_job.rb
Class Method Summary collapse
- .perform_later(notification_class_name, params) ⇒ Object
- .perform_now(notification_class_name, params) ⇒ Object
Instance Method Summary collapse
Class Method Details
.perform_later(notification_class_name, params) ⇒ Object
4 5 6 7 8 |
# File 'lib/whatsapp_notifier/jobs/send_message_job.rb', line 4 def self.perform_later(notification_class_name, params) raise LoadError, "ActiveJob is required for deliver_later" unless defined?(::ActiveJob::Base) perform_now(notification_class_name, params) end |
.perform_now(notification_class_name, params) ⇒ Object
10 11 12 |
# File 'lib/whatsapp_notifier/jobs/send_message_job.rb', line 10 def self.perform_now(notification_class_name, params) new.perform(notification_class_name, params) end |
Instance Method Details
#perform(notification_class_name, params) ⇒ Object
14 15 16 17 |
# File 'lib/whatsapp_notifier/jobs/send_message_job.rb', line 14 def perform(notification_class_name, params) klass = notification_class_name.split("::").inject(Object) { |ctx, const| ctx.const_get(const) } klass.with(params).deliver_now end |