From fbc032677c3b7da52c5ce3e86cc2194a016a9933 Mon Sep 17 00:00:00 2001 From: simple Date: Mon, 6 Apr 2015 17:19:53 +0200 Subject: [PATCH] Fix calender. Events that are to old are filtered now. --- app/services/google_calendar.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/services/google_calendar.rb b/app/services/google_calendar.rb index 21f350f..179e7dc 100644 --- a/app/services/google_calendar.rb +++ b/app/services/google_calendar.rb @@ -62,7 +62,13 @@ class GoogleCalendar end def request_url - "#{BASE_URL}/#{@id}/#{@endpoint}/?key=#{ENV['GOOGLE_API_KEY']}" + #The default number of events pulled is 250. + #We reached that number and events didn't show any more. + #So now I filter all events that have a start time + #that is longer ago then 7 days. + #Alternative: maxResults=2500 + time_min = (Time.now - 7.days).utc.iso8601 + "#{BASE_URL}/#{@id}/#{@endpoint}/?key=#{ENV['GOOGLE_API_KEY']}&timeMin=#{time_min}" end end