Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .settings
Octocat-spinner-32 grails-app
Octocat-spinner-32 test
Octocat-spinner-32 .classpath
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .project
Octocat-spinner-32 BitlyShortenerGrailsPlugin.groovy
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.md
Octocat-spinner-32 application.properties
README.md

What's this?

This is a grails plugin that is a wrapper for bitly.com shorten API method. To short urls.

Installation

grails install-plugin bitly-shortener

Configuration

In Config.groovy should be configured login, apiKey; and optionally the custom domain (may be your own domain if you have a premium account).

bitly.login = "danilat"
bitly.apiKey = "R_FooBar"
bitly.domain = "j.mp" //optional

How to

There are 2 grails grails artifacts, a service bitlyService:

def shortened = bitlyService.shorten("http://www.danilat.com")
shortened.statusCode // 200 if all is ok, error code if not.
shortened.statusText // "OK" if all is ok, error message if not.
shortened.url // The shortened url if all is ok.

A taglib bitly:shorten:

${bitly.shorten(url:'http://www.danilat.com')}
<bitly:shorten url="http://www.danilat.com"/ >
Something went wrong with that request. Please try again.