Class: Hyrax::Workflow::NotificationGenerator

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/workflow/notification_generator.rb

Overview

Responsible for writing the database records for the given :workflow and :notification_configuration.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow:, notification_configuration:) ⇒ NotificationGenerator

Returns a new instance of NotificationGenerator.

Parameters:



16
17
18
19
20
# File 'app/services/hyrax/workflow/notification_generator.rb', line 16

def initialize(workflow:, notification_configuration:)
  self.workflow = workflow
  self.notification_configuration = notification_configuration
  assign_scope!
end

Class Method Details

.call(workflow:, notification_configuration:) ⇒ Sipity::Notification

Parameters:

Returns:



10
11
12
# File 'app/services/hyrax/workflow/notification_generator.rb', line 10

def self.call(workflow:, notification_configuration:)
  new(workflow: workflow, notification_configuration: notification_configuration).call
end

Instance Method Details

#callObject



22
23
24
25
26
27
# File 'app/services/hyrax/workflow/notification_generator.rb', line 22

def call
  notification = persist_notification
  assign_recipients_to(notification: notification)
  assign_scope_and_reason_to(notification: notification)
  notification
end