shorturl

Version, currently 0.1.14 versions

github.com/veelenga/shorturl.cr

A tiny library to use URL shortening services

14 stars
0 dependents
License: MIT

Nothing has been indexed for 0.1.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  shorturl:
    github: veelenga/shorturl.cr
    version: ~> 0.1.1

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.1.1. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

# shorturl.cr [![Build Status](https://travis-ci.org/veelenga/shorturl.cr.svg?branch=master)](https://travis-ci.org/veelenga/shorturl.cr)

A simple library to use URL shortening services. Inspired by Robby Russell's [shorturl](https://github.com/robbyrussell/shorturl).

## Installation

As a dependency in `shards.yml`:

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

## Usage

As easy as it could be:

```crystal
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:

```sh
$ 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:

* [is.gd](http://is.gd)
* [shorl.com](http://shorl.com)
* [tinyurl.com](http://tinyurl.com)
* [v.gd](http://v.gd)

## Contributing

1. Fork it
1. Create your feature branch
1. Implement your feature
1. Run tests with `crystal spec`
1. Commit your changes
1. Push to the branch
1. Create a new Pull Request