Sha256: e3c28d27b53454990c5266d9aceb28c09fe1b4aa98a7d2fa21b9d5f317ceaa9a

Contents?: true

Size: 395 Bytes

Versions: 6

Compression:

Stored size: 395 Bytes

Contents

dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require File.join(dir, 'httparty')

class Rubyurl
  include HTTParty
  base_uri 'rubyurl.com'

  def self.shorten(website_url)
    xml = post('/api/links.json', :query => {'link[website_url]' => website_url})
    xml['link'] && xml['link']['permalink']
  end
end

puts Rubyurl.shorten( 'http://istwitterdown.com/' ).inspect

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
jnunemaker-httparty-0.1.6 examples/rubyurl.rb
jnunemaker-httparty-0.1.7 examples/rubyurl.rb
jnunemaker-httparty-0.1.8 examples/rubyurl.rb
httparty-0.1.6 examples/rubyurl.rb
httparty-0.1.7 examples/rubyurl.rb
httparty-0.1.8 examples/rubyurl.rb