Skip to content

Instantly share code, notes, and snippets.

@skord
Created January 10, 2012 20:44
Show Gist options
  • Select an option

  • Save skord/1591075 to your computer and use it in GitHub Desktop.

Select an option

Save skord/1591075 to your computer and use it in GitHub Desktop.
parses eve's calendar export, converts to iCal
# I'd have added a little memcached thing I did and made it so
# anyone can use it, but well, they love to lock people out after
# a few api accesses. Varnish cache anyone?
require 'sinatra'
require 'nokogiri'
require 'ri_cal'
get '/calendar' do
"#{api_calendar}"
end
def api_calendar
f = File.open('UpcomingCalendarEvents.xml')
doc = Nokogiri::XML(f)
f.close
happenings = doc.xpath('/eveapi/result/rowset/row')
RiCal.Calendar do
happenings.each do |happening|
event do |event|
event.description happening['eventTitle']
event.dtstart = DateTime.parse(happening['eventDate'] + 'Z')
event.dtend = DateTime.parse(happening['eventDate'] + 'Z') + happening['duration'].to_i
event.add_attendee happening['ownerID']
event.add_comment happening['eventText']
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment