ruby-on-rails – 有没有人知道与Rails应用程序将iCal,Google日历,Outlook导出事件相关的任何宝石/插件/教程?

我试图弄清楚是否已经有一个插件与iCal的互动,我可以使用的Google Api,或者我需要让我的手变脏,并自己写.

如果有人知道我可以看到的很好的资源可以帮助我实施,那也是很好的.

我是RoR的新手,我一直在试图学习一段时间.我终于决定开始玩自己的应用程序,而不仅仅是一本书.

在这个问题上的任何帮助将不胜感激.

谢谢!

解决方法

查看 Google Calendar gem的轨道.它可以让您在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)

对于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

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...