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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.perform_later(notification_class_name, params) ⇒ Object



14
15
16
# File 'lib/whatsapp_notifier/jobs/send_message_job.rb', line 14

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

.perform_now(notification_class_name, params) ⇒ Object



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

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

Instance Method Details

#perform(notification_class_name, params) ⇒ Object



7
8
9
10
# File 'lib/whatsapp_notifier/jobs/send_message_job.rb', line 7

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