Method: Eye::Notify::Slack#execute

Defined in:
lib/eye/notify/slack.rb

#executeObject



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

def execute
  debug { "send slack #{[channel, username]} - #{[contact, message_body]}" }

  options = {
    channel:  channel,
    username: username
  }

  options[:icon_emoji] = icon if icon && icon.start_with?(':')
  options[:icon_url]   = icon if icon && icon.start_with?('http')

  notifier = ::Slack::Notifier.new webhook_url, options

  notifier.ping message_body
end