Class: Google::Expander
- Inherits:
-
Object
- Object
- Google::Expander
- Defined in:
- lib/google_url_shortner.rb
Instance Attribute Summary collapse
-
#long_url ⇒ Object
Returns the value of attribute long_url.
-
#short_url ⇒ Object
Returns the value of attribute short_url.
Instance Method Summary collapse
-
#initialize(short_url = "") ⇒ Expander
constructor
A new instance of Expander.
Constructor Details
#initialize(short_url = "") ⇒ Expander
Returns a new instance of Expander.
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/google_url_shortner.rb', line 52 def initialize( short_url="" ) return nil if !short_url.blank? rep = Request.get("/urlshortener/v1/url?shortUrl=#{short_url}") if rep.code == 200 self.long_url = rep['longUrl'] self.short_url = short_url else rep.response end end |
Instance Attribute Details
#long_url ⇒ Object
Returns the value of attribute long_url.
51 52 53 |
# File 'lib/google_url_shortner.rb', line 51 def long_url @long_url end |
#short_url ⇒ Object
Returns the value of attribute short_url.
51 52 53 |
# File 'lib/google_url_shortner.rb', line 51 def short_url @short_url end |