Class: SendEventsNotificationsForCompanyJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- SendEventsNotificationsForCompanyJob
- Defined in:
- app/jobs/send_events_notifications_for_company_job.rb
Instance Attribute Summary collapse
-
#company_id ⇒ Object
readonly
Returns the value of attribute company_id.
Instance Method Summary collapse
Instance Attribute Details
#company_id ⇒ Object (readonly)
Returns the value of attribute company_id.
6 7 8 |
# File 'app/jobs/send_events_notifications_for_company_job.rb', line 6 def company_id @company_id end |
Instance Method Details
#perform(company_id:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/jobs/send_events_notifications_for_company_job.rb', line 8 def perform(company_id:) @company_id = company_id # Find all active notification notification_configurations for the company notification_configurations = EventNotificationConfiguration .active .where(company_id: company_id) # Process each configuration notification_configurations.find_each do |notification_configuration| notification_deliveries = notification_configuration.notify_reference_events_recipients notification_delivery_ids = notification_deliveries.pluck(:event_notification_delivery_id) reference_success(notification_configuration, notification_delivery_ids) rescue StandardError => e reference_error(notification_configuration, e) raise e end end |