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 => '[email protected]'
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"=>"[email protected]", "is_public"=>true, "is_hash"=>true}
short_url = "http://short.example.com/#{link['shortcut']}" # => "http://short.example.com/abc12"
  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

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