Print

Print


Josh, 

A nice job. I like how you integrated the hours in your homepage, too. 
For people who did not see it: https://library.ucmo.edu/

I helped a friend upgrading a hours calendar to API v3 from API v2 last night. The major difference between v2 and. v3 is the returned data is changed from Atom feed to JSon, in addition to the requirement of OAuth authorization. I added OAuth code (following the Google's example) first. Then, I changed a few lines and property names in the listEvents function to parse the data correctly. 

This is what I came up with. The source code is written in JavaScript.
http://bit.ly/nwlivecalendar (see the libhours.js file in the source code)

Sarah Park

-----Original Message-----
From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of Joshua Welker
Sent: Wednesday, November 19, 2014 8:39 AM
To: [log in to unmask]
Subject: Re: [CODE4LIB] Library Hours Fail

I have a solution running that is compatible with API V3 but it is pretty specific to Ruby on Rails. The idea is to use Google's iCal interface rather than the API. iCal is going to stay the same no matter how many iterations the API goes through. You basically just need to find an iCal parsing library for whatever language you are using. The only problem is that Google does a bad job with exceptions to recurrence rules (rrules). Instead of editing a single event in a repeating series, you have to delete that event and re-add it as a separate event.

https://gist.github.com/jswelker/04997f378d9bc02311d2

In this example, I have a MySQL table listing several Google Calendars and the URL given for their iCal files in the calendar settings page. It loops through each calendar, fetches the iCal, parses it, and saves the resulting hours to a separate Events table. This might be more complicated than people are wanting.

Josh Welker


-----Original Message-----
From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of Heller, Margaret
Sent: Tuesday, November 18, 2014 4:51 PM
To: [log in to unmask]
Subject: Re: [CODE4LIB] Library Hours Fail

Wish I had checked the list this morning, as I just discovered we had the same problem. We have been using Andrew Darby's method outlined here:
http://journal.code4lib.org/articles/46.

Is there by any chance someone using this method who happened to know the V2 API was being deprecated who already updated their app to V3?

If not anyone who wants to work on getting this to work tomorrow?

Margaret Heller
Digital Services Librarian
Loyola University Chicago
773-508-2686

-----Original Message-----
From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of Mary E. Hanlin
Sent: Tuesday, November 18, 2014 8:19 AM
To: [log in to unmask]
Subject: [CODE4LIB] Library Hours Fail

Hi All,

I know this has been covered a bit here, but I have a rather exigent conundrum, and I'm hoping to figure out the best/easiest solution.
Yesterday, the script to hour library hours (on our front page) which pulls from Google calendar stopped working ("Error at line undefined in undefined[!]" - the exclamation point is mine; it seemed like it needed
one.)

Basically, the code came from a site that walked one through how to call daily hours (javascript) using Google's V2 API, but the V2 is fully deprecated (as I abruptly discovered), and I need to figure out another solution.  (I haven't been able to find similar documentation for V3's API.)

Some constraints: 1. Our IT will not support php.    We are an .NET shop
with IIS servers.  2. We may not have the dough to pay for something like LibCal which seems to me the easiest solution.  3.  I'm semi-new to this "Internets/webmaster" thing, and really only know front-end coding, so a solution involving something like .NET, Python, etc. would have to have, "How to make a peanut butter sandwich," kind of documentation.

Right now, I've just manually coded our hours, which is fine until Saturday when our hours change, and I'm not here (hopefully).  I will be super grateful for insight or knowledge.

Mary.

Mary Hanlin
Electronic Resources and Web Librarian
J. Sargeant Reynolds Community College
Phone:804.523.5323
Email: [log in to unmask]