Module: LMRest::RequestParams

Included in:
APIClient
Defined in:
lib/lm_rest/request_params.rb

Class Method Summary collapse

Class Method Details

.parameterize(params_hash) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/lm_rest/request_params.rb', line 3

def self.parameterize(params_hash)
  unless params_hash.empty?
    params_hash.keys.each.with_index.reduce('?') do |string, (key, index)|
      index > 0 ? string << '&' : ''
      string << "#{key}=#{params_hash.fetch(key)}"
    end
  end
end