A Ruby gem that connects to various URL shortening services like RubyURL, moourl, etc.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
examples Fixed a syntax error. Mar 5, 2013
lib Removed the block and response_block ivars. Mar 8, 2013
spec Removed the block and response_block ivars. Mar 8, 2013
.gitignore Ignore the doc/ dir. Mar 4, 2013
.rspec Converted the test-unit tests to RSpec 2 tests. Mar 6, 2013
ChangeLog.txt Renamed ChangeLog to ChangeLog.txt. Mar 4, 2013
LICENSE.txt Renamed MIT-LICENSE to LICENSE.txt. Mar 4, 2013
README.rdoc Merge pull request #14 from postmodern/dead_services Mar 8, 2013
Rakefile Map test and default tasks to spec (issue #18). Mar 8, 2013
TODO.rdoc All files should have an extension. Mar 4, 2013
shorturl.gemspec Updated the gemspec. Mar 5, 2013

README.rdoc

ShortURL 1.0.0

Summary

ShortURL is a very simple library to use URL shortening services.

Installation

ShortURL is available as a gem, installation is just like any other gem: $ gem install shorturl

You can also download the tar.bz2 archive at rubyforge.org/frs/?group_id=732 if you do not want to use the gem.

Supported services

Here is the list of the services supported by ShortURL:

Usage:

call-seq:

require "shorturl"
puts ShortURL.shorten("http://mypage.com")
puts ShortURL.shorten("http://mypage.com", :moourl)

The second parameter represents the service you want to use. These are:

  • :tinyurl

  • :shorl

  • :snipurl

  • :metamark

  • :makeashorterlink

  • :skinnylink

  • :linktrim

  • :shorterlink

  • :minlink

  • :lns

  • :fyad

  • :d62

  • :littlink

  • :clipurl

  • :orz

  • :moourl

  • :urltea

  • :vurl

  • :bitly**

You can use ShortURL.valid_services to obtain a list of the valid services (in case I forget to update the documentation)

Bitly**


Their API changed to require an API key.

Two painfree steps to fix this.

1) Get yours easily right now from:

http://bitly.com/a/your_api_key

2) Save it in ~/.shorturl similar to this YAML template:

— Start of file ~/.shorturl —

---
bitly:
  username: O_adsfasdfasfasfd
  key: R_afasdfasdfasdf

— END of file ~/.shorturl —

You're done!  Have a martini.  Cheers.

Thanks

  • Marcel Molina Jr., Devin Mullins for some ideas

  • imperator from #ruby-lang (I don't know your real name, sorry) for helping me with creating and uploading a RubyGem

  • Daniel Dipaolo for telling me about ln-s.net and fyad.org

Authors

  • Vincent Foley (original developer)

  • Robby Russell <robbyrussell@gmail.com>