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.



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

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.



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

def checksum_audit_log
  @checksum_audit_log
end

#file_setObject (readonly)

Returns the value of attribute file_set.



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

def file_set
  @file_set
end

#log_dateObject (readonly)

Returns the value of attribute log_date.



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

def log_date
  @log_date
end

Instance Method Details

#messageObject



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

def message
  uri = checksum_audit_log.checked_uri
  file_title = file_set.title.first
  I18n.t('hyrax.notifications.fixity_check_failure.message', log_date: log_date, file_title: file_title, uri: uri)
end

#subjectObject



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

def subject
  I18n.t('hyrax.notifications.fixity_check_failure.subject')
end