@api private
@param [Array<RequestParams::Param>] params
# File lib/aws-sdk-resources/request_params.rb, line 9 def initialize(params) @params = params end
@option options [required,Resource] :resource @option options [required,Array<Mixed>] :args @return [Hash]
# File lib/aws-sdk-resources/request_params.rb, line 16 def build(options = {}) deep_merge(user_params(options), computed_params(options)) end
# File lib/aws-sdk-resources/request_params.rb, line 27 def computed_params(options) params_hash = {} Array(options[:resource]).each.with_index do |resource, n| @params.each do |param| param.apply(params_hash, options.merge(resource: resource, n: n)) end end params_hash end
# File lib/aws-sdk-resources/request_params.rb, line 37 def deep_merge(obj1, obj2) case obj1 when Hash then obj1.merge(obj2) { |key, v1, v2| deep_merge(v1, v2) } when Array then obj2 + obj1 else obj2 end end
# File lib/aws-sdk-resources/request_params.rb, line 22 def user_params(options) args = options[:args] || [] args.last.is_a?(Hash) ? args.last : {} end