Sha256: ee9200adbc30e5da27daf312ee9aa8ee42a9133f7e479668ed35e67b7ec178b2

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module Amazon
  module MWS
    module Products

      def get_matching_product(asins, params={})
        query_params = { "Action" => "GetMatchingProduct" }
        query_params["MarketplaceId"] = params[:marketplace] || @connection.marketplace_id
        asins.each_with_index{|id,i| query_params.merge!({"ASINList.ASIN.#{i+1}" => id})}

        response = post(product_path, query_params)
        
        return response if params[:raw_xml]

        GetMatchingProductResponse.format(response)
      end

      def get_matching_product_for_id(id_type, ids, params={})
        query_params = { "Action" => "GetMatchingProductForId" }
        query_params["MarketplaceId"] = params[:marketplace] || @connection.marketplace_id
        query_params["IdType"] = id_type
        ids.each_with_index{|id,i| query_params.merge!({"IdList.Id.#{i+1}" => id})}

        response = post(product_path, query_params)
        
        return response if params[:raw_xml]

        GetMatchingProductForIdResponse.format(response)
      end

      private
      def product_path
        "/Products/#{Authentication::PRODUCTS_VERSION}"
      end


    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amazon-mws-plus-0.1.3 lib/amazon/mws/request/products.rb