Class: Mush::Services::Zaebz

Inherits:
Mush::Service show all
Defined in:
lib/mush/services/zaebz.rb

Instance Method Summary collapse

Methods inherited from Mush::Service

#authorize, #get, #post

Instance Method Details

#shorten(url) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/mush/services/zaebz.rb', line 6

def shorten(url)
  if url.empty? || url !~ %r(^https?://.+)
    raise InvalidURI.new("Please provide a valid URI")
  end

  post('/', { :url => url }).body.match(/href="(.+)"/)[1]
end