Class: RecordMailer

Inherits:
ApplicationMailer
  • Object
show all
Defined in:
app/models/record_mailer.rb

Overview

Only works for documents with a #to_marc right now.

Instance Method Summary collapse

Instance Method Details

#email_record(documents, details, url_gen_params) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/record_mailer.rb', line 5

def email_record(documents, details, url_gen_params)
  title = begin
    title_field = details[:config].email.title_field
    if title_field
      [documents.first[title_field]].flatten.first
    else
      documents.first.to_semantic_values[:title]
    end
  rescue
    I18n.t('blacklight.email.text.default_title')
  end

  subject = I18n.t('blacklight.email.text.subject',
                   count: documents.length,
                   title: Array(title).first)

  @documents      = documents
  @message        = details[:message]
  @config         = details[:config]
  @url_gen_params = url_gen_params

  mail(to: details[:to], subject: subject)
end

#sms_record(documents, details, url_gen_params) ⇒ Object



29
30
31
32
33
34
35
# File 'app/models/record_mailer.rb', line 29

def sms_record(documents, details, url_gen_params)
  @documents      = documents
  @config         = details[:config]
  @url_gen_params = url_gen_params

  mail(to: details[:to], subject: "") # rubocop:disable Rails/I18nLocaleTexts
end