Module: BankHolidays

Defined in:
lib/bank_holidays.rb,
lib/bank_holidays/version.rb

Defined Under Namespace

Classes: BankHoliday

Constant Summary collapse

DEFAULT_URL =
"https://www.gov.uk/bank-holidays/england-and-wales.ics"
VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.all(url = DEFAULT_URL) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/bank_holidays.rb', line 7

def self.all(url=DEFAULT_URL)
  holidays = HTTParty.get(url)
  calendar = Icalendar.parse(holidays)
  calendar.first.events.map do |holiday|
    BankHoliday.new(holiday.dtstart, holiday.summary)
  end
end