Class: NotificationEmailer

Inherits:
Object
  • Object
show all
Defined in:
app/services/notification_emailer.rb

Defined Under Namespace

Classes: EmailUser

Class Method Summary collapse

Class Method Details

.disableObject



128
129
130
# File 'app/services/notification_emailer.rb', line 128

def self.disable
  @disabled = true
end

.enableObject



132
133
134
# File 'app/services/notification_emailer.rb', line 132

def self.enable
  @disabled = false
end

.process_notification(notification, no_delay: false) ⇒ Object



136
137
138
139
140
141
142
# File 'app/services/notification_emailer.rb', line 136

def self.process_notification(notification, no_delay: false)
  return if @disabled

  email_user = EmailUser.new(notification, no_delay: no_delay)
  email_method = Notification.types[notification.notification_type]
  email_user.public_send(email_method) if email_user.respond_to? email_method
end