Module: Clientele::Utils

Included in:
Request, RequestBuilder, Resource, Resource
Defined in:
lib/clientele/utils.rb

Class Method Summary collapse

Class Method Details

.deep_camelize_keys(hash) ⇒ Object



18
19
20
21
22
# File 'lib/clientele/utils.rb', line 18

def deep_camelize_keys(hash)
  hash.deep_transform_keys do |key|
    key.to_s.camelize(:lower)
  end
end

.ensure_trailing_slash(url) ⇒ Object



14
15
16
# File 'lib/clientele/utils.rb', line 14

def ensure_trailing_slash(url)
  url.end_with?('/') ? url : url + '/'
end

.merge_paths(*urls) ⇒ Object



10
11
12
# File 'lib/clientele/utils.rb', line 10

def merge_paths(*urls)
  urls.reject(&:blank?).join('/').sub(/(?<!:)\/+/, '/')
end