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:



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

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:



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

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

Instance Method Details

#callObject



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

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