Googlecalendar 1.0.0

Ruby api and Rails plugin for Google Calendar

Googlecalendar - get latest version: 1.0.0.

Googlecalendar – Examples

Adding an Event

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)

Quick Add

require 'googlecalendar'
g = GData.new
g.login('REPLACE_WITH_YOUR_MAIL@gmail.com', 'REPLACE_WITH_YOUR_PASSWORD')
g.quick_add('Tennis with John December 03 3pm-4:30pm')

Text export

require 'googlecalendar'
require 'googlecalendar_builders'
data = scan '/calendar/ical/french@holiday.calendar.google.com/public/basic'
calendar = parse data
text calendar, 'output/results.txt'

Html export

require 'googlecalendar'
require 'googlecalendar_builders'
data = scan '/calendar/ical/french@holiday.calendar.google.com/public/basic'
calendar = parse data
html calendar, 'output/results.html'

Atom Parsing

require 'googlecalendar'
require 'rexml/document'
include REXML

def get_calendar_titles(atom)
  XPath.match(atom, "/feed/entry/title") 
end

g = GData.new
g.login('REPLACE_WITH_YOUR_MAIL@gmail.com', 'REPLACE_WITH_YOUR_PASSWORD')
dog = g.get_calendars()
atom = Document.new dog.body
get_calendar_titles(atom).each { |node| puts node.text }

New Event using not default calendar

require 'googlecalendar'
g = GData.new
token = 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, 'my_NOT_default_calendar')

Proxy parse

Where ‘xxx.xxx.xxx.xxx’ is the proxy address

require 'googlecalendar'
def proxy_parse
  data = scan_proxy('xxx.xxx.xxx.xxx', 3128, french_holidays)
  calendar = parse data
end

proxy_parse

XXX

Other examples

Take a look at http://googlecalendar.rubyforge.org/svn/trunk/googlecalendar/examples/ruby_standalone/