Class: DNS::Monitor::GChat

Inherits:
Object
  • Object
show all
Defined in:
lib/dns/monitor/gchat.rb

Instance Method Summary collapse

Constructor Details

#initialize(webhook_url) ⇒ GChat

Returns a new instance of GChat.



4
5
6
# File 'lib/dns/monitor/gchat.rb', line 4

def initialize(webhook_url)
  @webhook_url = webhook_url
end

Instance Method Details

#message(text) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/dns/monitor/gchat.rb', line 8

def message(text)
  Net::HTTP.post(
    URI(@webhook_url), 
    {text: text}.to_json, 
    'Content-Type' => 'application/json'
  )
end