Class: EmbargoReleaseSnapshot
- Inherits:
-
BackgroundUploadSnapshot
- Object
- ActiveRecord::Base
- ApplicationRecord
- UploadSnapshot
- BackgroundUploadSnapshot
- EmbargoReleaseSnapshot
- Defined in:
- app/models/embargo_release_snapshot.rb
Instance Attribute Summary
Attributes inherited from UploadSnapshot
Instance Method Summary collapse
Methods inherited from BackgroundUploadSnapshot
#existing_files, #mark_complete, #new_files, #prefix_filename, #upload_complete?
Methods inherited from UploadSnapshot
checksum_compare, #filenames, find_by_filename, #snapshot_deletions, #snapshot_modifications, #uri
Instance Method Details
#finalize_upload ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/models/embargo_release_snapshot.rb', line 3 def finalize_upload new_files.each do |file| work.track_change(:added, file["filename"]) end WorkActivity.add_work_activity(work.id, "#{new_files.count} #{'file'.pluralize(new_files.count)} were released from embargo to the post-curation bucket", nil, activity_type: WorkActivity::SYSTEM) end |
#store_files(s3_files) ⇒ Object
11 12 13 14 15 16 |
# File 'app/models/embargo_release_snapshot.rb', line 11 def store_files(s3_files) save # allow out id to be set self.files = s3_files.map do |file| { "filename" => file.filename, "checksum" => file.checksum, "upload_status" => "started", snapshot_id: id } end end |