Module: Unshortme
- Defined in:
- lib/unshortme.rb
Constant Summary collapse
- API_URL =
'http://api.unshort.me'
Class Method Summary collapse
Class Method Details
.unshort(url) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/unshortme.rb', line 7 def self.unshort(url) begin response = RestClient.get API_URL, {:params => {'r' => url, 't' => 'json'}} response = JSON.parse(response) if response.code == 200 if response['success'] == "true" unshorted = response['resolvedURL'] else raise Exception.new("Not unshorted") end rescue Exception => ex unshorted = url end end |