class Eye::Notify::Slack

Public Instance Methods

execute() click to toggle source
# 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
message_body() click to toggle source
# File lib/eye/notify/slack.rb, line 32
def message_body
  payload = ''
  payload << "#{contact}: *#{msg_host}* _#{msg_full_name}_ at #{Eye::Utils.human_time2(msg_at)}\n"
  payload << "> #{msg_message}"
  payload
end