Class: Naminori::Notifier::Slack

Inherits:
Base
  • Object
show all
Defined in:
lib/naminori/notifier/slack.rb

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Naminori::Notifier::Base

Instance Method Details

#notifier(type, message) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/naminori/notifier/slack.rb', line 5

def notifier(type, message)
  icon = type == "add" ? ":white_check_mark:" : ":no_entry_sign:"
  notifier = ::Slack::Notifier.new(config.webhook_url, { channel: config.channel, username: config.user})
  notifier.ping  icon + Time.new.strftime("%H:%M:%S ") + message, icon_emoji: ":sparkle:"
rescue => e
  p e
end