Upcoming.org Ruby Library
This library provides an interface to upcoming.org for the Ruby programming language. It was created by Derek Greentree. Before messing around with it, you might want to look at the API docs and get yourself an API key so that you can access the database from whatever crazy thing you cook up.
Download it: upcoming_ruby-0.3.zip
Here’s a short example of how to use the library (copied from here):
require 'upcoming/upcoming'
# substitute your values here
apiObj = Upcoming::Upcoming.new('api-key', 'auth_token')
# get a list of countries
countryList = apiObj.getCountryList
# find the US
unitedStates = countryList.find { |country| country.name == 'United States' }
# get a list of states
stateList = apiObj.getStateList(unitedStates.id)
# find Colorado
colorado = stateList.find { |state| state.name == 'Colorado' }
# get list of metros
metroList = apiObj.getMetroList(colorado.id)
# iterate through the list and print names
metroList.each { |metro| puts metro.name }
Results:
Boulder
Colorado Springs
Denver
Estes Park
Here’s a changelog:
Changelog: 0.3 (6/4/06): * removed username/password auth, replaced with token-based auth * added cache mechanism to call.rb * added UpcomingCache model for Ruby on Rails * added support for geolocation arguments and attributes * moved object defs into a new file (datatypes.rb)
December 18th, 2006 at 3:54 pm
Where exactly is the best place to put the unzipped upcoming folder in a Rails app? Inside lib?
January 28th, 2007 at 7:11 am
Casey, yes i think so. Derek Greentree’s site seems to be down at the time of writing.
April 24th, 2008 at 2:50 pm
Hi guys,
The old blog URL you have linked here isn’t valid anymore - if you’re interested it’s now http://blog.leftwise.com/. Anyhow, anything I had listed about this package at my website is now obsolete, and Dan’s version is what you should refer to.