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(*asin_list, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

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

Parameters:

  • asin_list (Array<String>)
  • 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_sku_list, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

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

Parameters:

  • seller_sku_list (Array<String>)
  • 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(*asin_list, 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_list (Array<String>)
  • 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_sku_list, 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_list (Array<String>)
  • 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_sku(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(*asin_list, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

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

Parameters:

  • asin_list (Array<String>)
  • 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, *id_list, 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_list (Array<String>)
  • 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_price_for_asin(*seller_sku_list, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

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

Parameters:

  • asin_list (Array<String>)
  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

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

Returns:

See Also:



215
216
217
218
219
220
221
222
223
# File 'lib/mws/products/client.rb', line 215

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_sku_list, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser

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

Parameters:

  • seller_sku_list (Array<String>)
  • opts (Hash) (defaults to: { marketplace_id: primary_marketplace_id })

Options Hash (opts):

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

Returns:

See Also:



195
196
197
198
199
200
201
202
203
# File 'lib/mws/products/client.rb', line 195

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:



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

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:



234
235
236
237
238
239
# File 'lib/mws/products/client.rb', line 234

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



260
261
262
263
# File 'lib/mws/products/client.rb', line 260

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.



266
267
268
269
270
# File 'lib/mws/products/client.rb', line 266

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