Class: Shortly::Clients::Googl
- Inherits:
-
Shortly::Client
- Object
- Shortly::Client
- Shortly::Clients::Googl
- Defined in:
- lib/shortly/clients/googl.rb
Class Attribute Summary (collapse)
-
+ (Object) apiKey
apiKey = "".
Class Method Summary (collapse)
- + (Object) analytics(url, options = {})
- + (Object) expand(url, options = {})
-
+ (Object) shorten(url, options = {})
shorts provided url by making call to goo.gl api with given options.
Methods inherited from Shortly::Client
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, ={}) validate_uri!(url) info(.merge(:shortUrl => url), true) end |
+ (Object) expand(url, options = {})
44 45 46 47 |
# File 'lib/shortly/clients/googl.rb', line 44 def self.(url, ={}) validate_uri!(url) info(.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, = {}) validate_uri!(url) response = post(relative_path_with_key(), post_params({:longUrl => url}.to_json)) OpenStruct.new(response.merge(:shortUrl => response["id"])) end |