class UrlExpander::Expanders::Isgd
Expand Isgd
URLS Usage: UrlExpander::Client.expand
(“is.gd/wsJRhR”)
Constants
- PATTERN
NOTICE: We ignored the / before the key is.gd/wsJRhR => 'wsJRhR' without /
Attributes
parent_klass[R]
Public Class Methods
new(short_url, options={})
click to toggle source
Calls superclass method
UrlExpander::Expanders::API::new
# File lib/url_expander/expanders/api/isgd.rb, line 16 def initialize(short_url, options={}) @parent_klass = self super(short_url,options) fetch_url end
Private Instance Methods
fetch_url()
click to toggle source
# File lib/url_expander/expanders/api/isgd.rb, line 31 def fetch_url data = JSON.parse Request.get("/forward.php?format=json&shorturl=http://is.gd/#{@shortner_key}").response.body unless(data["errorcode"]) @long_url = data["url"] else raise UrlExpander::Error.new(data['errormessage'],data['errorcode']) end end