/examples/rubyurl.rb
http://github.com/jnunemaker/httparty · Ruby · 14 lines · 11 code · 3 blank · 0 comment · 0 complexity · 3a50efb796c7bb2db94fe63b8536b0b5 MD5 · raw file
- dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
- require File.join(dir, 'httparty')
- require 'pp'
- class Rubyurl
- include HTTParty
- base_uri 'rubyurl.com'
- def self.shorten(website_url)
- post('/api/links.json', query: { link: { website_url: website_url } })
- end
- end
- pp Rubyurl.shorten('http://istwitterdown.com/')