Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Url Shortener ruby library / gem is an API wrapper for bit.ly to shorten the urls.
Ruby Cucumber
Tag: 0.0.3

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
features
lib
spec
History.txt
Manifest.txt
README.rdoc
url_shortener.gemspec

README.rdoc

Description

Url Shortener is a Ruby library / gem and API wrapper for bit.ly to shorten the urls.

To use the url_shortener gem you need a bit.ly login and Api key.

  • If you are registered at bit.ly then you already have it.

  • If you are not registered then you can get it easily by registering at bit.ly as they give an api key to every registered user

USAGE

To Shorten Urls

  • authorize = UrlShortener::Authorize.new 'your_bitly_login', 'your_bitly_api_key'

  • For example; authorize = UrlShortener::Authorize.new 'bitlyapidemo', 'R_0da49e0a9118ff35f52f629d2d71bf07'

  • client = UrlShortener::Client.new authorize

  • results = client.shorten('www.yahoo.com') # => Hash containing short url

  • results['shortUrl'] # => short url string

OR

To Expand Urls

  • result = client.expand(:shortUrl => 'bit.ly/1RmnUT') # => long url string

OR

  • result = client.expand(:hash => '2bYgqR') # => long url string

To get stats

  • result = client.stats(:shortUrl => 'bit.ly/1RmnUT') # => long url string

OR

  • result = client.stats(:hash => '2bYgqR') # => long url string

To get url info

  • result = client.info(:shortUrl => 'bit.ly/1RmnUT') # => long url string

OR

  • result = client.info(:hash => '2bYgqR') # => long url string

Docs

rdoc.info/projects/nas/url_shortener

Tests

Tests are written using RSpec and Cucumber. Integration tests use bit.ly demo login and api key credentials.

LICENSE:

(The MIT License)

Copyright © 2009 Nasir Jamal

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.