GoogleCalendar.cfc Version 0

I’ve attached to this entry the first version of the GoogleCalendar.cfc. There is no documentation yet so use at your own risk. What it does:

  • ReadEntries will return a query of events. Most of the columns should be obvious.
  • ReadMeta returns the meta information about the calendar. What you care about is the title field.
  • XML is cached so a HTTP call is only done once. I may also add caching of the entry data since it doesn't make sense to parse it N times. </ul> What it does not yet do:
    • Translate times to the right timezone. To make this work, I think I'm going to require folks to send to ReadEntries their GMT offset.
    • Translate recurrence. This will be done, and will be sweet. It's going to be a nice string like "Daily", "Yearly", etc.
    • Add entries.
    • Simple way to force a refresh of the cache. </ul> I've included a test script that read US Holidays. Very, very important note. The Google Calendar API lets you tweak how much data is returned. The default URL for your private calendar ends in "basic". You must change this to "full". Look at my test script for an example. I may end up making a basic check for this so folks don't forget. Here is an example of how the API is used: <cfapplication name="gCal"> <cfset reload = true> <cfif not structKeyExists(application, "gCal") or reload> <cfset application.gCal = createObject("component", "GoogleCalendar").init("long as heck url here/full")> </cfif> <cfset r = application.gCal.readEntries()> <cfdump var="#r#"> <cfset m = application.gCal.readMeta()> <cfdump var="#m#">

      Download attached file.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments