有没有人知道从Rails应用程序导出事件到iCal,Google Calendar,Outlook的任何宝石/插件/教程? [英] Does anyone know any gems/plugins/tutorials related to exporting events to iCal, Google Calendar, Outlook from a Rails application?
问题描述
我试图弄清楚是否已经有一个插件与iCal的互动,Google API可以使用,或者我需要让我的手变脏,自己写。
I am trying to figure out if there is already a plug in that does the interaction with iCal, Google APIs that I can use or do I need to just get my hands dirty and write it myself.
如果有人知道我可以看到的很好的资源可以帮助我执行,那也是很好的。
If anyone knows of good resources that I can look at that could help me with the implementation, that would be good as well.
我是RoR的新手,我一直在试图学习一段时间。我终于决定开始玩自己的应用程序,而不仅仅是跟着一本书。
I am new to RoR and I have been trying to learn it for a while. I finally decided to just start playing with my own application rather than just following a book.
在这件事上的任何帮助都不胜感激。
Any help in this matter would be appreciated.
谢谢!
推荐答案
查看 Google日历宝石栏。它允许您在rails应用程序中显示用户的Google日历,并显示示例代码片段,显示如何将事件导出到Google日历中:
Check out the Google Calendar gem for rails. It lets you display a user's Google Calendar in your rails app and they have sample snippets showing how to export events to Google Calendar:
require 'googlecalendar'
g = GData.new
g.login('REPLACE_WITH_YOUR_MAIL@gmail.com', 'REPLACE_WITH_YOUR_PASSWORD')
event = { :title=>'title',
:content=>'content',
:author=>'pub.cog',
:email=>'pub.cog@gmail.com',
:where=>'Toulouse,France',
:startTime=>'2007-06-06T15:00:00.000Z',
:endTime=>'2007-06-06T17:00:00.000Z'}
g.new_event(event)
对于iCal,使用 iCalendar gem ,然后可以按如下方式导出事件:
For iCal, use the iCalendar gem and then you can export events as follows:
require ‘icalendar’
class EventController < ApplicationController
def export_events
@event = Event.find(params[:id])
@calendar = Icalendar::Calendar.new
event = Icalendar::Event.new
event.start = @event.dt_time.strftime("%Y%m%dT%H%M%S")
event.end = @event.dt_time.strftime("%Y%m%dT%H%M%S")
event.summary = @event.summary
event.description = @event.description
event.location = @event.location
@calendar.add event
@calendar.publish
headers['Content-Type'] = "text/calendar; charset=UTF-8″
render_without_layout :text => @calendar.to_ical
end
end
这篇关于有没有人知道从Rails应用程序导出事件到iCal,Google Calendar,Outlook的任何宝石/插件/教程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!