Class: PuppetWebhook::Chatops::Rocketchat
- Inherits:
-
Object
- Object
- PuppetWebhook::Chatops::Rocketchat
- Defined in:
- lib/plugins/chatops/rocketchat.rb
Overview
Sets up Rocketchat object that will send notifications to Slack via a webhook.
Instance Method Summary collapse
-
#initialize(channel, url, user, message, options = {}) ⇒ Rocketchat
constructor
A new instance of Rocketchat.
- #notify ⇒ Object
Constructor Details
#initialize(channel, url, user, message, options = {}) ⇒ Rocketchat
Returns a new instance of Rocketchat.
7 8 9 10 11 12 13 |
# File 'lib/plugins/chatops/rocketchat.rb', line 7 def initialize(channel, url, user, , = {}) @channel = channel @url = url @user = user @message = @options = end |
Instance Method Details
#notify ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/plugins/chatops/rocketchat.rb', line 15 def notify notifier = RocketChat::Notifier.new @url, http_options: @options[:http_options] notifier.username = @user notifier.channel = @channel target = if @message[:branch] @message[:branch] elsif @message[:module] @message[:module] end msg = "r10k deployment of Puppet environment/module #{target} started..." = (target) notifier.ping(msg, icon_emoji: @options[:icon_emoji], attachments: []) end |