GData4Ruby is a wrapper for the generic Google Data services, with support for using different authentication mechanisms
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 10 commits ahead of aunderwo:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



GData4Ruby is a full featured wrapper for the Google Data base API. GData4Ruby provides the ability to authenticate with GData using the ClientLogin method. The package also includes a base gdata object that can be subclassed to provide basic CRUD functions for all Google API service objects. Additionally, a basic ACL object is included for interacting with ACL feeds and setting access rules.

Author and Contact Information

GData4Ruby was created and is maintained by {Mike Reich}[] and is licenses under the LGPL v3. You can find the text of the LGPL here: Feel free to use and update, but be sure to contribute your code back to the project and attribute as required by the license.

OAuth support was added by edave



GData4Ruby has three major components: the service, the GData object and the AccessRule object. Each service represents a google account, and includes a username (email) and a password. You can use the GData service to authenticate either a google account or a google apps account. There are currently two types of services, Service, and OAuthService.

Service uses Google's older AuthSub authentication mechanism, which is easier to setup, but requires you always know the username/password. (called Service to maintain backwards compatibility, but don't be confused, the base "Service" class is named Base)

OAuthService uses Google's newest authentication mechanism, OAuth, which is an OpenID-esque login system.

See Google's Getting Started for more info on which mechanism is best for you. In general, it will likely be easiest to experiment with GData4Ruby using AuthSub and then switch to OAuth for any actual usage in your web app, etc.

The GData object provides a base class for interacting with Google API objects, i.e. Documents, Events, etc. The GData object contains common attributes present in all Google API objects, and provides interfaces for basic CRUD functions. This class is meant to be subclassed.

The AccessRule object provides a base class for interacting with Google Access Control Lists. ACLs provide the main permissions mechanism for most Google API services.


Below are some common usage examples. For more examples, check the documentation.


  1. Authenticate service = service.authenticate({:username => "", :password => "password", :service => "cl"})

  2. Authenticate with a specified GData version service ={:gdata_version => '3.0'}) service.authenticate({:username => "", :password => "password", :service => "cl"})


You will need an OAuth Token for authenticating for any given user. If you are using Rails, OAuth Plugin makes this fairly easy for users to grant access to your application and generate OAuth Tokens.

Once you have a token, authenticating is simple:

service =
my_oauth_token = # you will need to generate your own OAuth::Token

Base Options

GData4Ruby supports several options which are passed to any service (Base, Service, OAuthService) upon initialization using a hash

Enable SSL:

my_generic_service ={:use_ssl => true})

Enable Debug Logging:

my_generic_service ={:debug => true})

Disable checking whether the objects are publicly accessibly. This can significantly speed up the service, but also leaves you at risk of trying write to Google services which you do not have privileges. In many cases, you can disable this option.

my_generic_service ={:check_public => false})