Class: ActivityNotification::NotifyAllJob

Inherits:
Object
  • Object
show all
Defined in:
app/jobs/activity_notification/notify_all_job.rb

Overview

Job to generate notifications by ActivityNotification::Notification#notify_all method.

Instance Method Summary collapse

Instance Method Details

#perform(targets, notifiable, options = {}) ⇒ Array<Notificaion>

Generates notifications to specified targets with ActiveJob.

Parameters:

  • targets (Array<Object>)

    Targets to send notifications

  • notifiable (Object)

    Notifiable instance

  • options (Hash) (defaults to: {})

    Options for notifications

Options Hash (options):

  • :key (String) — default: notifiable.default_notification_key

    Key of the notification

  • :group (Object) — default: nil

    Group unit of the notifications

  • :group_expiry_delay (ActiveSupport::Duration) — default: nil

    Expiry period of a notification group

  • :notifier (Object) — default: nil

    Notifier of the notifications

  • :parameters (Hash) — default: {}

    Additional parameters of the notifications

  • :send_email (Boolean) — default: true

    Whether it sends notification email

  • :send_later (Boolean) — default: true

    Whether it sends notification email asynchronously

  • :publish_optional_targets (Boolean) — default: true

    Whether it publishes notification to optional targets

  • :optional_targets (Hash<String, Hash>) — default: {}

    Options for optional targets, keys are optional target name (:amazon_sns or :slack etc) and values are options

Returns:

  • (Array<Notificaion>)

    Array of generated notifications



21
22
23
# File 'app/jobs/activity_notification/notify_all_job.rb', line 21

def perform(targets, notifiable, options = {})
  ActivityNotification::Notification.notify_all(targets, notifiable, options)
end