Source code | RDoc | Ruby Gem
Simple, easy to use GData API that supports OAuth, Ruby 1.8/1.9 and uses Typhoeus as an HTTP client.
gem install gdata_plus
Start by getting the client from the authenticator (see Authentication below).
client = authenticator.client
Then make a request.
response = client.get("https://picasaweb.google.com/data/feed/api/user/default")
Then parse the response using your preferred XML library. I’ll use Nokogiri for this example.
feed = Nokogiri::XML(response.body) album_titles = feed.xpath("//xmlns:entry/xmlns:title/text()").collect {|i| "#{i}"}
If you need more control over the request, then you can create your own Typhoeus request and submit it to the client.
request = Typhoeus::Request.new(...) client.submit request
OAuth and ClientLogin are supported. OAuth is preferred for web apps and ClientLogin is convenient for installed apps and command-line utilities.
Before using OAuth, you will need to register your domain and get a consumer key and consumer secret from Google. See the OAuth example for getting started with OAuth.
If you already have an access token and access token secret, then you can construct an OAuth authenticator as follows:
GDataPlus::Authenticator::OAuth.new( :consumer_key => CONSUMER_KEY, :consumer_secret => CONSUMER_SECRET, :access_token => access_token, :access_secret => access_secret )
See the ClientLogin example.
Both the OAuth and ClientLogin authenticators can be serialized using a method like to_yaml.
TODO
This project is tested against Ruby 1.8.7 and Ruby 1.9.2. There is an issue with international characters and OAuth that affects Ruby 1.8.7.
This project is actively maintained. Please submit an issue if you find any bugs or want to request a new feature. Contributions are welcome. Please run the tests with Ruby 1.9.2 and 1.8.7 before submitting a pull request:
rake test
Copyright © 2010 Brian Alexander. See LICENSE.txt for further details.