lib/awsbase/right_awsbase.rb
# Transform a list of hashes of parameters into a hash suitable for sending
# to Amazon using a key mapping.
#
#  amazonize_list_with_key_mapping('Group.Filter',
#    [{:some_param => 'SomeParam'}, {:some_param => 'SomeParam'}],
#    {:some_param => 'value'}) #=>
#      {'Group.Filter.1.SomeParam' => 'value',
#       'Group.Filter.2.SomeParam' => 'value'}
#
Transform a list of hashes of parameters into a hash suitable for sending
to Amazon using a key mapping.


Transform a list of hashes of parameters into a hash suitable for sending to Amazon using a key mapping .
def amazonize_list_with_key_mapping(key, mapping, list, options={})
      result = {}
      unless list.right_blank?
        list.each_with_index do |item, index|
          mapping.each do |local_name, remote_name|
            value = item[local_name]
            next if value.nil?
            result["#{key}.#{index+1}.#{remote_name}"] = value
          end
        end
      end
    end
def amazonize_list_with_key_mapping ( key , mapping , list , options = { } ) result = { } unless list . right_blank? list . each_with_index do | item , index | mapping . each do | local_name , remote_name | value = item [ local_name ] next if value . nil? result [ "#{key}.#{index+1}.#{remote_name}" ] = value end end end end
Transform a list of hashes of parameters into a hash suitable for sending
to Amazon using a key mapping.
Transform a list of hashes of parameters into a hash suitable for sending to Amazon using a key mapping .
key
<not_specific>
mapping
<not_specific>
list
<not_specific>
options
<not_specific>