Sha256: 46acc369013a0fe8152111ceb3fe61cb54bf4f2cdddc22a2f5a37d2273e430d9
Contents?: true
Size: 815 Bytes
Versions: 4
Compression:
Stored size: 815 Bytes
Contents
# frozen_string_literal: true require "colorize" require "slack-notifier" module Miteru class Notifier def notify(url:, kits:, message:) attachement = Attachement.new(url) if post_to_slack? && !kits.empty? notifier = Slack::Notifier.new(slack_webhook_url, channel: slack_channel) notifier.post(text: message, attachments: attachement.to_a) end message = message.colorize(:light_red) unless kits.empty? puts "#{url}: #{message}" end def post_to_slack? slack_webhook_url? && Miteru.configuration.post_to_slack? end def slack_webhook_url ENV.fetch "SLACK_WEBHOOK_URL" end def slack_channel ENV.fetch "SLACK_CHANNEL", "#general" end def slack_webhook_url? ENV.key? "SLACK_WEBHOOK_URL" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
miteru-0.12.12 | lib/miteru/notifier.rb |
miteru-0.12.11 | lib/miteru/notifier.rb |
miteru-0.12.10 | lib/miteru/notifier.rb |
miteru-0.12.9 | lib/miteru/notifier.rb |