Class: CurationConcerns::Actors::FileActor
- Inherits:
-
Object
- Object
- CurationConcerns::Actors::FileActor
- Defined in:
- app/actors/curation_concerns/actors/file_actor.rb
Overview
actions for a file identified by file_set and relation (maps to use predicate)
Instance Attribute Summary collapse
- #file_set ⇒ Object readonly
- #relation ⇒ Object readonly
- #user ⇒ Object readonly
Instance Method Summary collapse
-
#ingest_file(file) ⇒ Object
Puts the uploaded content into a staging directory.
-
#initialize(file_set, relation, user) ⇒ FileActor
constructor
A new instance of FileActor.
- #revert_to(revision_id) ⇒ Object
Constructor Details
#initialize(file_set, relation, user) ⇒ FileActor
Returns a new instance of FileActor.
10 11 12 13 14 |
# File 'app/actors/curation_concerns/actors/file_actor.rb', line 10 def initialize(file_set, relation, user) @file_set = file_set @relation = relation @user = user end |
Instance Attribute Details
#file_set ⇒ Object (readonly)
5 6 7 |
# File 'app/actors/curation_concerns/actors/file_actor.rb', line 5 def file_set @file_set end |
#relation ⇒ Object (readonly)
5 6 7 |
# File 'app/actors/curation_concerns/actors/file_actor.rb', line 5 def relation @relation end |
#user ⇒ Object (readonly)
5 6 7 |
# File 'app/actors/curation_concerns/actors/file_actor.rb', line 5 def user @user end |
Instance Method Details
#ingest_file(file) ⇒ Object
Puts the uploaded content into a staging directory. Then kicks off a job to ingest the file into the repository, then characterize and create derivatives with this on disk variant. TODO: create a job to monitor this directory and prune old files that have made it to the repo
22 23 24 25 26 27 28 29 |
# File 'app/actors/curation_concerns/actors/file_actor.rb', line 22 def ingest_file(file) IngestFileJob.perform_later( file_set, working_file(file), user, (file)) true end |
#revert_to(revision_id) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/actors/curation_concerns/actors/file_actor.rb', line 31 def revert_to(revision_id) repository_file = file_set.send(relation.to_sym) repository_file.restore_version(revision_id) return false unless file_set.save CurationConcerns::VersioningService.create(repository_file, user) # Characterize the original file from the repository CharacterizeJob.perform_later(file_set, repository_file.id) true end |