Class: RecordMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
vendor/plugins/blacklight/app/models/record_mailer.rb

Overview

Only works for documents with a #to_marc right now.

Instance Method Summary (collapse)

Instance Method Details

- (Object) email_record(documents, details, from_host, host)



5
6
7
8
9
10
11
12
13
14
15
16
# File 'vendor/plugins/blacklight/app/models/record_mailer.rb', line 5

def (documents, details, from_host, host)
  #raise ArgumentError.new("RecordMailer#email_record only works with documents with a #to_marc") unless document.respond_to?(:to_marc)
  
  recipients details[:to]
  if documents.size == 1
    subject "Item Record: #{documents.first.to_marc['245']['a'] rescue 'N/A'}"
  else
    subject "Item records"
  end
  from "no-reply@" << from_host
  body :documents => documents, :host => host, :message => details[:message]
end

- (Object) sms_record(documents, details, from_host, host)



18
19
20
21
22
23
24
25
# File 'vendor/plugins/blacklight/app/models/record_mailer.rb', line 18

def sms_record(documents, details, from_host, host)
  if sms_mapping[details[:carrier]]
    to = "#{details[:to]}@#{sms_mapping[details[:carrier]]}"
  end
  recipients to
  from "no-reply@" << from_host
  body :documents => documents, :host => host
end