google-short-links

Ruby wrapper for Google Short Links.

Installation

To install Google Short Links, run

gem install google-short-links

To load the library, use

require 'google_short_links'

Or, with Bundler, add to your Gemfile

gem 'google-short-links', :require => 'google_short_links'

Examples

This example creates a new client, creates a hash

client = GoogleShortLinks::Client.new :server => 'short.example.com', :secret => 'abcdef1234567890', :email => 'ben@example.com'
link = client.get_or_create_hash 'http://example.com/parent/child/long_document_name.html', :is_public => true
link # => {"status"=>"ok", "url"=>"http://example.com/parent/child/long_document_name.html", "estimated_api_calls_remaining"=>98, "shortcut"=>"abc12", "usage_count"=>0, "owner"=>"ben@example.com", "is_public"=>true, "is_hash"=>true}
short_url = "http://short.example.com/#{link['shortcut']}" # => "http://short.example.com/abc12"

Copyright © 2011 Benjamin Manns. See LICENSE.txt for further details.