Class: LastResort::WebHookCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/last-resort/webhooks.rb

Class Method Summary collapse

Class Method Details

.create_hooksObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/last-resort/webhooks.rb', line 3

def self.create_hooks
  config = Config.new
  contextio = ContextIO::Connection.new(config.contextio_key, config.contextio_secret)

  # Delete everything...
  contextio.deleteAllWebhooks config.

  # ...then recreate based on the configuration
  config.matchers.each do |matcher|
    contextio.createWebhook CONFIG.,
      :callback_url => "http://#{CONFIG.host}/matched_email",
      :failure_notif_url => "http://google.ca",
      :filter_subject => matcher[:subject].source,
      :sync_period => "immediate"
  end
end