Class: DNSRecordUpdater::NotificationService

Inherits:
Object
  • Object
show all
Defined in:
lib/dns_record_updater/notification_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(endpoints) ⇒ NotificationService

Returns a new instance of NotificationService.



5
6
7
# File 'lib/dns_record_updater/notification_service.rb', line 5

def initialize(endpoints)
  @endpoints = endpoints
end

Instance Method Details

#notify(message) ⇒ Object



9
10
11
12
13
14
# File 'lib/dns_record_updater/notification_service.rb', line 9

def notify(message)
  @endpoints.each do |uri|
    payload = { content: message }.to_json
    Net::HTTP.post(URI(uri), payload, { "Content-Type" => "application/json" })
  end
end