Method: ActivityNotification::Notifiable#notify

Defined in:
lib/activity_notification/models/concerns/notifiable.rb

#notify(target_type, options = {}) ⇒ Array<Notificaion> Also known as: notify_now

Generates notifications to configured targets with notifiable model. This method calls NotificationApi#notify internally with self notifiable instance.

Parameters:

  • target_type (Symbol, String, Class)

    Type of target

  • 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

See Also:

  • NotificationApi#notify


280
281
282
# File 'lib/activity_notification/models/concerns/notifiable.rb', line 280

def notify(target_type, options = {})
  Notification.notify(target_type, self, options)
end