Class: Curate::ContentDepositEventJob
- Inherits:
-
Object
- Object
- Curate::ContentDepositEventJob
- Includes:
- ActionView::Helpers, ActionView::Helpers::DateHelper, Hydra::AccessControlsEnforcement
- Defined in:
- lib/curate/jobs/content_deposit_event_job.rb
Instance Attribute Summary collapse
-
#depositor_id ⇒ Object
Returns the value of attribute depositor_id.
-
#generic_file_id ⇒ Object
Returns the value of attribute generic_file_id.
Instance Method Summary collapse
-
#initialize(generic_file_id, depositor_id) ⇒ ContentDepositEventJob
constructor
A new instance of ContentDepositEventJob.
- #queue_name ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(generic_file_id, depositor_id) ⇒ ContentDepositEventJob
Returns a new instance of ContentDepositEventJob.
14 15 16 17 |
# File 'lib/curate/jobs/content_deposit_event_job.rb', line 14 def initialize(generic_file_id, depositor_id) self.generic_file_id = generic_file_id self.depositor_id = depositor_id end |
Instance Attribute Details
#depositor_id ⇒ Object
Returns the value of attribute depositor_id.
12 13 14 |
# File 'lib/curate/jobs/content_deposit_event_job.rb', line 12 def depositor_id @depositor_id end |
#generic_file_id ⇒ Object
Returns the value of attribute generic_file_id.
12 13 14 |
# File 'lib/curate/jobs/content_deposit_event_job.rb', line 12 def generic_file_id @generic_file_id end |
Instance Method Details
#queue_name ⇒ Object
8 9 10 |
# File 'lib/curate/jobs/content_deposit_event_job.rb', line 8 def queue_name :event end |
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/curate/jobs/content_deposit_event_job.rb', line 19 def run gf = GenericFile.find(generic_file_id) action = "User #{depositor_id} has deposited #{gf.title} (#{gf.noid})" = Time.now.to_i depositor = ::User.find_by_user_key(depositor_id) event = depositor.create_event(action, ) depositor.log_profile_event(event) gf.log_event(event) depositor.followers.select { |user| user.can? :read, gf }.each do |follower| follower.log_event(event) end end |