Class: SlackNotifier
- Inherits:
-
Object
- Object
- SlackNotifier
- Defined in:
- lib/capistrano/slackbot/slack_notifier.rb
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ SlackNotifier
constructor
A new instance of SlackNotifier.
- #notify(text) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ SlackNotifier
Returns a new instance of SlackNotifier.
5 6 7 8 9 |
# File 'lib/capistrano/slackbot/slack_notifier.rb', line 5 def initialize(args = {}) @team = args.fetch(:team) { raise ArgumentError, "slack team not set!" } @token = args.fetch(:token) { raise ArgumentError, "slack token not set!" } = args.fetch(:options) { {} } end |
Instance Method Details
#notify(text) ⇒ Object
11 12 13 14 15 |
# File 'lib/capistrano/slackbot/slack_notifier.rb', line 11 def notify(text) payload = { text: text }.merge() connection.post url, payload.to_json end |