[英]Does anyone know any gems/plugins/tutorials related to exporting events to iCal, Google Calendar, Outlook from a Rails application?
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. 我试图弄清楚是否已经插入了与iCal的交互,我可以使用的Google API,或者我需要自己动手并自己编写。
If anyone knows of good resources that I can look at that could help me with the implementation, that would be good as well. 如果有人知道我可以看到的好资源可以帮助我实现,那也会很好。
I am new to RoR and I have been trying to learn it for a while. 我是RoR的新手,我一直试图学习它。 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. 任何有关此事的帮助将不胜感激。
Thanks! 谢谢!
Check out the Google Calendar gem for rails. 查看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:
它允许您在rails应用中显示用户的Google日历,并且他们有示例片段,展示如何将事件导出到Google日历:
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)
For iCal, use the iCalendar gem and then you can export events as follows: 对于iCal,使用iCalendar gem ,然后您可以导出事件,如下所示:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.