Class: Shortly::Clients::Googl

Inherits:
Shortly::Client show all
Defined in:
lib/shortly/clients/googl.rb

Class Attribute Summary (collapse)

Class Method Summary (collapse)

Methods inherited from Shortly::Client

method_missing

Class Attribute Details

+ (Object) apiKey

apiKey = "<your apiKey>"



31
32
33
# File 'lib/shortly/clients/googl.rb', line 31

def apiKey
  @apiKey
end

Class Method Details

+ (Object) analytics(url, options = {})



49
50
51
52
# File 'lib/shortly/clients/googl.rb', line 49

def self.analytics(url, options ={})
  validate_uri!(url)
  info(options.merge(:shortUrl => url), true)
end

+ (Object) expand(url, options = {})



44
45
46
47
# File 'lib/shortly/clients/googl.rb', line 44

def self.expand(url, options ={})
  validate_uri!(url)
  info(options.merge(:shortUrl => url))
end

+ (Object) shorten(url, options = {})

shorts provided url by making call to goo.gl api with given options.



38
39
40
41
42
# File 'lib/shortly/clients/googl.rb', line 38

def self.shorten(url, options = {})
  validate_uri!(url)
  response = post(relative_path_with_key(options), post_params({:longUrl => url}.to_json))
  OpenStruct.new(response.merge(:shortUrl => response["id"]))
end