Class: Hyrax::Listeners::BatchNotificationListener

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/listeners/batch_notification_listener.rb

Overview

Listens for events related to batch activity and creates notifications

Instance Method Summary collapse

Instance Method Details

#on_batch_created(event) ⇒ Object

Notify requesting users of batch success/failure

Parameters:

  • event (Dry::Event)

12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/services/hyrax/listeners/batch_notification_listener.rb', line 12

def on_batch_created(event)
  case event[:result]
  when :success
    Hyrax::BatchCreateSuccessService
      .new(event[:user])
      .call
  when :failure
    Hyrax::BatchCreateFailureService
      .new(event[:user], event[:messages])
      .call
  end
end