Archive for the 'Pet Projects' Category

Seabourne Consulting

A lot’s been happening in my world recently, including starting my own IT/Web consulting company, Seabourne Consulting.  seabourneconsulting2The focus of this company is to develop and implement web sites that allow companies to work more effectively and efficiently from any location.  Our expertise is in Ruby on Rails, Qt, C++, Joomla! CMS and Adobe Flex.  We’ve got a bunch of really cool applications in the works, and already have 3 client projects under way.  If you are interested in our services or in talking about a project, contact us here.

Using Google Calendar API in Ruby on Rails

Update: I’ve got a new Ruby Gem that improves upon the functionality described below.  Check it out here.

Update 2: Rewrote this article to use GCal4Ruby.

A new project of mine involves project managment and milestones.  One feature I was interested in was natively integrating the Rails app with Google Calendar so that the milestone information would be available to anyone who wanted to subscribe to it.  I looked around and found a couple of google calendar integration libraries, but suprisingly there isn’t a fully implemented GData API that allow access to all the features of the Google Calendar API.

  • Google Calendar: a pretty simple and full featured google calendar library in ruby, with optional Rails plugin.  A good option for anyone who’s interested in accessing or exporting Google Calendars into HTML or Excel.  Though the Event support is excellent, my application needed finer grained control over multiple calendars under each user, and this library didn’t include the functions to determine calendars programmatically.
  • GCalAPI: also a good and simple API for Google Calendar, though it provided a better interface for finding calendars associated with a user account.  Unfortunately, the documentation is a little lacking, and there was no built in way to create a new calendar.  But, I ended up using this library despite the drawbacks.

These are two very good libraries, but haven’t been updated in a couple of years, and were missing some key pieces of functionality that I wanted.  So, I’ve created a new Ruby library (available as a Gem) called GCal4Ruby that implements all of the major features of the GCal API, including recurrence, attendees and reminders.  One of the main improvements in GCal4Ruby over the other two libraries is that you don’t have to remember the ‘feed’ urls for Google; all that is handled transparently for you.  This article describes how to use GCal4Ruby to interact with Google Calendars through Ruby on Rails.  Be sure to read the documentation for all available functions and features.

Setup
Setting up the GCal4Ruby gem is straightforward: just install it using sudo gem install gcal4ruby or by adding gem.config ‘gcal4ruby’ line to your Rails project environment.rb file. Then, all you need to do is run rake gems:install to install the gem through rails.

My application includes a ‘project’ model and a ‘milestone’ model.  Each project has a unique google calendar associated with it, though they all appear under one account.  You can either use a Google Gmail account for this, or you can your own Google Apps account if you have one.  You’ll probably want to add your username and password to the environment.rb file as static constants for reference later.

Creating a Calendar
The one thing that the GCalAPI library can’t do by default is create a calendar programmatically.  GCal4Ruby includes the ability to do this.  Here’s how to create a new public calendar from within a Calendar model in Rails:


#Step 1: Setup feed url and create account service using constants
service = GCal4Ruby::Service.new
service.authenticate(GOOGLE_LOGIN, GOOGLE_PASS)

#Step 2: Create a new calendar
calendar = GCal4Ruby::Calendar.new(service)
calendar.title = self.title # tile = 'A New Calendar'
calendar.summary = self.description
if calendar.save
 return true
else
 return false
end

#Step 3: Make the calendar publicly available
calendar.public = true

Adding an Event
Adding an event is straightforward.  Basically, its a three step process:

  1. Authenticate and load your Google Calendar Account
  2. Load the specific calendar you’d like to work with
  3. Construct and add your event to the selected calendar

I added this code to the milestone model which is within the save method.  Here’s the basic code for accomplishing the three steps outlined above:

#Step 1: Setup feed url and create account service using constants
service = GCal4Ruby::Service.new
service.authenticate(GOOGLE_LOGIN, GOOGLE_PASS)

#Step 2: Load calendar data for the calendar associated with the project
calendar = GCal4Ruby::Calendar.find(service, 'A Test Calendar', :first)

#Step 3: create a new event and save
event = GCal4Ruby::Event.new(calendar)
event.title = self.title
event.content = self.description
event.where = "N/A"
event.start = self.start_date
event.end = self.end_date || self.start_date
event.all_day = self.all_day_event
if !event.save
  return false
end

Notes/Tasks 1.0 Beta 1 Released!

The first beta version of the 1.0 release of Notes/Tasks is now available.  You can download it here (via Sourceforge)

Notes/Tasks v 0.9 Released – Now Multi-platform!

I’ve been working way too much and haven’t had as much time as I would like to update the ol’ blog.  However, I’ve had a bunch of down time recently, and my cooking and coding has greatly increased, so keep your eyes peeled for a bunch of new posts.  What have I been working so hard on, you may ask?  

The latest version of Notes/Tasks.  As of this latest release, version 0.9, Notes/Tasks leverages the multi-platform capabilities of QT and is available for Linux, OS X and Windows.  We’ve made a lot of improvements, and this will be the last release before the version 1.0 release candidates.  So, check it out by downloading the app and registering at notestasks.com to synch and access your notes from anywhere, anytime.

Notes/Tasks Version 0.8 Released

I’ve released the latest version of Notes/Tasks, version 0.8, my Qt application for note and task management.  Notes/Tasks provides a powerful and simple tool for note and task management.

In this latest release, I’ve added the ability to synchronize your notes and tasks with notestasks.com – you can access your notes from anywhere.  There is also a special mobile interface for iPhones!  Also new is AES encryption for you data, adding security for sensitive information.

Check it out and let me know what you think!