class PuppetWebhook::Chatops
Chatops
object for sending webhook notifications to chatops tools
Public Class Methods
new(service, url, channel, user, options = {})
click to toggle source
# File lib/plugins/chatops.rb, line 4 def initialize(service, url, channel, user, options = {}) @service = service @url = url @channel = channel @user = user @args = options end
Public Instance Methods
notify(message)
click to toggle source
# File lib/plugins/chatops.rb, line 12 def notify(message) case @service when 'slack' require 'plugins/chatops/slack' LOGGER.info("Sending Slack webhook message to #{@url}") Chatops::Slack.new( @channel, @url, @user, message, http_options: @args[:http_options] || {}, icon_emoji: @args[:icon_emoji] ).notify when 'rocketchat' require 'plugins/chatops/rocketchat' LOGGER.info("Sending Rocket.Chat webhook message to #{@url}") Chatops::Rocketchat.new( @channel, @url, @user, message, http_options: @args[:http_options] || {}, icon_emoji: @args[:icon_emoji] ).notify else LOGGER.error("Service #{@service} is not currently supported") end end