Class: CurationConcerns::FileSetAuditService
- Inherits:
-
Object
- Object
- CurationConcerns::FileSetAuditService
- Defined in:
- app/services/curation_concerns/file_set_audit_service.rb
Constant Summary collapse
- NO_RUNS =
999
Instance Attribute Summary collapse
-
#file_set ⇒ Object
readonly
Returns the value of attribute file_set.
Instance Method Summary collapse
-
#audit(log = {}) ⇒ Object
Audits each version of each file if it hasn’t been audited recently Returns the set of most recent audit status for each version of the content file.
-
#human_readable_audit_status(file = file_set.original_file) ⇒ Object
provides a human readable version of the audit status This may trigger audits to be run if required.
-
#initialize(file_set) ⇒ FileSetAuditService
constructor
A new instance of FileSetAuditService.
-
#logged_audit_status ⇒ Object
Check the file by only what is in the audit log.
Constructor Details
#initialize(file_set) ⇒ FileSetAuditService
Returns a new instance of FileSetAuditService.
4 5 6 |
# File 'app/services/curation_concerns/file_set_audit_service.rb', line 4 def initialize(file_set) @file_set = file_set end |
Instance Attribute Details
#file_set ⇒ Object (readonly)
Returns the value of attribute file_set.
3 4 5 |
# File 'app/services/curation_concerns/file_set_audit_service.rb', line 3 def file_set @file_set end |
Instance Method Details
#audit(log = {}) ⇒ Object
Audits each version of each file if it hasn’t been audited recently Returns the set of most recent audit status for each version of the content file
34 35 36 37 |
# File 'app/services/curation_concerns/file_set_audit_service.rb', line 34 def audit(log = {}) file_set.files.each { |f| log[f.id] = audit_file(f) } log end |
#human_readable_audit_status(file = file_set.original_file) ⇒ Object
provides a human readable version of the audit status This may trigger audits to be run if required
13 14 15 |
# File 'app/services/curation_concerns/file_set_audit_service.rb', line 13 def human_readable_audit_status(file = file_set.original_file) audit_stat(file) end |
#logged_audit_status ⇒ Object
Check the file by only what is in the audit log. Do not try to access the versions if we do not have access to them. Use this when a file_set is loaded from solr instead of fedora
20 21 22 23 24 25 26 27 28 29 |
# File 'app/services/curation_concerns/file_set_audit_service.rb', line 20 def logged_audit_status audit_results = ChecksumAuditLog.logs_for(file_set.id, "original_file") .collect { |result| result["pass"] } if audit_results.length > 0 stat_to_string(audit_results.reduce(true) { |sum, value| sum && value }) else 'Audits have not yet been run on this file.' end end |