Class: Hyrax::Listeners::FileSetLifecycleNotificationListener

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

Overview

Listens for events related to Hydra Works FileSets and sends notifications where needed.

Instance Method Summary collapse

Instance Method Details

#on_file_set_audited(event) ⇒ Object

Send a notification to the depositor for failed checksum audits.

Parameters:

  • event (Dry::Event)

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

def on_file_set_audited(event)
  return unless event[:result] == :failure # do nothing on success

  Hyrax.logger.error "FIXITY CHECK FAILURE: Fixity failed for #{event[:audit_log]}"

  Hyrax::FixityCheckFailureService
    .new(event[:file_set], checksum_audit_log: event[:audit_log])
    .call
end

#on_file_set_url_imported(event) ⇒ Object

Send a notification to the depositing user for FileSet url import failures.

Parameters:

  • event (Dry::Event)

28
29
30
31
# File 'app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb', line 28

def on_file_set_url_imported(event)
  Hyrax::ImportUrlFailureService.new(event[:file_set], event[:user]).call if
    event[:result] == :failure
end