Class: Shortly::Clients::Bitdo
- Inherits:
-
Shortly::Client
- Object
- Shortly::Client
- Shortly::Clients::Bitdo
- Defined in:
- lib/shortly/clients/bitdo.rb
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 Method Details
.shorten(url, options = {}) ⇒ Object
shorts provided url by making call to is.gd api with given options.
32 33 34 35 36 37 38 39 |
# File 'lib/shortly/clients/bitdo.rb', line 32 def self.shorten(url, = {}) validate_uri!(url) = {:action => "shorten", :url => url}.merge() response = post("/mod_perl/url-shortener.pl", post_params()) struct = JSON.parse(response.body) struct = struct.merge({ :short_url => "http://bit.do/#{struct["url_hash"]}" }) OpenStruct.new(struct) end |