Class: Eye::Notify::Slack
- Inherits:
-
Eye::Notify
- Object
- Eye::Notify
- Eye::Notify::Slack
- Defined in:
- lib/eye/notify/slack.rb
Constant Summary
Constants inherited from Eye::Notify
Instance Method Summary collapse
Methods inherited from Eye::Notify
#async_notify, get_class, #initialize, #logger_sub_tag, #message_subject, notify, #notify, register, requires, validate!
Methods included from Dsl::Validation
Constructor Details
This class inherits a constructor from Eye::Notify
Instance Method Details
#execute ⇒ Object
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, ]}" } = { channel: channel, username: username } [:icon_emoji] = icon if icon && icon.start_with?(':') [:icon_url] = icon if icon && icon.start_with?('http') notifier = ::Slack::Notifier.new webhook_url, notifier.ping end |
#message_body ⇒ Object
32 33 34 35 36 37 |
# File 'lib/eye/notify/slack.rb', line 32 def payload = '' payload << "#{contact}: *#{msg_host}* _#{msg_full_name}_ at #{Eye::Utils.human_time2(msg_at)}\n" payload << "> #{}" payload end |