1 min read
Rails: Parsing iCal calendar on a password-protected WebDAV server
It took me a little while, but I finally got this working. You'll need the iCalendar plugin.
require 'icalendar'Â
def view_ical
 request = Net::HTTP::Get.new('/calendars/calendar.ics')Â
response = Net::HTTP.start('webdav.site.com') {|http|Â
request.basic_auth 'username', 'password'Â
response = http.request(request)Â
}Â
calendar_text = response.body
calendars = Icalendar.parse(calendar_text)Â
calendar = calendars.first
end