Sha256: 9b4733d1ce62727213a9977afb50dc17bcabd1e4448d244136b15e5d2e8fac25
Contents?: true
Size: 927 Bytes
Versions: 50
Compression:
Stored size: 927 Bytes
Contents
# Configure your watches like this: # # God.contact(:webhook) do |c| # c.name = 'Tester' # c.hook_url = 'http://hook/url' # end require 'net/http' require 'uri' module God module Contacts class Webhook < Contact attr_accessor :hook_url def valid? valid = true end def notify(message, time, priority, category, host) begin data = { :message => message, :time => time, :priority => priority, :category => category, :host => host } uri = URI.parse(self.hook_url) Net::HTTP.post_form(uri, data) self.info = "sent webhook to #{self.hook_url}" rescue => e puts e.message puts e.backtrace.join("\n") self.info = "failed to send webhook to #{self.hook_url}: #{e.message}" end end end end end
Version data entries
50 entries across 50 versions & 15 rubygems