Sha256: 9a5c9f052e16d1adbe36969defaa19fc92f14d22956fad974d66344941e6e2e6

Contents?: true

Size: 567 Bytes

Versions: 4

Compression:

Stored size: 567 Bytes

Contents

module Rainforest
  module ParamsBuilder

    def self.clean(params)
      Util.symbolize_keys(params || {})
    end

    # Clean the params, and the hash to_merge, and then merge them.
    # This ensures that we dont get something like { "id" => 123, :id => 321 }.
    def self.merge(*args)
      ret = {}
      args.each do |arg|
        ret = ret.merge(clean(arg))
      end
      ret
    end

    def self.build(params, api_key=nil, auth_key=nil)
      default_params.merge(clean(params))
    end

    def self.default_params
      params = {}
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rainforest-2.1.0 lib/rainforest/apibits/params_builder.rb
rainforest-2.0.2 lib/rainforest/apibits/params_builder.rb
rainforest-2.0.1 lib/rainforest/apibits/params_builder.rb
rainforest-2.0.0 lib/rainforest/apibits/params_builder.rb