Skip to content

Instantly share code, notes, and snippets.

@rbazinet
Created June 6, 2013 12:10
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rbazinet/5721055 to your computer and use it in GitHub Desktop.
Simple Ruby class to shorten URLs using TinyURL.
class Tinyurl
include HTTParty
base_uri 'tinyurl.com'
def shorten(url)
self.class.get("/api-create.php?url=#{url}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment