Class: Shortly::Clients::ShortSwitch
- Inherits:
-
Shortly::Client
- Object
- Shortly::Client
- Shortly::Clients::ShortSwitch
- Defined in:
- lib/shortly/clients/shortswitch.rb
Class Attribute Summary collapse
-
.apiKey ⇒ Object
Returns the value of attribute apiKey.
Class Method Summary collapse
-
.shorten(url, options = {}) ⇒ Object
shorts provided url by making call to is.gd api with given options.
Methods inherited from Shortly::Client
Class Attribute Details
.apiKey ⇒ Object
Returns the value of attribute apiKey.
31 32 33 |
# File 'lib/shortly/clients/shortswitch.rb', line 31 def apiKey @apiKey end |
Class Method Details
.shorten(url, options = {}) ⇒ Object
shorts provided url by making call to is.gd api with given options.
37 38 39 40 41 42 43 |
# File 'lib/shortly/clients/shortswitch.rb', line 37 def self.shorten(url, = {}) validate_uri!(url) = {:apiKey => self.apiKey, :format => :json, :longUrl => url}.merge() validate!() response = get("/shorten", get_params()) OpenStruct.new(response['results'][url]) end |