Class: ShortMessage::Mailer

Inherits:
ApplicationMailer show all
Defined in:
app/mailers/short_message/mailer.rb

Instance Method Summary collapse

Instance Method Details

#error_notification(message, response_or_error) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/mailers/short_message/mailer.rb', line 3

def error_notification(message, response_or_error)
  details = if response_or_error.respond_to?(:code)
    "HTTP #{response_or_error.code}: #{response_or_error.body.to_s.truncate(500)}"
  else
    "#{response_or_error.class}: #{response_or_error.message}"
  end

  mail(
    to: ShortMessage.config.admin_notification_email,
    subject: "Error delivering SMS to #{message.recipient}",
    body: "SMS from #{message.sender} to #{message.recipient} could not be sent!\r\n\r\nResponse: #{details}"
  )
end

#payment_required_notificationObject



17
18
19
20
21
22
23
# File 'app/mailers/short_message/mailer.rb', line 17

def payment_required_notification
  mail(
    to: ShortMessage.config.reload_notification_email,
    subject: "SMS Gateway requires payment",
    body: "Your SMS Gateway API (#{ShortMessage.config.api_base_url}) requires payment!"
  )
end