Class: MultiShorten::Client
- Inherits:
-
Object
- Object
- MultiShorten::Client
- Defined in:
- lib/multi_shorten/client.rb
Overview
Client class for MultiShorten initialize the client with client = MultiShorten::Client.new
Instance Method Summary collapse
-
#shorten(params) ⇒ Hash
The only method required to use all the features.
Instance Method Details
#shorten(params) ⇒ Hash
The only method required to use all the features
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/multi_shorten/client.rb', line 11 def shorten params raise "Parameter should be a hash" unless params.is_a?(Hash) return missing_parameter_error(:url) if params[:url].nil? return missing_parameter_error(:mode) if params[:mode].nil? case params[:mode] when "single" return missing_parameter_error(:shortener) if params[:shortener].nil? single(params[:shortener], params[:url]) when "multiple" return missing_parameter_error(:shorteners) if params[:shorteners].nil multiple(params[:shorteners], params[:url]) end end |