Class: WhatsAppNotifier::Jobs::SendMessageJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/whatsapp_notifier/jobs/send_message_job.rb,
lib/whatsapp_notifier/jobs/send_message_job.rb

Overview

:nocov:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.perform_later(notification_class_name, params) ⇒ Object



19
20
21
# File 'lib/whatsapp_notifier/jobs/send_message_job.rb', line 19

def self.perform_later(notification_class_name, params)
  perform_now(notification_class_name, params)
end

.perform_now(notification_class_name, params) ⇒ Object



23
24
25
# File 'lib/whatsapp_notifier/jobs/send_message_job.rb', line 23

def self.perform_now(notification_class_name, params)
  new.perform(notification_class_name, params)
end

Instance Method Details

#perform(notification_class_name, params) ⇒ Object



11
12
13
14
# File 'lib/whatsapp_notifier/jobs/send_message_job.rb', line 11

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