Sha256: 10c3b1763daddf97ecb0ec1e6b7d74f475d791a4c2d144adb2a86914db9bd736
Contents?: true
Size: 851 Bytes
Versions: 16
Compression:
Stored size: 851 Bytes
Contents
# frozen_string_literal: true require "slack-notifier" require "mihari/slack_monkeypatch" module Mihari module Notifiers class Slack < Base SLACK_WEBHOOK_URL_KEY = "SLACK_WEBHOOK_URL" SLACK_CHANNEL_KEY = "SLACK_CHANNEL" DEFAULT_USERNAME = "mihari" def slack_channel Mihari.config.slack_channel || "#general" end def slack_webhook_url Mihari.config.slack_webhook_url end def slack_webhook_url? !Mihari.config.slack_webhook_url.nil? end def valid? slack_webhook_url? end def notify(text:, attachments: [], mrkdwn: true) notifier = ::Slack::Notifier.new(slack_webhook_url, channel: slack_channel, username: DEFAULT_USERNAME) notifier.post(text: text, attachments: attachments, mrkdwn: mrkdwn) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems