/acts_as_bitly_url

Mapper for Shortlinking the Bit.ly API

Primary LanguageRubyMIT LicenseMIT

Intro

based on acts_as_tiny_url by Brendan G. Lim (brendangl@gmail.com)

Description

ActsAsBitlyURL utilizes Bit.ly’s API to allow you to pass in any URL and have it generate a shortened URL on the fly.

By default you can use the +bitly_url()+ method in all your controllers, views and models.

Options

The :validate_uri option allows you to check, before trying to retrieve a URL, whether or not it is formatted correctly.

Example Usage

bitly_url("http://google.com")			
# returns http://bit.ly/da7vQs

bitly_url("http://brendanlim.com", :validate_uri => true)
# returns true

bitly_url("http/brendanlim.com", :validate_uri => true)
# returns false

Copyright © 2008 Max Schulze (max@maxschulze.com), released under the MIT license