Class: AuditJob
- Inherits:
-
ActiveFedoraIdBasedJob
- Object
- ActiveFedoraIdBasedJob
- AuditJob
- Defined in:
- app/jobs/audit_job.rb
Constant Summary collapse
- PASS =
'Passing Audit Run'.freeze
- FAIL =
'Failing Audit Run'.freeze
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#path ⇒ Object
Returns the value of attribute path.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(id, path, uri) ⇒ AuditJob
constructor
URI of the resource to audit.
- #queue_name ⇒ Object
- #run ⇒ Object
Methods inherited from ActiveFedoraIdBasedJob
Constructor Details
#initialize(id, path, uri) ⇒ AuditJob
URI of the resource to audit. This URI could include the actual resource (e.g. content) and the version to audit:
http://localhost:8983/fedora/rest/test/a/b/c/abcxyz/content/fcr:versions/version1
but it could also just be:
http://localhost:8983/fedora/rest/test/a/b/c/abcxyz/content
16 17 18 19 20 |
# File 'app/jobs/audit_job.rb', line 16 def initialize(id, path, uri) super(id) self.path = path self.uri = uri end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'app/jobs/audit_job.rb', line 9 def id @id end |
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'app/jobs/audit_job.rb', line 9 def path @path end |
#uri ⇒ Object
Returns the value of attribute uri.
9 10 11 |
# File 'app/jobs/audit_job.rb', line 9 def uri @uri end |
Instance Method Details
#queue_name ⇒ Object
2 3 4 |
# File 'app/jobs/audit_job.rb', line 2 def queue_name :audit end |
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/jobs/audit_job.rb', line 22 def run log = run_audit fixity_ok = (log.pass == 1) unless fixity_ok # send the user a message about the failing audit login = generic_file.depositor user = User.find_by_user_key(login) logger.warn "User '#{login}' not found" unless user job_user = User.audituser file_title = generic_file.title.first = "The audit run at #{log.created_at} for #{file_title} (#{uri}) failed." subject = FAIL job_user.(user, , subject) end fixity_ok end |