class GooglApi::Response

Attributes

analytics[RW]
created[RW]
id[RW]
kind[RW]
longUrl[RW]
raw[RW]
status[RW]

Public Class Methods

new(args) click to toggle source
# 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

Public Instance Methods

long_url() click to toggle source

proive ruby like method for longUrl

# File lib/googl-api/response.rb, line 21
def long_url
  self.longUrl
end
qr_code() click to toggle source
# File lib/googl-api/response.rb, line 25
def qr_code
  "#{short_url}.qr" unless short_url.blank?
end
short_url() click to toggle source

provide helper method for short url (returned as id)

# File lib/googl-api/response.rb, line 16
def short_url
  self.id
end