Library for creating a short url
Add this line to your application's Gemfile:
gem 'shortinator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install shortinator
Shortinator.store_url = "mongodb://<url to server>"
Shortinator.host = "http://sho.rt"
Can also be set with SHORTINATOR_STORE_URL
and SHORTINATOR_HOST
environment variables.
Shorten a URL and tag it
shortened_url = Shortinator.shorten("http://company.com/a/very/long/url", "daily_update")
Track a click on a url along with some arbitrary params
Shortinator.click(id, { :ip => "123.34.56.67" })
This operates with companion project https://github.com/adambird/shortinator-web to provide the redirect
- Fork it ( https://github.com/adambird/shortinator/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request