Class: Hyrax::FixityCheckFailureService

Inherits:
AbstractMessageService show all
Defined in:
app/services/hyrax/fixity_check_failure_service.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractMessageService

#user

Instance Method Summary collapse

Methods inherited from AbstractMessageService

#call

Constructor Details

#initialize(file_set, checksum_audit_log:) ⇒ FixityCheckFailureService

Returns a new instance of FixityCheckFailureService.


5
6
7
8
9
10
11
12
13
# File 'app/services/hyrax/fixity_check_failure_service.rb', line 5

def initialize(file_set, checksum_audit_log:)
  @file_set = file_set
  @checksum_audit_log = checksum_audit_log
  @log_date = checksum_audit_log.created_at

  user = ::User.find_by_user_key(file_set.depositor)

  super(file_set, user)
end

Instance Attribute Details

#checksum_audit_logObject (readonly)

Returns the value of attribute checksum_audit_log


3
4
5
# File 'app/services/hyrax/fixity_check_failure_service.rb', line 3

def checksum_audit_log
  @checksum_audit_log
end

#file_setObject (readonly)

Returns the value of attribute file_set


3
4
5
# File 'app/services/hyrax/fixity_check_failure_service.rb', line 3

def file_set
  @file_set
end

#log_dateObject (readonly)

Returns the value of attribute log_date


3
4
5
# File 'app/services/hyrax/fixity_check_failure_service.rb', line 3

def log_date
  @log_date
end

Instance Method Details

#messageObject


15
16
17
18
19
# File 'app/services/hyrax/fixity_check_failure_service.rb', line 15

def message
  uri = file_set.original_file.uri.to_s
  file_title = file_set.title.first
  "The fixity check run at #{log_date} for #{file_title} (#{uri}) failed."
end

#subjectObject


21
22
23
# File 'app/services/hyrax/fixity_check_failure_service.rb', line 21

def subject
  'Failing Fixity Check'
end