Method: PuppetWebhook::Chatops::Slack#notify

Defined in:
lib/plugins/chatops/slack.rb

#notifyObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/plugins/chatops/slack.rb', line 15

def notify
  notifier = ::Slack::Notifier.new @url, http_options: @options[:http_options]

  target = if @message[:branch]
             @message[:branch]
           elsif @message[:module]
             @message[:module]
           end

  msg = format_message(target)

  notifier.post text: msg[:fallback],
                channel: @channel,
                username: @user,
                icon_emoji: @options[:icon_emoji],
                attachments: [msg]
end