Class: GooglApi::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/googl-api/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#analyticsObject

Returns the value of attribute analytics.



3
4
5
# File 'lib/googl-api/response.rb', line 3

def analytics
  @analytics
end

#createdObject

Returns the value of attribute created.



3
4
5
# File 'lib/googl-api/response.rb', line 3

def created
  @created
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/googl-api/response.rb', line 3

def id
  @id
end

#kindObject

Returns the value of attribute kind.



3
4
5
# File 'lib/googl-api/response.rb', line 3

def kind
  @kind
end

#longUrlObject

Returns the value of attribute longUrl.



3
4
5
# File 'lib/googl-api/response.rb', line 3

def longUrl
  @longUrl
end

#rawObject

Returns the value of attribute raw.



3
4
5
# File 'lib/googl-api/response.rb', line 3

def raw
  @raw
end

#statusObject

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_urlObject

proive ruby like method for longUrl



21
22
23
# File 'lib/googl-api/response.rb', line 21

def long_url
  self.longUrl
end

#qr_codeObject



25
26
27
# File 'lib/googl-api/response.rb', line 25

def qr_code
  "#{short_url}.qr" unless short_url.blank?
end

#short_urlObject

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