lib/fog/aws/requests/simpledb/batch_put_attributes.rb in fog-0.0.56 vs lib/fog/aws/requests/simpledb/batch_put_attributes.rb in fog-0.0.57

- old
+ new

@@ -1,11 +1,10 @@ -unless Fog.mocking? +module Fog + module AWS + module SimpleDB + class Real - module Fog - module AWS - class SimpleDB - # Put items attributes into a SimpleDB domain # # ==== Parameters # * domain_name<~String> - Name of domain. Must be between 3 and 255 of the # following characters: a-z, A-Z, 0-9, '_', '-' and '.'. @@ -21,37 +20,32 @@ # * body<~Hash>: # * 'BoxUsage' # * 'RequestId' def batch_put_attributes(domain_name, items, replace_attributes = Hash.new([])) request({ - 'Action' => 'BatchPutAttributes', - 'DomainName' => domain_name - }.merge!(encode_batch_attributes(items, replace_attributes)), Fog::Parsers::AWS::SimpleDB::Basic.new(@nil_string)) + 'Action' => 'BatchPutAttributes', + 'DomainName' => domain_name, + :parser => Fog::Parsers::AWS::SimpleDB::Basic.new(@nil_string) + }.merge!(encode_batch_attributes(items, replace_attributes))) end end - end - end -else + class Mock - module Fog - module AWS - class SimpleDB - def batch_put_attributes(domain_name, items, replace_attributes = Hash.new([])) response = Excon::Response.new - if Fog::AWS::SimpleDB.data[:domains][domain_name] + if @data[:domains][domain_name] for item_name, attributes in items do for key, value in attributes do - Fog::AWS::SimpleDB.data[:domains][domain_name][item_name] ||= {} + @data[:domains][domain_name][item_name] ||= {} if replace_attributes[item_name] && replace_attributes[item_name].include?(key) - Fog::AWS::SimpleDB.data[:domains][domain_name][item_name][key.to_s] = [] + @data[:domains][domain_name][item_name][key.to_s] = [] else - Fog::AWS::SimpleDB.data[:domains][domain_name][item_name][key.to_s] ||= [] + @data[:domains][domain_name][item_name][key.to_s] ||= [] end - Fog::AWS::SimpleDB.data[:domains][domain_name][item_name][key.to_s] << value.to_s + @data[:domains][domain_name][item_name][key.to_s] << value.to_s end end response.status = 200 response.body = { 'BoxUsage' => Fog::AWS::Mock.box_usage, @@ -65,7 +59,6 @@ end end end end - end