Sha256: 6b9e9bab9cc5e53b0e0aa9d8facf23a3e236cd6b4b0f2bbadd8b9e861777bb38

Contents?: true

Size: 639 Bytes

Versions: 8

Compression:

Stored size: 639 Bytes

Contents

# frozen_string_literal: true

module Hyrax
  module Listeners
    ##
    # Listens for events related to batch activity and creates notifications
    class BatchNotificationListener
      ##
      # Notify requesting users of batch success/failure
      #
      # @param event [Dry::Event]
      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
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hyrax-3.2.0 app/services/hyrax/listeners/batch_notification_listener.rb
hyrax-3.1.0 app/services/hyrax/listeners/batch_notification_listener.rb
hyrax-3.0.2 app/services/hyrax/listeners/batch_notification_listener.rb
hyrax-3.0.1 app/services/hyrax/listeners/batch_notification_listener.rb
hyrax-3.0.0 app/services/hyrax/listeners/batch_notification_listener.rb
hyrax-3.0.0.pre.rc4 app/services/hyrax/listeners/batch_notification_listener.rb
hyrax-3.0.0.pre.rc3 app/services/hyrax/listeners/batch_notification_listener.rb
hyrax-3.0.0.pre.rc2 app/services/hyrax/listeners/batch_notification_listener.rb