Class: GooglApi::Response
- Inherits:
-
Object
- Object
- GooglApi::Response
- Defined in:
- lib/googl-api/response.rb
Instance Attribute Summary collapse
-
#analytics ⇒ Object
Returns the value of attribute analytics.
-
#created ⇒ Object
Returns the value of attribute created.
-
#id ⇒ Object
Returns the value of attribute id.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#longUrl ⇒ Object
Returns the value of attribute longUrl.
-
#raw ⇒ Object
Returns the value of attribute raw.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(args) ⇒ Response
constructor
A new instance of Response.
-
#long_url ⇒ Object
proive ruby like method for longUrl.
- #qr_code ⇒ Object
-
#short_url ⇒ Object
provide helper method for short url (returned as id).
Constructor Details
#initialize(args) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 10 11 12 13 |
# File 'lib/googl-api/response.rb', line 5 def initialize args # load valuse passed in hash args.each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end # retain the hash for further inspection self.raw = args end |
Instance Attribute Details
#analytics ⇒ Object
Returns the value of attribute analytics.
3 4 5 |
# File 'lib/googl-api/response.rb', line 3 def analytics @analytics end |
#created ⇒ Object
Returns the value of attribute created.
3 4 5 |
# File 'lib/googl-api/response.rb', line 3 def created @created end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/googl-api/response.rb', line 3 def id @id end |
#kind ⇒ Object
Returns the value of attribute kind.
3 4 5 |
# File 'lib/googl-api/response.rb', line 3 def kind @kind end |
#longUrl ⇒ Object
Returns the value of attribute longUrl.
3 4 5 |
# File 'lib/googl-api/response.rb', line 3 def longUrl @longUrl end |
#raw ⇒ Object
Returns the value of attribute raw.
3 4 5 |
# File 'lib/googl-api/response.rb', line 3 def raw @raw end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/googl-api/response.rb', line 3 def status @status end |
Instance Method Details
#long_url ⇒ Object
proive ruby like method for longUrl
21 22 23 |
# File 'lib/googl-api/response.rb', line 21 def long_url self.longUrl end |
#qr_code ⇒ Object
25 26 27 |
# File 'lib/googl-api/response.rb', line 25 def qr_code "#{short_url}.qr" unless short_url.blank? end |
#short_url ⇒ Object
provide helper method for short url (returned as id)
16 17 18 |
# File 'lib/googl-api/response.rb', line 16 def short_url self.id end |