Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to interact with a CalDAV server from Ruby? [closed]

I need to create events on a calendar server using CalDAV from within a Ruby (Rails to be precise) Application. I have looked at some different libraries and done some googling.

I looked at ri-cal ( http://ri-cal.rubyforge.org/rdoc/ ) But wasnt sure if it supported sending data toa server or if I had to do that myself,

this looked promising http://www.local-guru.net/blog/pages/rubycaldav , but it says it is alpha software, i need something stable.

What is the best way to do this? Is there any library that does this already, Do i need to form my own HTTP requests?

Any advice on the subject is appreceated

like image 877
loosecannon Avatar asked Jul 05 '11 15:07

loosecannon


2 Answers

I ended up using the library at http://www.local-guru.net/blog/pages/rubycaldav

I had to adapt it work with SSL, and use the UUID library correctly, format the dates correctly and work with Full day events. Since I only needed to create and destroy Events that is all i updated. I plan to do more with in when i have time.

My updated code can be found here https://github.com/loosecannon93/ruby-caldav.

The problem I was having was supplying incorrectly formatted dates, and lack of UUIDs.

The caldavtest.rb file on GitHub is what I used to work

An additional Complication i ran into was that Zimbra ( the server ) has 2 paths, one for ICS files that are readonly /home/user@host/Calender and one for CalDAV /dav/user@host/Calendar

I hope that someone may find help with this solution.

However there is a substantial lack of cladav implementation for Ruby. There are ICS libraries that form objects, but there is only pure Net::HTTP to interact with a server. Local-guru's is the only ruby one I found that works both ways, but it is in need of some help with minor issues.

I fixed some of these but not project wide, I just had to get it working. But if someone would like to contribute I would love to help.

like image 103
loosecannon Avatar answered Sep 30 '22 15:09

loosecannon


One of my favorite places to check for possible options is on Ruby Toolbox. This would be one of the first places I would check.

I would also check github, which yielded this result which may be your best option and just what you are looking for.

As far as answering your other questions, I would probably roll my own after taking a look at both this post and this code.

So, long answer severely shortened, yes there are libraries that already accomplish what you are looking to do, but if it were me, I would roll my own solution for something this specific.

like image 43
recursive Avatar answered Sep 30 '22 14:09

recursive