Using Shrt.st With HTTParty
12 March 2010
I recently evaluated bunch of Ruby libraries for consuming webservices. One I liked most is is HTTParty. Love the syntax and elegance. Here is how you would shorten an URL with my favourite URL shortener shrt.st:
require 'rubygems'
require 'httparty'
class Shrtst
include HTTParty
base_uri 'api.shrt.st'
def self.shorten(url)
get( '/1.0/p/' + url)
end
end
puts Shrtst.shorten('http://www.appelsiini.net/')
Hey Usual. How can I access this via API?
