Method: Codebot::Shortener::Custom#shorten_url
- Defined in:
- lib/codebot/shortener.rb
#shorten_url(url) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/codebot/shortener.rb', line 31 def shorten_url(url) return url if url.to_s.empty? res = Net::HTTP.post_form @shortener_url, 'url' => url.to_s, 'secret' => @shortener_secret res.body.strip || url.to_s rescue StandardError url.to_s end |