Class: MWS::Products::Client

Inherits:
Peddler::Client show all
Defined in:
lib/mws/products/client.rb

Overview

The MWS Products API helps you get information to match your products to existing product listings on Amazon Marketplace websites and to make sourcing and pricing decisions for listing those products on Amazon Marketplace websites.

Instance Attribute Summary

Attributes inherited from Peddler::Client

#auth_token, #body, #merchant_id, #path, #primary_marketplace_id, #version

Instance Method Summary collapse

Methods inherited from Peddler::Client

#aws_endpoint, #defaults, #error_handler, #headers, #initialize, #marketplace, #marketplace_id, #marketplace_id=, on_error, #on_error, #operation, path, #run, version

Constructor Details

This class inherits a constructor from Peddler::Client

Instance Method Details

#get_competitive_pricing_for_asin(*asins, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Gets the current competitive price of a product, identified by its ASIN

Parameters:

  • asin (String)

    one or more asins

  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)

Returns:

See Also:



93
94
95
96
97
98
99
100
101
# File 'lib/mws/products/client.rb', line 93

def get_competitive_pricing_for_asin(*asin_list)
  opts = extract_options(asin_list)

  operation_with_marketplace('GetCompetitivePricingForASIN')
    .add(opts.update('ASINList' => asin_list))
    .structure!('ASINList', 'ASIN')

  run
end

#get_competitive_pricing_for_sku(*seller_skus, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Gets the current competitive price of a product, based on Seller SKU

Parameters:

  • seller_sku (String)

    one or more seller_skus

  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)

Returns:

See Also:



75
76
77
78
79
80
81
82
83
# File 'lib/mws/products/client.rb', line 75

def get_competitive_pricing_for_sku(*seller_sku_list)
  opts = extract_options(seller_sku_list)

  operation_with_marketplace('GetCompetitivePricingForSKU')
    .add(opts.update('SellerSKUList' => seller_sku_list))
    .structure!('SellerSKUList', 'SellerSKU')

  run
end

#get_lowest_offer_listings_for_asin(*asins, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Gets pricing information for the lowest-price active offer listings for a product, identified by its ASIN

Parameters:

  • asin (String)

    one or more asins

  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)
  • :item_condition (String)
  • :exclude_me (Boolean)

Returns:

See Also:



135
136
137
138
139
140
141
142
143
# File 'lib/mws/products/client.rb', line 135

def get_lowest_offer_listings_for_asin(*asin_list)
  opts = extract_options(asin_list)

  operation_with_marketplace('GetLowestOfferListingsForASIN')
    .add(opts.update('ASINList' => asin_list))
    .structure!('ASINList', 'ASIN')

  run
end

#get_lowest_offer_listings_for_sku(*seller_skus, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Gets pricing information for the lowest-price active offer listings for a product, based on Seller SKU

Parameters:

  • seller_sku (String)

    one or more seller_skus

  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)
  • :item_condition (String)
  • :exclude_me (Boolean)

Returns:

See Also:



114
115
116
117
118
119
120
121
122
# File 'lib/mws/products/client.rb', line 114

def get_lowest_offer_listings_for_sku(*seller_sku_list)
  opts = extract_options(seller_sku_list)

  operation_with_marketplace('GetLowestOfferListingsForSKU')
    .add(opts.update('SellerSKUList' => seller_sku_list))
    .structure!('SellerSKUList', 'SellerSKU')

  run
end

#get_lowest_priced_offers_for_asin(asin, item_condition, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Gets lowest priced offers for a single product, based on ASIN

Parameters:

  • asin (String)
  • item_condition (String)
  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)

Returns:

See Also:



174
175
176
177
178
179
180
181
182
183
# File 'lib/mws/products/client.rb', line 174

def get_lowest_priced_offers_for_asin(asin, item_condition, opts = {})
  opts.update(
    'ASIN' => asin,
    'ItemCondition' => item_condition
  )
  operation_with_marketplace('GetLowestPricedOffersForASIN')
    .add(opts)

  run
end

#get_lowest_priced_offers_for_sku(seller_sku, item_condition, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Gets lowest priced offers for a single product, based on SellerSKU

Parameters:

  • seller_sku (String)
  • item_condition (String)
  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)

Returns:

See Also:



154
155
156
157
158
159
160
161
162
163
# File 'lib/mws/products/client.rb', line 154

def get_lowest_priced_offers_for_sku(seller_sku, item_condition, opts = {})
  opts.update(
    'SellerSKU' => seller_sku,
    'ItemCondition' => item_condition
  )
  operation_with_marketplace('GetLowestPricedOffersForSKU')
    .add(opts)

  run
end

#get_matching_product(*asins, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Lists products and their attributes, based on a list of ASIN values

Parameters:

  • asin (String)

    one or more asins

  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)

Returns:

See Also:



57
58
59
60
61
62
63
64
65
# File 'lib/mws/products/client.rb', line 57

def get_matching_product(*asin_list)
  opts = extract_options(asin_list)

  operation_with_marketplace('GetMatchingProduct')
    .add(opts.update('ASINList' => asin_list))
    .structure!('ASINList', 'ASIN')

  run
end

#get_matching_product_for_id(id_type, *ids, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Lists products and their attributes, based on a list of ASIN, GCID,

SellerSKU, UPC, EAN, ISBN, and JAN values

Parameters:

  • id_type (String)
  • id (String)

    one or more ids

  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)

Returns:

See Also:



39
40
41
42
43
44
45
46
47
# File 'lib/mws/products/client.rb', line 39

def get_matching_product_for_id(id_type, *id_list)
  opts = extract_options(id_list)

  operation_with_marketplace('GetMatchingProductForId')
    .add(opts.update('IdType' => id_type, 'IdList' => id_list))
    .structure!('IdList', 'Id')

  run
end

#get_my_fees_estimate(*fees_estimate_requests) ⇒ Peddler::XMLParser

Gets the estimated fees for a list of products.



191
192
193
194
195
196
197
# File 'lib/mws/products/client.rb', line 191

def get_my_fees_estimate(*fees_estimate_requests)
  operation('GetMyFeesEstimate')
    .add('FeesEstimateRequestList' => fees_estimate_requests)
    .structure!('FeesEstimateRequestList', 'FeesEstimateRequest')

  run
end

#get_my_price_for_asin(*asins, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Gets pricing information for seller’s own offer listings, identified by its ASIN

Parameters:

  • asin (String)

    one or more asins

  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)
  • :item_condition (String)

Returns:

See Also:



229
230
231
232
233
234
235
236
237
# File 'lib/mws/products/client.rb', line 229

def get_my_price_for_asin(*asin_list)
  opts = extract_options(asin_list)

  operation_with_marketplace('GetMyPriceForASIN')
    .add(opts.update('ASINList' => asin_list))
    .structure!('ASINList', 'ASIN')

  run
end

#get_my_price_for_sku(*seller_skus, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Gets pricing information for seller’s own offer listings, based on Seller SKU

Parameters:

  • seller_sku (String)

    one or more seller_skus

  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)
  • :item_condition (String)

Returns:

See Also:



209
210
211
212
213
214
215
216
217
# File 'lib/mws/products/client.rb', line 209

def get_my_price_for_sku(*seller_sku_list)
  opts = extract_options(seller_sku_list)

  operation_with_marketplace('GetMyPriceForSKU')
    .add(opts.update('SellerSKUList' => seller_sku_list))
    .structure!('SellerSKUList', 'SellerSKU')

  run
end

#get_product_categories_for_asin(asin, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Gets parent product categories that a product belongs to, based on ASIN

Parameters:

  • asin (String)
  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)

Returns:

See Also:



263
264
265
266
267
268
# File 'lib/mws/products/client.rb', line 263

def get_product_categories_for_asin(asin, opts = {})
  operation_with_marketplace('GetProductCategoriesForASIN')
    .add(opts.update('ASIN' => asin))

  run
end

#get_product_categories_for_sku(sku, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Gets parent product categories that a product belongs to, based on Seller`SKU

Parameters:

  • seller_sku (String)
  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)

Returns:

See Also:



248
249
250
251
252
253
# File 'lib/mws/products/client.rb', line 248

def get_product_categories_for_sku(seller_sku, opts = {})
  operation_with_marketplace('GetProductCategoriesForSKU')
    .add(opts.update('SellerSKU' => seller_sku))

  run
end

#get_service_statusPeddler::XMLParser

Gets the service status of the API



274
275
276
277
# File 'lib/mws/products/client.rb', line 274

def get_service_status
  operation('GetServiceStatus')
  run
end

#list_matching_products(query, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

Lists products and their attributes, based on a search query

Parameters:

  • query (String)
  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

  • :marketplace_id (String)
  • :query_context_id (String)

Returns:

See Also:



22
23
24
25
26
27
# File 'lib/mws/products/client.rb', line 22

def list_matching_products(query, opts = {})
  operation_with_marketplace('ListMatchingProducts')
    .add(opts.update('Query' => query))

  run
end

#operation_with_marketplace(action) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



280
281
282
283
284
# File 'lib/mws/products/client.rb', line 280

def operation_with_marketplace(action)
  operation(action).tap do |opts|
    opts.store('MarketplaceId', primary_marketplace_id)
  end
end