class Shortly::Clients::Bitdo
Public Class Methods
shorten(url, options = {})
click to toggle source
shorts provided url by making call to is.gd api with given options.
# File lib/shortly/clients/bitdo.rb, line 32 def self.shorten(url, options = {}) validate_uri!(url) options = {:action => "shorten", :url => url}.merge(options) response = post("/mod_perl/url-shortener.pl", post_params(options)) struct = JSON.parse(response.body) struct = struct.merge({ :short_url => "http://bit.do/#{struct["url_hash"]}" }) OpenStruct.new(struct) end