puny

puny is a Ruby library for the URL shortener service created by SAPO

The puny URL service is available at puny.sapo.pt and it’s API at services.sapo.pt/Metadata/Service/PunyURL?culture=EN

The code is a translation of the Python library wrote by Celso Pinto and available at github.com/cpinto/punypie/tree/master

Features

  • shortens and expands URLs

  • no external dependencies

  • Ruby 1.8, 1.9 and JRuby compatible

Install

$ gem sources -a gems.github.com $ sudo gem install rubenfonseca-puny

Example

require 'puny'
puny = Puny.shorten('http://developers.sapo.pt')
puts puny.puny # see PunyURL for aditional properties

puts Puny.expand(puny.puny) # returns the original URL

Copyright © 2009 Ruben Fonseca. See LICENSE for details.