Class: WatchDoge::Notification::SlackWebhook
- Inherits:
-
Object
- Object
- WatchDoge::Notification::SlackWebhook
- Defined in:
- lib/watchdoge/notification/slack_webhook.rb
Instance Method Summary collapse
- #flush ⇒ Object
-
#initialize(opt) ⇒ SlackWebhook
constructor
A new instance of SlackWebhook.
Constructor Details
#initialize(opt) ⇒ SlackWebhook
Returns a new instance of SlackWebhook.
4 5 6 7 8 |
# File 'lib/watchdoge/notification/slack_webhook.rb', line 4 def initialize opt super @incoming_url = opt[:incoming_url] end |
Instance Method Details
#flush ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/watchdoge/notification/slack_webhook.rb', line 10 def flush @message_queue.each do || body = slack_body().to_json Net::HTTP.post URI(@incoming_url), body, "Content-Type" => "application/json" end @message_queue = [] end |