Skip to content

Instantly share code, notes, and snippets.

@boriscy
Created October 27, 2010 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boriscy/648863 to your computer and use it in GitHub Desktop.
Save boriscy/648863 to your computer and use it in GitHub Desktop.
Retrive events from google calendar
require "rubygems"
require "gcal4ruby"
class Time
def self.parse_complete(value)
if value =~ /^[0-9]+T[0-9]+$/
d, h = value.split("T")
Time.parse(d+" "+h.gsub("Z", ""))
else
Time.parse(value + " 00:00:00")
end
end
end
serv = GCal4Ruby::Service.new
puts "Email:"
email = gets
puts "Password:"
system "stty -echo"
password = gets
system "stty echo"
p "Procesando..."
serv.authenticate email, password
events = GCal4Ruby::Event.find serv, {:start_time => Time.now.utc.xmlschema,
:calendar => 'boriscyber%40example.com'}
events.each do |event|
puts event.title
puts event.attendees.join ", "
puts event.start_time
puts event.end_time
puts '-----------------------'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment