module BankHoliday
Constants
- URL
- VERSION
Public Class Methods
all()
click to toggle source
# File lib/bank_holiday/bank_holiday.rb, line 7 def self.all uri = URI.parse(URL) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) bank_holidays = response.body return Dish(JSON.parse(bank_holidays)["england-and-wales"]["events"]) end
bank_holiday?(date)
click to toggle source
# File lib/bank_holiday/bank_holiday.rb, line 17 def self.bank_holiday?(date) @bank_holidays||=all if @bank_holidays.collect {|holiday| holiday.date}.include?(date.strftime("%Y-%m-%d")) return true else return false end end