shorturl.cr v0.2.1

A tiny library to use URL shortening services

Releases:

  • v0.2.1 - June 22, 2018
  • v0.2.0 - December 26, 2015
  • v0.1.1 - September 21, 2015
  • 0.1.0 - September 20, 2015

Owner:

shorturl.cr Build Status

A simple library to use URL shortening services. Inspired by Robby Russell's shorturl.

Installation

As a dependency in shards.yml:

dependencies:
  shorturl:
    github: veelenga/shorturl.cr
    branch: master

Usage

As easy as it could be:

require "shorturl"

# shorten
ShortURL.shorten "http://google.com"           # => "http://tinyurl.com/2tx"
ShortURL.shorten "http://google.com", :tinyurl # => "http://tinyurl.com/2tx"
ShortURL.shorten "http://google.com", :isgd    # => "http://is.gd/OwycZW"

# expand
ShortURL.expand "http://tinyurl.com/2tx"       # => "http://google.com"

Binary

As an addition, shorturl binary available for you:

$ crystal build bin/shorturl && ./shorturl -h
Usage: shorturl [arguments]
    -u URL, --url=URL                URL to be shortened
    -s SERVICE, --service=SERVICE    Shortening service
    -V, --verbose                    Verbose output
    -v, --version                    Version
    -h, --help                       Prints this help

$ ./shorturl http://google.com
http://tinyurl.com/2tx

Available services

Here is a list of available shortening services in shorturl.cr:

Contributing

  1. Fork it
  2. Create your feature branch
  3. Implement your feature
  4. Run tests with crystal spec
  5. Commit your changes
  6. Push to the branch
  7. Create a new Pull Request
Github statistic:
  • 12
  • 0
  • 1
  • 0
  • 5 months ago

License:

MIT License

Links: