Class: EventJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- EventJob
- Includes:
- ActionView::Helpers, ActionView::Helpers::DateHelper, Hydra::AccessControlsEnforcement, SufiaHelper
- Defined in:
- app/jobs/event_job.rb
Overview
A generic job for sending events to a user.
This class does not implement a usable action, so it must be implemented in a child class
Direct Known Subclasses
ContentDeleteEventJob, ContentEventJob, UserEditProfileEventJob
Constant Summary
Constants included from Sufia::CitationsBehaviors::TitleBehavior
Sufia::CitationsBehaviors::TitleBehavior::EXPANDED_NOCAPS, Sufia::CitationsBehaviors::TitleBehavior::TITLE_NOCAPS
Instance Attribute Summary collapse
-
#depositor ⇒ Object
readonly
Returns the value of attribute depositor.
Instance Method Summary collapse
-
#action ⇒ Object
abstract
override to provide your specific action for the event you are logging.
-
#event ⇒ Object
create an event with an action and a timestamp for the user.
-
#log_user_event(depositor) ⇒ Object
log the event to the users event stream.
- #perform(depositor) ⇒ Object
Methods included from Sufia::SufiaHelperBehavior
#application_name, #banner_image, #browser_supports_directory_upload?, #collection_thumbnail, #current_search_parameters, #error_messages_for, #has_collection_search_parameters?, #human_readable_date, #iconify_auto_link, #index_field_link, #institution_name, #institution_name_full, #license_links, #link_to_each_facet_field, #link_to_facet, #link_to_facet_list, #link_to_field, #link_to_profile, #link_to_telephone, #orcid_label, #render_visibility_link, #rights_statement_links, #search_form_action, #show_transfer_request_title, #user_display_name_and_key, #zotero_label, #zotero_profile_url
Methods included from Sufia::CitationsBehavior
#export_as_apa_citation, #export_as_chicago_citation, #export_as_mla_citation, #export_as_openurl_ctx_kev
Methods included from Sufia::CitationsBehaviors::TitleBehavior
#chicago_citation_title, #mla_citation_title, #process_title_parts, #setup_title_info
Methods included from Sufia::CitationsBehaviors::CommonBehavior
#clean_end_punctuation, #persistent_url
Methods included from Sufia::CitationsBehaviors::NameBehavior
#abbreviate_name, #all_authors, #author_list, #given_name_first, #surname_first
Methods included from Sufia::CitationsBehaviors::PublicationBehavior
#setup_pub_date, #setup_pub_info, #setup_pub_place, #setup_pub_publisher
Methods included from Sufia::BlacklightOverride
#fields_to_exclude_from_constraint_element
Instance Attribute Details
#depositor ⇒ Object (readonly)
Returns the value of attribute depositor.
13 14 15 |
# File 'app/jobs/event_job.rb', line 13 def depositor @depositor end |
Instance Method Details
#action ⇒ Object
override to provide your specific action for the event you are logging
24 25 26 |
# File 'app/jobs/event_job.rb', line 24 def action raise(NotImplementedError, "#action should be implemented by an child class of EventJob") end |
#event ⇒ Object
create an event with an action and a timestamp for the user
29 30 31 |
# File 'app/jobs/event_job.rb', line 29 def event @event ||= Sufia::Event.create(action, Time.current.to_i) end |
#log_user_event(depositor) ⇒ Object
log the event to the users event stream
34 35 36 |
# File 'app/jobs/event_job.rb', line 34 def log_user_event(depositor) depositor.log_event(event) end |
#perform(depositor) ⇒ Object
16 17 18 19 20 |
# File 'app/jobs/event_job.rb', line 16 def perform(depositor) @depositor = depositor # Log the event to the depositor's profile stream log_user_event(depositor) end |