Using With HTTParty

Blog Projects
ruby estonia

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

require 'rubygems'
require 'httparty'

class Shrtst
  include HTTParty
  base_uri ''

  def self.shorten(url)
    get( '/1.0/p/' + url)

puts Shrtst.shorten('')

Hey Usual. How can I access this via API?

When asking a question include an URL to example page where the problem occurs. Even better is to make a Fiddle which demonstrates the problem. If you have longer code examples please use