Sha256: 032a28d415aefc1af31cf84e3110f0bec67b341795cb7606f42f7a260f811716
Contents?: true
Size: 697 Bytes
Versions: 2
Compression:
Stored size: 697 Bytes
Contents
# frozen_string_literal: true require "colorize" require "slack-notifier" module Miteru class Notifier def notify(url:, kits:, message:) attachement = Attachement.new(url) kits = kits.select(&:downloaded?) if notifiable? && kits.any? notifier = Slack::Notifier.new(Miteru.configuration.slack_webhook_url, channel: Miteru.configuration.slack_channel) notifier.post(text: message.capitalize, attachments: attachement.to_a) end message = message.colorize(:light_red) if kits.any? puts "#{url}: #{message}" end def notifiable? Miteru.configuration.slack_webhook_url? && Miteru.configuration.post_to_slack? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
miteru-1.1.0 | lib/miteru/notifier.rb |
miteru-1.0.2 | lib/miteru/notifier.rb |