Class: NodataMonitor::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/nodata-monitor.rb

Instance Method Summary collapse

Constructor Details

#initialize(credential, endpoints_to_notify, alerts) ⇒ Notifier

Returns a new instance of Notifier.



38
39
40
41
42
# File 'lib/nodata-monitor.rb', line 38

def initialize credential, endpoints_to_notify, alerts
  @credential = credential
  @endpoints_to_notify = endpoints_to_notify
  @alerts = alerts
end

Instance Method Details

#notify!Object



44
45
46
47
48
# File 'lib/nodata-monitor.rb', line 44

def notify!
  @alerts.each do |alert|
    @credential.client.emit_event(Dogapi::Event.new('A no-data state was detected for the alert: ' + alert.name + ' ' + @endpoints_to_notify))
  end
end