Class: Shortly::Clients::Googl
- Inherits:
-
Shortly::Client
- Object
- Shortly::Client
- Shortly::Clients::Googl
- Defined in:
- lib/shortly/clients/googl.rb
Class Attribute Summary collapse
-
.apiKey ⇒ Object
apiKey = “<your apiKey>”.
Class Method Summary collapse
- .analytics(url, options = {}) ⇒ Object
- .expand(url, options = {}) ⇒ Object
-
.shorten(url, options = {}) ⇒ Object
shorts provided url by making call to goo.gl api with given options.
Methods inherited from Shortly::Client
Class Attribute Details
.apiKey ⇒ Object
apiKey = “<your apiKey>”
31 32 33 |
# File 'lib/shortly/clients/googl.rb', line 31 def apiKey @apiKey end |
Class Method Details
.analytics(url, options = {}) ⇒ Object
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 |
.expand(url, options = {}) ⇒ Object
44 45 46 47 |
# File 'lib/shortly/clients/googl.rb', line 44 def self.(url, ={}) validate_uri!(url) info(.merge(:shortUrl => url)) end |
.shorten(url, options = {}) ⇒ Object
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 |