peddler 0.12.5 → 0.12.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -5
  3. data/lib/mws/fulfillment_inbound_shipment/client.rb +1 -0
  4. data/lib/mws/subscriptions/client.rb +1 -1
  5. data/lib/peddler/client.rb +2 -2
  6. data/lib/peddler/flat_file_response.rb +53 -0
  7. data/lib/peddler/operation.rb +4 -4
  8. data/lib/peddler/response.rb +24 -0
  9. data/lib/peddler/version.rb +1 -1
  10. data/lib/peddler/xml_response.rb +30 -0
  11. data/test/helper.rb +74 -0
  12. data/test/integration/test_cart_information.rb +1 -1
  13. data/test/integration/test_customer_information.rb +1 -1
  14. data/test/integration/test_feeds.rb +1 -1
  15. data/test/integration/test_fulfillment_inbound_shipment.rb +1 -1
  16. data/test/integration/test_fulfillment_inventory.rb +1 -1
  17. data/test/integration/test_fulfillment_outbound_shipment.rb +1 -1
  18. data/test/integration/test_off_amazon_payments.rb +1 -1
  19. data/test/integration/test_orders.rb +1 -1
  20. data/test/integration/test_products.rb +1 -1
  21. data/test/integration/test_recommendations.rb +1 -1
  22. data/test/integration/test_reports.rb +1 -1
  23. data/test/integration/test_sellers.rb +1 -1
  24. data/test/integration/test_subscriptions.rb +1 -1
  25. data/test/integration/test_webstore.rb +1 -1
  26. data/test/unit/mws/test_cart_information_client.rb +2 -2
  27. data/test/unit/mws/test_customer_information_client.rb +2 -2
  28. data/test/unit/mws/test_feeds_client.rb +2 -2
  29. data/test/unit/mws/test_fulfillment_inbound_shipment_client.rb +12 -4
  30. data/test/unit/mws/test_fulfillment_inventory_client.rb +2 -2
  31. data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +2 -2
  32. data/test/unit/mws/test_off_amazon_payments_client.rb +1 -1
  33. data/test/unit/mws/test_orders_client.rb +2 -2
  34. data/test/unit/mws/test_products_client.rb +156 -7
  35. data/test/unit/mws/test_recommendations_client.rb +2 -2
  36. data/test/unit/mws/test_reports_client.rb +187 -4
  37. data/test/unit/mws/test_sellers_client.rb +2 -2
  38. data/test/unit/mws/test_subscriptions_client.rb +291 -4
  39. data/test/unit/mws/test_webstore_client.rb +83 -4
  40. data/test/unit/peddler/test_client.rb +1 -1
  41. data/test/unit/peddler/test_flat_file_parser.rb +1 -1
  42. data/test/unit/peddler/test_marketplace.rb +1 -1
  43. data/test/unit/peddler/test_operation.rb +8 -1
  44. data/test/unit/peddler/test_parser.rb +1 -1
  45. data/test/unit/peddler/test_structured_list.rb +1 -1
  46. data/test/unit/peddler/test_xml_parser.rb +1 -1
  47. data/test/unit/test_mws.rb +2 -2
  48. metadata +7 -6
  49. data/test/integration_test_helper.rb +0 -48
  50. data/test/test_helper.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4211dcab3a4f1c013f7fe9ab4faf010df8c57115
4
- data.tar.gz: 17e694bcc21a74005d63f1ff6eb238dadb68d5e0
3
+ metadata.gz: 30436cbe660437bbf9bd37c50f71e97cd5ea3dba
4
+ data.tar.gz: daf21940a611131fb3fe34a12d4bad5d25fabca1
5
5
  SHA512:
6
- metadata.gz: 0073a4510d9d067a4916bff357cbfe66909857ef112f94b207343d880784a5a25183ba9749f8236bd96e2c1434e83cb955de8ec90be0c4170bc847e53eaaab9b
7
- data.tar.gz: 19dd1e5f4a79ef387e3445348ce6b6ff68b5bb09f50dbb4e104023cc4e4f1b26139317098e4fe647d5e835d4940055bc911a6370b3d96f9ad4fb754d2de6f27c
6
+ metadata.gz: fcd83c8e7ce9ff05bacdf5344acaae8537a64fcd3f34aa43ab9e115cca5518691ce9daa07b6520ed5229f7f6b5703be7f8c4c8668865ac85ce3f33f574668be6
7
+ data.tar.gz: 69af1faee5272ec880e01bc835e6c88e771b44cdc6f43c6f2b549d9798dcb59d69a0a40d6427ba981bc984b22b106dfad2b9867ec64fe20f2b1dcdf06b2c33e8
data/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
  # Peddler
3
3
 
4
4
  [![Build Status](https://travis-ci.org/hakanensari/peddler.svg)](https://travis-ci.org/hakanensari/peddler)
5
- [![Code Climate](http://img.shields.io/codeclimate/github/hakanensari/peddler.svg)](https://codeclimate.com/github/hakanensari/peddler)
6
- [![Coverage Status](http://img.shields.io/coveralls/hakanensari/peddler/master.svg)](https://coveralls.io/r/hakanensari/peddler)
5
+ [![Code Climate](https://codeclimate.com/github/hakanensari/peddler/badges/gpa.svg)](https://codeclimate.com/github/hakanensari/peddler)
6
+ [![Coverage Status](https://coveralls.io/repos/hakanensari/peddler/badge.svg?branch=master)](https://coveralls.io/r/hakanensari/peddler?branch=master)
7
7
 
8
8
  **Peddler** is a Ruby interface to the [Amazon MWS API](https://developer.amazonservices.com/), a collection of web services that help Amazon sellers programmatically exchange data on their listings, orders, payments, reports, and more.
9
9
 
@@ -49,9 +49,11 @@ If instantiating a client for another seller, you have to provide the `MWSAuthTo
49
49
 
50
50
  ```ruby
51
51
  client = MWS.orders(
52
- marketplace_id: "...",
53
- merchant_id: "...",
54
- auth_token: "..."
52
+ marketplace_id: "...",
53
+ merchant_id: "...",
54
+ aws_access_key_id: "...",
55
+ aws_secret_access_key: "...",
56
+ auth_token: "..."
55
57
  )
56
58
  ```
57
59
 
@@ -82,6 +82,7 @@ module MWS
82
82
  'ShipmentType' => shipment_type,
83
83
  'TransportDetails' => transport_details
84
84
  )
85
+ .structure!('PackageList', 'member')
85
86
 
86
87
  run
87
88
  end
@@ -137,7 +137,7 @@ module MWS
137
137
  # @param marketplace_id [String]
138
138
  # @return [Peddler::XMLParser]
139
139
  def update_subscription(notification_type, sqs_queue_url, enabled, marketplace_id = marketplace_id())
140
- operation('CreateSubscription')
140
+ operation('UpdateSubscription')
141
141
  .add('MarketplaceId' => marketplace_id)
142
142
  .add(build_subscription(notification_type, sqs_queue_url, enabled))
143
143
 
@@ -84,10 +84,10 @@ module Peddler
84
84
  action ? @operation = Operation.new(action) : @operation
85
85
  end
86
86
 
87
- def run(&blk)
87
+ def run
88
88
  opts = defaults.merge(query: operation, headers: headers)
89
89
  opts.store(:body, body) if body
90
- opts.store(:response_block, blk) if block_given?
90
+ opts.store(:response_block, Proc.new) if block_given?
91
91
  res = post(opts)
92
92
 
93
93
  parser.parse(res, encoding)
@@ -0,0 +1,53 @@
1
+ require 'delegate'
2
+ require 'csv'
3
+ require 'digest/md5'
4
+
5
+ module Peddler
6
+ # @api private
7
+ class FlatFileResponse < SimpleDelegator
8
+ # http://stackoverflow.com/questions/8073920/importing-csv-quoting-error-is-driving-me-nuts
9
+ OPTIONS = { col_sep: "\t", quote_char: "\x00", headers: true }
10
+
11
+ attr_reader :content, :summary, :encoding
12
+
13
+ def initialize(res, encoding)
14
+ super(res)
15
+ @encoding = encoding
16
+ extract_content
17
+ end
18
+
19
+ def parse
20
+ CSV.parse(scrub_content, OPTIONS) if content
21
+ end
22
+
23
+ def records_count
24
+ summarize if summary?
25
+ end
26
+
27
+ def valid?
28
+ headers['Content-MD5'] == Digest::MD5.base64digest(body)
29
+ end
30
+
31
+ private
32
+
33
+ def extract_content
34
+ if summary?
35
+ @summary, @content = body.split("\n\n")
36
+ else
37
+ @content = body.dup
38
+ end
39
+ end
40
+
41
+ def scrub_content
42
+ content.force_encoding(encoding).encode('UTF-8')
43
+ end
44
+
45
+ def summary?
46
+ body.start_with?('Feed Processing Summary')
47
+ end
48
+
49
+ def summarize
50
+ Hash[summary.split("\n\t")[1, 2].map { |line| line.split("\t\t") }]
51
+ end
52
+ end
53
+ end
@@ -10,11 +10,11 @@ module Peddler
10
10
  end
11
11
 
12
12
  def structure!(*list_keys)
13
- list_key = list_keys.first
13
+ list_key = list_keys.shift
14
14
 
15
- if key?(list_key)
16
- builder = StructuredList.new(*list_keys)
17
- vals = delete(list_key)
15
+ if found_key = keys.find { |key| key.end_with?(list_key) }
16
+ builder = StructuredList.new(found_key, *list_keys)
17
+ vals = delete(found_key)
18
18
  update(builder.build(vals))
19
19
  end
20
20
 
@@ -0,0 +1,24 @@
1
+ require 'peddler/flat_file_response'
2
+ require 'peddler/xml_response'
3
+
4
+ module Peddler
5
+ # @api private
6
+ module Response
7
+ # The inevitable messiness of massaging data produced by a motley army of
8
+ # Amazon developers
9
+ def self.new(response, encoding = 'ISO-8859-1')
10
+ # Don't parse if there's no body
11
+ return response unless response.body
12
+
13
+ content_type = response.headers['Content-Type']
14
+ if content_type.start_with?('text/xml')
15
+ XMLResponse.new(response)
16
+ else
17
+ # Amazon returns a variety of content types for flat files, so we
18
+ # simply assume that anything not XML is a flat file rather than code
19
+ # defensively and check content type again.
20
+ FlatFileResponse.new(response, encoding)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Peddler
2
- VERSION = '0.12.5'
2
+ VERSION = '0.12.7'
3
3
  end
@@ -0,0 +1,30 @@
1
+ require 'delegate'
2
+ require 'multi_xml'
3
+
4
+ module Peddler
5
+ # @api private
6
+ class XMLResponse < SimpleDelegator
7
+ def next_token
8
+ parse.fetch('NextToken', false)
9
+ end
10
+
11
+ def parse
12
+ @result ||= find_result
13
+ end
14
+
15
+ def document
16
+ MultiXml.parse(body)
17
+ end
18
+
19
+ def valid?
20
+ headers['Content-Length'].to_i == body.size if headers['Content-Length']
21
+ end
22
+
23
+ private
24
+
25
+ def find_result
26
+ results = document.values[0].find { |k, _| k.include?('Result') }
27
+ results ? results.last : nil
28
+ end
29
+ end
30
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,74 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+ require 'minitest/autorun'
4
+ require 'yaml'
5
+ require 'vcr'
6
+ begin
7
+ require 'pry'
8
+ rescue LoadError
9
+ end
10
+
11
+ # Wraps MWS credentials to run integration tests against
12
+ #
13
+ # Replace entries in the fixture file with real credentials if adding new tests
14
+ # or otherwise testing against live data.
15
+ module Accounts
16
+ extend Enumerable
17
+
18
+ def self.each(&blk)
19
+ @data.each(&blk)
20
+ end
21
+
22
+ @data = YAML.load_file(File.expand_path('../mws.yml', __FILE__))
23
+ end
24
+
25
+ # Sets up clients and bootstraps VCR for integration tests
26
+ class IntegrationTest < MiniTest::Test
27
+ def setup
28
+ ENV['LIVE'] ? VCR.turn_off! : VCR.insert_cassette(api)
29
+ end
30
+
31
+ def teardown
32
+ VCR.eject_cassette if VCR.turned_on?
33
+ end
34
+
35
+ def clients
36
+ Accounts.map do |account|
37
+ klass = MWS.const_get("#{api}::Client")
38
+ klass.new(account)
39
+ end
40
+ end
41
+
42
+ private
43
+
44
+ def api
45
+ self.class.name.sub('Test', '')
46
+ end
47
+ end
48
+
49
+ VCR.configure do |c|
50
+ c.hook_into :excon
51
+ c.cassette_library_dir = 'test/vcr_cassettes'
52
+
53
+ # HTTP errors are not Peddler's concern, so ignore them to ease development.
54
+ c.before_record do |interaction|
55
+ interaction.ignore! if interaction.response.status.code >= 400
56
+ end
57
+
58
+ # Ignore transient params when building VCR fixtures.
59
+ matcher = VCR.request_matchers.uri_without_param(
60
+ 'AWSAccessKeyId', 'SellerId', 'Signature', 'Timestamp', 'StartDate',
61
+ 'CreatedAfter', 'QueryStartDateTime'
62
+ )
63
+
64
+ c.default_cassette_options = {
65
+ match_requests_on: [:host, :path, matcher],
66
+ record: :none
67
+ }
68
+
69
+ # So that fixtures do not depend on merchant credentials
70
+ Accounts.each do |account|
71
+ c.filter_sensitive_data('MERCHANT_ID') { account['merchant_id'] }
72
+ c.filter_sensitive_data('AWS_ACCESS_KEY_ID') { account['aws_access_key_id'] }
73
+ end
74
+ end
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/cart_information'
3
3
 
4
4
  class TestCartInformation < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/customer_information'
3
3
 
4
4
  class TestCustomerInformation < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/feeds'
3
3
 
4
4
  class TestFeeds < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/fulfillment_inbound_shipment'
3
3
 
4
4
  class TestFulfillmentInboundShipment < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/fulfillment_inventory'
3
3
 
4
4
  class TestFulfillmentInventory < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/fulfillment_outbound_shipment'
3
3
 
4
4
  class TestFulfillmentOutboundShipment < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/off_amazon_payments'
3
3
 
4
4
  class TestOffAmazonPayments < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/orders'
3
3
 
4
4
  class TestOrders < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/products'
3
3
 
4
4
  class TestProducts < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/recommendations'
3
3
 
4
4
  class TestRecommendations < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/reports'
3
3
 
4
4
  class TestReports < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/sellers'
3
3
 
4
4
  class TestSellers < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/subscriptions'
3
3
 
4
4
  class TestSubscriptions < IntegrationTest
@@ -1,4 +1,4 @@
1
- require 'integration_test_helper'
1
+ require 'helper'
2
2
  require 'mws/webstore'
3
3
 
4
4
  class TestWebstore < IntegrationTest
@@ -1,7 +1,7 @@
1
- require 'test_helper'
1
+ require 'helper'
2
2
  require 'mws/cart_information/client'
3
3
 
4
- class TestCartInformationClient < MiniTest::Test
4
+ class TestMWSCartInformationClient < MiniTest::Test
5
5
  def setup
6
6
  @client = MWS::CartInformation::Client.new
7
7
  end
@@ -1,7 +1,7 @@
1
- require 'test_helper'
1
+ require 'helper'
2
2
  require 'mws/customer_information/client'
3
3
 
4
- class TestCustomerInformationClient < MiniTest::Test
4
+ class TestMWSCustomerInformationClient < MiniTest::Test
5
5
  def setup
6
6
  @client = MWS::CustomerInformation::Client.new
7
7
  end
@@ -1,7 +1,7 @@
1
- require 'test_helper'
1
+ require 'helper'
2
2
  require 'mws/feeds/client'
3
3
 
4
- class TestFeedsClient < MiniTest::Test
4
+ class TestMWSFeedsClient < MiniTest::Test
5
5
  def setup
6
6
  @client = MWS::Feeds::Client.new
7
7
  end
@@ -1,7 +1,7 @@
1
- require 'test_helper'
1
+ require 'helper'
2
2
  require 'mws/fulfillment_inbound_shipment/client'
3
3
 
4
- class TestFulfillmentInboundShipmentClient < MiniTest::Test
4
+ class TestMWSFulfillmentInboundShipmentClient < MiniTest::Test
5
5
  def setup
6
6
  @client = MWS::FulfillmentInboundShipment::Client.new
7
7
  end
@@ -51,16 +51,24 @@ class TestFulfillmentInboundShipmentClient < MiniTest::Test
51
51
  end
52
52
 
53
53
  def test_puts_transport_content
54
+ transport_details = {
55
+ 'ParcelData' => {
56
+ 'PackageList' => {
57
+ 'TrackingId' => '123'
58
+ }
59
+ }
60
+ }
61
+
54
62
  operation = {
55
63
  'Action' => 'PutTransportContent',
56
64
  'ShipmentId' => '1',
57
65
  'IsPartnered' => true,
58
66
  'ShipmentType' => 'Foo',
59
- 'TransportDetails.Foo' => '1'
67
+ 'TransportDetails.ParcelData.PackageList.TrackingId' => '123'
60
68
  }
61
69
 
62
70
  @client.stub(:run, nil) do
63
- @client.put_transport_content('1', true, 'Foo', { 'Foo' => '1' })
71
+ @client.put_transport_content('1', true, 'Foo', transport_details)
64
72
  end
65
73
 
66
74
  assert_equal operation, @client.operation
@@ -1,7 +1,7 @@
1
- require 'test_helper'
1
+ require 'helper'
2
2
  require 'mws/fulfillment_inventory/client'
3
3
 
4
- class TestFulfillmentInventoryClient < MiniTest::Test
4
+ class TestMWSFulfillmentInventoryClient < MiniTest::Test
5
5
  def setup
6
6
  @client = MWS::FulfillmentInventory::Client.new
7
7
  end
@@ -1,7 +1,7 @@
1
- require 'test_helper'
1
+ require 'helper'
2
2
  require 'mws/fulfillment_outbound_shipment/client'
3
3
 
4
- class TestFulfillmentOutboundShipmentClient < MiniTest::Test
4
+ class TestMWSFulfillmentOutboundShipmentClient < MiniTest::Test
5
5
  def setup
6
6
  @client = MWS::FulfillmentOutboundShipment::Client.new
7
7
  end
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require 'helper'
2
2
  require 'mws/off_amazon_payments/client'
3
3
 
4
4
  class TestMWSOffAmazonPaymentsClient < MiniTest::Test
@@ -1,7 +1,7 @@
1
- require 'test_helper'
1
+ require 'helper'
2
2
  require 'mws/orders/client'
3
3
 
4
- class TestOrdersClient < MiniTest::Test
4
+ class TestMWSOrdersClient < MiniTest::Test
5
5
  def setup
6
6
  @client = MWS::Orders::Client.new
7
7
  end
@@ -1,14 +1,165 @@
1
- require 'test_helper'
1
+ require 'helper'
2
2
  require 'mws/products/client'
3
3
 
4
- class TestProductsClient < MiniTest::Test
4
+ class TestMWSProductsClient < MiniTest::Test
5
5
  def setup
6
6
  @client = MWS::Products::Client.new
7
+ @client.marketplace_id = '123'
7
8
  end
8
9
 
9
- def test_operation_includes_marketplace_id
10
- client = MWS::Products::Client.new
11
- assert client.operation_with_marketplace('Foo').has_key?('MarketplaceId')
10
+ def test_lists_matching_products
11
+ operation = {
12
+ 'Action' => 'ListMatchingProducts',
13
+ 'MarketplaceId' => '123',
14
+ 'Query' => 'foo'
15
+ }
16
+
17
+ @client.stub(:run, nil) do
18
+ @client.list_matching_products('foo')
19
+ end
20
+
21
+ assert_equal operation, @client.operation
22
+ end
23
+
24
+ def test_gets_matching_product_for_id
25
+ operation = {
26
+ 'Action' => 'GetMatchingProductForId',
27
+ 'MarketplaceId' => '123',
28
+ 'IdType' => 'foo',
29
+ 'IdList.Id.1' => '1'
30
+ }
31
+
32
+ @client.stub(:run, nil) do
33
+ @client.get_matching_product_for_id('foo', '1')
34
+ end
35
+
36
+ assert_equal operation, @client.operation
37
+ end
38
+
39
+ def test_gets_matching_product
40
+ operation = {
41
+ 'Action' => 'GetMatchingProduct',
42
+ 'MarketplaceId' => '123',
43
+ 'ASINList.ASIN.1' => '1'
44
+ }
45
+
46
+ @client.stub(:run, nil) do
47
+ @client.get_matching_product('1')
48
+ end
49
+
50
+ assert_equal operation, @client.operation
51
+ end
52
+
53
+ def test_gets_competitive_pricing_for_sku
54
+ operation = {
55
+ 'Action' => 'GetCompetitivePricingForSKU',
56
+ 'MarketplaceId' => '123',
57
+ 'SellerSKUList.SellerSKU.1' => '1'
58
+ }
59
+
60
+ @client.stub(:run, nil) do
61
+ @client.get_competitive_pricing_for_sku('1')
62
+ end
63
+
64
+ assert_equal operation, @client.operation
65
+ end
66
+
67
+ def test_gets_competitive_pricing_for_asin
68
+ operation = {
69
+ 'Action' => 'GetCompetitivePricingForASIN',
70
+ 'MarketplaceId' => '123',
71
+ 'ASINList.ASIN.1' => '1'
72
+ }
73
+
74
+ @client.stub(:run, nil) do
75
+ @client.get_competitive_pricing_for_asin('1')
76
+ end
77
+
78
+ assert_equal operation, @client.operation
79
+ end
80
+
81
+ def test_gets_lowest_offer_listings_for_sku
82
+ operation = {
83
+ 'Action' => 'GetLowestOfferListingsForSKU',
84
+ 'MarketplaceId' => '123',
85
+ 'SellerSKUList.SellerSKU.1' => '1'
86
+ }
87
+
88
+ @client.stub(:run, nil) do
89
+ @client.get_lowest_offer_listings_for_sku('1')
90
+ end
91
+
92
+ assert_equal operation, @client.operation
93
+ end
94
+
95
+ def test_gets_lowest_offer_listings_for_asin
96
+ operation = {
97
+ 'Action' => 'GetLowestOfferListingsForASIN',
98
+ 'MarketplaceId' => '123',
99
+ 'ASINList.ASIN.1' => '1'
100
+ }
101
+
102
+ @client.stub(:run, nil) do
103
+ @client.get_lowest_offer_listings_for_asin('1')
104
+ end
105
+
106
+ assert_equal operation, @client.operation
107
+ end
108
+
109
+ def test_gets_my_price_for_sku
110
+ operation = {
111
+ 'Action' => 'GetMyPriceForSKU',
112
+ 'MarketplaceId' => '123',
113
+ 'SellerSKUList.SellerSKU.1' => '1'
114
+ }
115
+
116
+ @client.stub(:run, nil) do
117
+ @client.get_my_price_for_sku('1')
118
+ end
119
+
120
+ assert_equal operation, @client.operation
121
+ end
122
+
123
+ def test_gets_my_price_for_asin
124
+ operation = {
125
+ 'Action' => 'GetMyPriceForASIN',
126
+ 'MarketplaceId' => '123',
127
+ 'ASINList.ASIN.1' => '1'
128
+ }
129
+
130
+ @client.stub(:run, nil) do
131
+ @client.get_my_price_for_asin('1')
132
+ end
133
+
134
+ assert_equal operation, @client.operation
135
+ end
136
+
137
+ def test_gets_product_categories_for_sku
138
+ operation = {
139
+ 'Action' => 'GetProductCategoriesForSKU',
140
+ 'MarketplaceId' => '123',
141
+ 'SellerSKU' => '1'
142
+ }
143
+
144
+ @client.stub(:run, nil) do
145
+ @client.get_product_categories_for_sku('1')
146
+ end
147
+
148
+ assert_equal operation, @client.operation
149
+ end
150
+
151
+ def test_gets_product_categories_for_asin
152
+ operation = {
153
+ 'Action' => 'GetProductCategoriesForASIN',
154
+ 'MarketplaceId' => '123',
155
+ 'ASIN' => '1'
156
+ }
157
+
158
+ @client.stub(:run, nil) do
159
+ @client.get_product_categories_for_asin('1')
160
+ end
161
+
162
+ assert_equal operation, @client.operation
12
163
  end
13
164
 
14
165
  def test_gets_service_status
@@ -22,6 +173,4 @@ class TestProductsClient < MiniTest::Test
22
173
 
23
174
  assert_equal operation, @client.operation
24
175
  end
25
-
26
- # FIXME Fill in tests for operations
27
176
  end