example/ol2gcal.rb in gcalapi-0.0.3 vs example/ol2gcal.rb in gcalapi-0.0.4

- old
+ new

@@ -1,10 +1,10 @@ +require "rubygems" require "googlecalendar/calendar" require "win32ole" require "nkf" - # google calendar Feed URL FEED_URL = "http://www.google.com/calendar/feeds/XXXXXXXXXXXXXXXX@group.calendar.google.com/private/full" # email address EMAIL = "XXXXXXXXXX@gmail.com" # password @@ -35,15 +35,19 @@ @srv = GoogleCalendar::Service.new(EMAIL, PASS) @cal = GoogleCalendar::Calendar.new(@srv, FEED_URL) # Delete All Future Data Of Google Calendar now = Time.now -@cal.events(now, nil).each do |ev| ev.destroy! end +@cal.events(:'start-min' => now, :orderby => "starttime").each do |ev| + p ev if $DEBUG + ev.destroy! +end # Insert All Future Data Of Outlook @nstr = now.strftime("%Y/%m/%d %H:%M:%S") each_event do |oev| - if oev.Start > @nstr + if oev.End > @nstr + p oev.Subject if $DEBUG gev = @cal.create_event #NKF is used for japanese charcter code conversion gev.title = NKF.nkf("-w", oev.Subject) gev.where = NKF.nkf("-w", oev.Location) gev.st = Time.parse(oev.Start)