Class: WebHookNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/abt/notifiers/web_hook_notifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(notifier_details) ⇒ WebHookNotifier

Returns a new instance of WebHookNotifier.



4
5
6
# File 'lib/abt/notifiers/web_hook_notifier.rb', line 4

def initialize(notifier_details)
  @url = notifier_details["url"]
end

Instance Method Details

#headersObject



21
22
23
24
# File 'lib/abt/notifiers/web_hook_notifier.rb', line 21

def headers
  #coudl be added oauth token
  {'User-Agent' => "ABT Ruby Client"}
end

#post(message) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/abt/notifiers/web_hook_notifier.rb', line 13

def post(message)
  begin
    RestClient.post(@url, {:message=>message}, headers)
  rescue RestClient::Exception => ex
    ex.inspect
  end
end

#send_message(message) ⇒ Object



8
9
10
11
# File 'lib/abt/notifiers/web_hook_notifier.rb', line 8

def send_message(message)
  puts "sending_message #{message}"
  post(message)
end