Class: Sufia::GenericFileAuditService

Inherits:
Object
  • Object
show all
Defined in:
app/services/sufia/generic_file_audit_service.rb

Constant Summary collapse

NO_RUNS =
999

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ GenericFileAuditService

Returns a new instance of GenericFileAuditService.



4
5
6
# File 'app/services/sufia/generic_file_audit_service.rb', line 4

def initialize(file)
  @generic_file = file
end

Instance Attribute Details

#generic_fileObject (readonly)

Returns the value of attribute generic_file.



3
4
5
# File 'app/services/sufia/generic_file_audit_service.rb', line 3

def generic_file
  @generic_file
end

Instance Method Details

#auditObject

TODO: Run audits on all attached files. We’re only auditing “content” at tht moment Pushes an AuditJob for each version of content if it hasn’t been audited recently Returns the set of most recent audit status for each version of the content file



26
27
28
# File 'app/services/sufia/generic_file_audit_service.rb', line 26

def audit
  audit_content([])
end

#human_readable_audit_statusObject

provides a human readable version of the audit status



11
12
13
14
15
16
17
18
19
20
21
# File 'app/services/sufia/generic_file_audit_service.rb', line 11

def human_readable_audit_status
  stat = audit_stat
  case stat
  when 0
    'failing'
  when 1
    'passing'
  else
    stat
  end
end