Module: Alman::ParamsBuilder
- Defined in:
- lib/alman/apibits/params_builder.rb
Class Method Summary collapse
- .build(params, api_key = nil, auth_key = nil) ⇒ Object
- .clean(params) ⇒ Object
- .default_params ⇒ Object
-
.merge(*args) ⇒ Object
Clean the params, and the hash to_merge, and then merge them.
Class Method Details
.build(params, api_key = nil, auth_key = nil) ⇒ Object
18 19 20 |
# File 'lib/alman/apibits/params_builder.rb', line 18 def self.build(params, api_key=nil, auth_key=nil) default_params.merge(clean(params)) end |
.clean(params) ⇒ Object
4 5 6 |
# File 'lib/alman/apibits/params_builder.rb', line 4 def self.clean(params) Util.symbolize_keys(params || {}) end |
.default_params ⇒ Object
22 23 24 |
# File 'lib/alman/apibits/params_builder.rb', line 22 def self.default_params params = {} end |
.merge(*args) ⇒ Object
Clean the params, and the hash to_merge, and then merge them. This ensures that we dont get something like { “id” => 123, :id => 321 }.
10 11 12 13 14 15 16 |
# File 'lib/alman/apibits/params_builder.rb', line 10 def self.merge(*args) ret = {} args.each do |arg| ret = ret.merge(clean(arg)) end ret end |