Class: ForemanExpireHosts::Notification::Base

Inherits:
Object
  • Object
show all
Defined in:
app/services/foreman_expire_hosts/notification/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Base

Returns a new instance of Base.



8
9
10
11
# File 'app/services/foreman_expire_hosts/notification/base.rb', line 8

def initialize(opts)
  @all_hosts = opts.fetch(:hosts)
  @global_recipients = [opts[:to]].flatten.compact
end

Instance Attribute Details

#all_hostsObject

Returns the value of attribute all_hosts.



6
7
8
# File 'app/services/foreman_expire_hosts/notification/base.rb', line 6

def all_hosts
  @all_hosts
end

#global_recipientsObject

Returns the value of attribute global_recipients.



6
7
8
# File 'app/services/foreman_expire_hosts/notification/base.rb', line 6

def global_recipients
  @global_recipients
end

Instance Method Details

#deliverObject



13
14
15
16
# File 'app/services/foreman_expire_hosts/notification/base.rb', line 13

def deliver
  deliver_mail_notifications if respond_to?(:build_mail_notification, true)
  deliver_ui_notifications if respond_to?(:build_ui_notification, true)
end