Class: WorkPreservationAuditService
- Inherits:
-
Object
- Object
- WorkPreservationAuditService
- Defined in:
- app/services/work_preservation_audit_service.rb
Overview
A service to create and store the preservation data for a given work. Currently it assumes this data will be stored in an AWS S3 bucket accessible with our AWS credentials. This preservation bucket is configured in our s3.yml file and we store it in a different availability region to make sure the data is properly distributed.
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
Instance Method Summary collapse
-
#audit! ⇒ Boolean
Audits all works approved on the date and validates that their directory exists in preservation.
-
#initialize(date: Time.zone.yesterday) ⇒ WorkPreservationAuditService
constructor
A new instance of WorkPreservationAuditService.
Constructor Details
#initialize(date: Time.zone.yesterday) ⇒ WorkPreservationAuditService
Returns a new instance of WorkPreservationAuditService.
14 15 16 |
# File 'app/services/work_preservation_audit_service.rb', line 14 def initialize(date: Time.zone.yesterday) @date = date end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
11 12 13 |
# File 'app/services/work_preservation_audit_service.rb', line 11 def date @date end |
Instance Method Details
#audit! ⇒ Boolean
Audits all works approved on the date and validates that their directory exists in preservation
20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/services/work_preservation_audit_service.rb', line 20 def audit! works = list_works work_status_list = works.map { |work| check_work(work) } empty_works = work_status_list.select { |work_status| work_status[:empty] }.pluck(:work) if empty_works.count > 0 raise WorkAuditError, (empty_works) end true end |