Created
December 3, 2019 20:24
-
-
Save gdiggs/cd40c5722bbec5ce390876f5a3bbdd7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "icalendar" | |
| |
WORK_ANNIVERSARIES = { | |
# RECACTED | |
}.freeze | |
| |
BIRTHDAYS = { | |
# REDACTED | |
}.freeze | |
| |
Icalendar::Event.class_eval do | |
optional_single_property :x_microsoft_cdo_busystatus, Icalendar::Values::Text | |
end | |
| |
calendar = Icalendar::Calendar.new | |
current_year = Time.now.year | |
| |
def create_event(calendar, summary, year, date) | |
event_date = Icalendar::Values::Date.new("#{year}#{date}") | |
event = Icalendar::Event.new | |
event.dtstart = event_date | |
event.dtend = Icalendar::Values::Date.new(event_date.value + 1) | |
event.summary = summary | |
event.x_microsoft_cdo_busystatus = "FREE" | |
calendar.add_event(event) | |
end | |
| |
(current_year..current_year+3).each do |year| | |
WORK_ANNIVERSARIES.each do |name, date| | |
create_event(calendar, name, year, date) | |
end | |
| |
BIRTHDAYS.each do |name, date| | |
create_event(calendar, name, year, date) | |
end | |
end | |
| |
puts calendar.to_ical |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment