~michalr/telegram-covid-bot

dc965a1b85e7361f0b168bc3af73d1f2fca5a17b — MichaƂ Rudowicz 4 years ago 84041aa
Small simplification
1 files changed, 1 insertions(+), 7 deletions(-)

M bot.rb
M bot.rb => bot.rb +1 -7
@@ 42,16 42,10 @@ def s(value)
    "#{value_sign}#{value}"
end

# int -> string with Two Digits
def td(value)
    return "#{value}" if value > 9
    return "0#{value}"
end

def get_current_data(for_when)
    data_uri = URI("https://raw.githubusercontent.com/CSSEGISandData/"\
        "COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/"\
        "#{td(for_when.month)}-#{td(for_when.day)}-#{for_when.year}.csv")
        "#{for_when.strftime('%m-%d-%Y')}.csv")

    raw_csv = Net::HTTP.get(data_uri)