2018-07-14 00:50:13 +02:00
|
|
|
|
:ruby
|
|
|
|
|
# Create a calendar with an event (standard method)
|
|
|
|
|
cal = Icalendar::Calendar.new
|
|
|
|
|
@events.each do |event|
|
|
|
|
|
cal.event do |e|
|
|
|
|
|
e.dtstamp = Icalendar::Values::DateTime.new event.decision_time
|
2018-07-14 18:17:21 +02:00
|
|
|
|
e.uid = "#{event.id}@#{request.domain}"
|
2018-07-14 00:50:13 +02:00
|
|
|
|
e.dtstart = Icalendar::Values::DateTime.new event.start_time
|
|
|
|
|
e.dtend = Icalendar::Values::DateTime.new event.end_time
|
|
|
|
|
e.summary = event.title
|
|
|
|
|
e.description = event.description.tr '\'', '’'
|
|
|
|
|
e.location = event.full_address.tr '\'', '’'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
cal.publish
|
|
|
|
|
|
|
|
|
|
= cal.to_ical
|