Polymathic Blog
Digital transformation, higher education, innovation, technology, professional skills, management, and strategy
1 min read
ruby-on-rails

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

Related Posts

30 Jan 2024

Google Criticized for Privacy Issues

Ian ‘Hixie’ Hickson, a prominent figure in the Flutter community, has left Google. Despite not being as public as other contributors, …