m
module ActivityMonitoring
module Notifiers
class Slack
def self.call(...)
new(...).call(...)
end
def self.notify(...)
::SlackNotifier.notify(...)
end
def initialize(slack_notifier: self.class.method(:notify), **)
@notifier = slack_notifier
super()
end
def call(data: {}, **)
data.each do |group_by, by_group_by|
text = message(group_by, by_group_by)
@notifier.call(text: text, channel: '#some_channel') if text.present?
end
end
#omited
end
end
end