如何从 Ruby 与 CalDAV 服务器交互? [英] How to interact with a CalDAV server from Ruby?

查看:26
本文介绍了如何从 Ruby 与 CalDAV 服务器交互?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 Ruby(准确地说是 Rails)应用程序中使用 CalDAV 在日历服务器上创建事件.我查看了一些不同的库并进行了一些谷歌搜索.

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.

我查看了 ri-cal ( http://ri-cal.rubyforge.org/rdoc/ )但不确定它是否支持向服务器发送数据,或者我是否必须自己这样做,

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,

这看起来很有希望http://www.local-guru.net/blog/pages/rubycaldav ,但它说它是 alpha 软件,我需要一些稳定的东西.

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

这样做的最佳方法是什么?是否有任何库已经这样做了,我是否需要形成自己的 HTTP 请求?

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

推荐答案

我最终使用了位于 http: 的库://www.local-guru.net/blog/pages/rubycaldav

我必须使其与 SSL 配合使用,并正确使用 UUID 库,正确设置日期格式并处理全天事件.因为我只需要创建和销毁事件,这就是我更新的全部内容.我计划在我有时间的时候做更多的事情.

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.

可以在此处https://github.com/loosecannon93/ruby-caldav找到我更新的代码.

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

我遇到的问题是提供格式不正确的日期,并且缺少 UUID.

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

GitHub 上的 caldavtest.rb 文件是我以前工作的

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

我遇到的另一个复杂问题是 Zimbra(服务器)有 2 个路径,一个用于只读 /home/user@host/Calender 的 ICS 文件,另一个用于 CalDAV /dav/user@host/Calendar

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.

然而,Ruby 严重缺乏 cladav 实现.有形成对象的 ICS 库,但只有纯 Net::HTTP 与服务器交互.Local-guru's 是我发现的唯一一种可以双向使用的 ruby​​ 工具,但它需要一些小问题的帮助.

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.

这篇关于如何从 Ruby 与 CalDAV 服务器交互?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆