Skip to content

lassebunk/shortie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

== 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.

About

Shorten URLs with any service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages