Giter Site home page Giter Site logo

trim's Introduction

Trim

Description

The trim gem is a wrapper for the tr.im URL shortening service, which can be found at tr.im/

This software is not affiliated with tr.im in any way. tr.im is a product of The Nambu Network: www.nambu.com/.

Installation

First, if you do not already have GitHub in your gem sources, execute the following command to add it:

sudo gem sources -a http://gems.github.com

Then you can install this gem with:

sudo gem install svenaas-trim

If you prefer not to add GitHub to your gem sources, install via:

sudo gem install svenaas-trim -s http://gems.github.com

Windows users should omit the sudo, of course.

Usage

require 'trim'

Trim.trim('http://www.google.com') # Returns trimmed URL, or nil if any error occurs

If you want to use an account that tr.im knows about you can provide your valid username and password:

Trim.trim('http://www.google.com', 'username', 'password')

NOTE: as of this writing (3 Mar 2009) tr.im does not support SSL so this username and password will be sent over unencrypted HTTP.

Testing

The standard tests run via

rake test

use mock code to verify functionality instead of depending on online interaction with tr.im’s servers. This is done for several reasons, primarily because the service provider deserves this basic consideration, but also because tr.im limits the number of URLs which can be shortened during a particular amount of time.

If you need to verify online functionality you can run

rake test:online

for simple-case testing that the servers are reachable via the expected address and API. Please note that this test consumes online resources, and use it sparingly.

License

Copyright © 2009 Sven Aas

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.

trim's People

Contributors

svenaas avatar

Stargazers

Angus H. avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.