Class: HitorigotoReporter::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/hitorigoto_reporter/reporter.rb

Instance Method Summary collapse

Instance Method Details

#report(date) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/hitorigoto_reporter/reporter.rb', line 3

def report(date)
  target_channels.each do |channel|
    hitorigoto_list = Hitorigoto.fetch(channel, date)
    formatter = Formatter.new(hitorigoto_list)
    if formatter.empty?
      logger.debug("#{channel} has no hitorigoto on #{date.strftime("%Y-%m-%d")}")
    else
      post_report(channel: channel, report: formatter.to_markdown, date: date, tags: formatter.stamps)
    end
  end
end