Read my latest article: 8 things I look for in a Ruby on Rails app (posted Thu, 06 Jul 2017 17:59:00 GMT)

ShortURL on Github

Posted by Thu, 24 Jul 2008 15:56:00 GMT

After noticing a few patch requests on Rubyforge.. I decided that I’d put the ShortURL gem up on GitHub as I spend quite a bit of my time there these days. :-)

I’ve also thrown up a few lines of code so that you can get the gist of the gem. ;-)

ShortURL 0.8.4 released and gets a new mainainer... me!

Posted by Mon, 07 Jan 2008 00:49:00 GMT

Earlier today, Vincent Foley was kind enough to hand over maitenance of the the ShortURL project on RubyForge to me. He first released it back in 2005, which I blogged about as RubyURL was the first shortening service that it supported (and is the default). Unfortunately, the release of RubyURL 2.0 broke backwards compatibility and Vincent wasn’t maintaining it anymore. So, earlier, I decided to patch this and got a new version released that now works with the current RubyURL site.

While working on the code, I decided to extend the compatible services to include moourl and urlTea.

These updates are available in ShortURL version 0.8.4.

Install the ShortURL gem

Installation is a snap… (like 99.7% of rubygems…)


  ~ > sudo gem install shorturl                                                                                                                                                                                                           Password:

  Successfully installed shorturl-0.8.4
  1 gem installed
  Installing ri documentation for shorturl-0.8.4...
  Installing RDoc documentation for shorturl-0.8.4.  

Using ShortURL

The ShortURL gem provides the ShortURL library, which you can use from any Ruby application.

Using the ShortURL library


  ~ > irb                                                                                                                                                                                                                           
  irb(main):001:0> require 'rubygems'
  => true
  irb(main):002:0> require 'shorturl'
  => true
  irb(main):003:0> ShortURL.shorten( 'http://www.istwitterdown.com' )
  => "http://rubyurl.com/P9w" 

As you can see…it’s really straight forward.

Let’s try it with a few other services.


irb(main):004:0> ShortURL.shorten( 'http://www.istwitterdown.com', :moourl )
=> "http://moourl.com/fvoky" 
irb(main):005:0> ShortURL.shorten( 'http://www.istwitterdown.com', :tinyurl )
=> "http://tinyurl.com/2t3qmh" 

Using the shorturl command-line tool

Many people don’t know that ShortURL provides a command-line tool, which you can use after installing the gem.


  ~ > shorturl http://istwitterdown.com                                                                                                                                                                                               
  http://rubyurl.com/Lwk

If you’d like to see more services provided than the ones listed here, please submit feature requests and/or patches on the rubyforge project.

ShortURL Documentation

To see the latest documentation for the project, please visit:

My favorite part about this? My rbot plugin for RubyURL works again!

rbot and rubyurl
Uploaded with plasq’s Skitch!

Happy URL-shortening!