Project

shortie

0.0
No commit activity in last 3 years
No release in over 3 years
Shortie makes it easy to shorten URLs with any service.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.1.3
 Project Readme
== About Shortie
Shortie makes it easy to shorten URLs with any service directly from your Ruby applications.

== Installing Shortie
$ sudo gem install shortie

== Using Shortie
Require Shortie:
  require 'rubygems'
  require 'shortie'

In your Ruby code, to shorten a URL:
  Service.find_by_key("bitly").shorten("http://github.com")

To get a list of all services:
  Service.all.each { |s| puts s.key + ": " + s.name}

== How to make your own shortener
Take a look at the shorteners in lib/shortie/shorteners to see how a shortener is made.
Basically it's just doing it like this:

module Shortie
  module Shorteners
    class Bitly < BaseShortener
      def shorten
        # communicating with bit.ly.
        return url
      end
    end
    Service.register("bitly", "bit.ly", Bitly)
  end
end

After creating a new shortener please send me a pull request and I'll implement your shortener as soon as possible.

== Using Shortie on other platforms than Ruby
You can use Shortie as a service at http://shortservice.lassebunk.dk. Take a look at http://shortservice.lassebunk.dk/api for info on how to use the API.