PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/examples/rubyurl.rb

http://github.com/jnunemaker/httparty
Ruby | 14 lines | 11 code | 3 blank | 0 comment | 0 complexity | 3a50efb796c7bb2db94fe63b8536b0b5 MD5 | raw file
 1dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
 2require File.join(dir, 'httparty')
 3require 'pp'
 4
 5class Rubyurl
 6  include HTTParty
 7  base_uri 'rubyurl.com'
 8
 9  def self.shorten(website_url)
10    post('/api/links.json', query: { link: { website_url: website_url } })
11  end
12end
13
14pp Rubyurl.shorten('http://istwitterdown.com/')