lib/ruby-mws/api/inventory.rb
# Takes a currency code and a hash of SKUs -> prices
# Returns true if all the products were updated successfully
# Otherwise raises an exception
Takes a currency code and a hash of SKUs -> prices
Returns true if all the products were updated successfully
Otherwise raises an exception
Takes a currency code and a hash of SKUs - > prices Returns true if all the products were updated successfully Otherwise raises an exception
def update_inventory_prices(merchant_id, currency_code, hash)
        xml = ""
        builder = Builder::XmlMarkup.new(:indent => 2, :target => xml)
        builder.instruct!
        builder.AmazonEnvelope(:"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", :"xsi:noNamespaceSchemaLocation" => "amzn-envelope.xsd") do |env|
          env.Header do |head|
            head.DocumentVersion('1.01')
            head.MerchantIdentifier(merchant_id)
          end
          env.MessageType('Price')
          i = 0
          hash.each do |sku,price|
            env.Message do |msg|
              msg.MessageID(i += 1)
              msg.Price do |pr|
                pr.SKU(sku)
                pr.StandardPrice(price, 'currency' => currency_code)
              end
            end
          end
        end
        submit_feed('_POST_PRODUCT_PRICING_DATA_', xml)
      end
def update_inventory_prices ( merchant_id , currency_code , hash ) xml = "" builder = Builder :: XmlMarkup . new ( :indent => 2 , :target => xml ) builder . instruct! builder . AmazonEnvelope ( :" xmlns:xsi " => "http://www.w3.org/2001/XMLSchema-instance" , :" xsi:noNamespaceSchemaLocation " => "amzn-envelope.xsd" ) do | env | env . Header do | head | head . DocumentVersion ( '1.01' ) head . MerchantIdentifier ( merchant_id ) end env . MessageType ( 'Price' ) i = 0 hash . each do | sku , price | env . Message do | msg | msg . MessageID ( i += 1 ) msg . Price do | pr | pr . SKU ( sku ) pr . StandardPrice ( price , 'currency' => currency_code ) end end end end submit_feed ( '_POST_PRODUCT_PRICING_DATA_' , xml ) end
Takes a currency code and a hash of SKUs -> prices
Returns true if all the products were updated successfully
Otherwise raises an exception
Takes a currency code and a hash of SKUs - > prices Returns true if all the products were updated successfully Otherwise raises an exception
# schema for XML "feed" is available at: # https://images-na.ssl-images-amazon.com/images/G/01/rainier/help/XML_Documentation_Intl.pdf
merchant_id
<not_specific>
currency_code
<not_specific>
hash
<not_specific>