Sha256: 6aee5941a7db3192af69a093fec3b30c83cf269d3ccc747e5325b2eb9abfa0ed

Contents?: true

Size: 976 Bytes

Versions: 48

Compression:

Stored size: 976 Bytes

Contents

# A generic job for sending events to a user.
#
# @abstract
class EventJob < Hyrax::ApplicationJob
  include Rails.application.routes.url_helpers
  # For link_to
  include ActionView::Helpers
  # For link_to_profile
  include HyraxHelper

  queue_as Hyrax.config.ingest_queue_name
  attr_reader :depositor

  # @param [User] depositor the user to create the event for
  def perform(depositor)
    @depositor = depositor
    # Log the event to the depositor's profile stream
    log_user_event(depositor)
  end

  # override to provide your specific action for the event you are logging
  # @abstract
  def action
    raise(NotImplementedError, "#action should be implemented by an child class of EventJob")
  end

  # create an event with an action and a timestamp for the user
  def event
    @event ||= Hyrax::Event.create(action, Time.current.to_i)
  end

  # log the event to the users event stream
  def log_user_event(depositor)
    depositor.log_event(event)
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/jobs/event_job.rb
hyrax-2.9.5 app/jobs/event_job.rb
hyrax-2.9.4 app/jobs/event_job.rb
hyrax-2.9.3 app/jobs/event_job.rb
hyrax-2.9.2 app/jobs/event_job.rb
hyrax-2.9.1 app/jobs/event_job.rb
hyrax-2.9.0 app/jobs/event_job.rb
hyrax-2.8.0 app/jobs/event_job.rb
hyrax-2.7.2 app/jobs/event_job.rb
hyrax-2.7.1 app/jobs/event_job.rb
hyrax-2.7.0 app/jobs/event_job.rb
hyrax-2.6.0 app/jobs/event_job.rb
hyrax-3.0.0.pre.rc1 app/jobs/event_job.rb
hyrax-3.0.0.pre.beta3 app/jobs/event_job.rb
hyrax-2.5.1 app/jobs/event_job.rb
hyrax-2.5.0 app/jobs/event_job.rb
hyrax-3.0.0.pre.beta2 app/jobs/event_job.rb
hyrax-2.4.1 app/jobs/event_job.rb
hyrax-3.0.0.pre.beta1 app/jobs/event_job.rb
hyrax-2.4.0 app/jobs/event_job.rb