Class: StationMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/station_mailer.rb

Instance Method Summary collapse

Instance Method Details

#low_balance(station, options = {}) ⇒ Mail::Message|nil

Note:

Subject should be set via I18n file at config/locales/en.yml with the following key: en.station_mailer.low_balance.subject

Returns nil if mail could not be created

Parameters:

  • station (Station)
  • options (Hash) (defaults to: {})

Returns:

  • (Mail::Message|nil)

    nil if mail could not be created


8
9
10
11
12
13
14
# File 'app/mailers/station_mailer.rb', line 8

def low_balance(station, options = {})
  @balance = station.balance
  send_mail(station, options.merge!(
      message_handler: __method__,
      subject: "Low balance for your station #{station.name}"
  ))
end

#offline(station, options = {}) ⇒ Mail::Message|nil

Note:

Subject should be set via I18n file at config/locales/en.yml with the following key: en.station_mailer.offline.subject

Returns nil if mail could not be created

Parameters:

  • station (Station)
  • options (Hash) (defaults to: {})

Returns:

  • (Mail::Message|nil)

    nil if mail could not be created


22
23
24
25
26
27
# File 'app/mailers/station_mailer.rb', line 22

def offline(station, options = {})
  send_mail(station, options.merge!(
      message_handler: __method__,
      subject: "Your station #{station.name} has not responded for 15 minutes."
  ))
end

#online(station, options = {}) ⇒ Mail::Message|nil

Note:

Subject should be set via I18n file at config/locales/en.yml with the following key:
en.station_mailer.offline.subject

Returns nil if mail could not be created

Parameters:

  • station (Station)
  • options (Hash) (defaults to: {})

Returns:

  • (Mail::Message|nil)

    nil if mail could not be created


35
36
37
38
39
40
# File 'app/mailers/station_mailer.rb', line 35

def online(station, options = {})
  send_mail(station, options.merge!(
      message_handler: __method__,
      subject: "Your station #{station.name} has started to respond and we are now receiving data from it."
  ))
end