mws_rb 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +2 -0
  5. data/.ruby-gemset +1 -0
  6. data/.travis.yml +9 -0
  7. data/CHANGELOG.md +43 -0
  8. data/Gemfile +3 -0
  9. data/Guardfile +12 -0
  10. data/LICENSE +20 -0
  11. data/README.markdown +73 -0
  12. data/Rakefile +1 -0
  13. data/lib/mws.rb +51 -0
  14. data/lib/mws/api/base.rb +55 -0
  15. data/lib/mws/api/feeds.rb +30 -0
  16. data/lib/mws/api/feeds/envelope.rb +84 -0
  17. data/lib/mws/api/feeds/xsd/AdditionalProductInformation.xsd +23 -0
  18. data/lib/mws/api/feeds/xsd/Amazon.xsd +94 -0
  19. data/lib/mws/api/feeds/xsd/Arts.xsd +144 -0
  20. data/lib/mws/api/feeds/xsd/AutoAccessory.xsd +1714 -0
  21. data/lib/mws/api/feeds/xsd/Baby.xsd +206 -0
  22. data/lib/mws/api/feeds/xsd/Beauty.xsd +170 -0
  23. data/lib/mws/api/feeds/xsd/Books.xsd +135 -0
  24. data/lib/mws/api/feeds/xsd/CE.xsd +2878 -0
  25. data/lib/mws/api/feeds/xsd/CameraPhoto.xsd +2612 -0
  26. data/lib/mws/api/feeds/xsd/ClothingAccessories.xsd +128 -0
  27. data/lib/mws/api/feeds/xsd/Computers.xsd +2347 -0
  28. data/lib/mws/api/feeds/xsd/EUCompliance.xsd +24 -0
  29. data/lib/mws/api/feeds/xsd/EntertainmentCollectibles.xsd +99 -0
  30. data/lib/mws/api/feeds/xsd/FBA.xsd +28 -0
  31. data/lib/mws/api/feeds/xsd/FoodAndBeverages.xsd +1000 -0
  32. data/lib/mws/api/feeds/xsd/FoodServiceAndJanSan.xsd +216 -0
  33. data/lib/mws/api/feeds/xsd/FulfillmentCenter.xsd +57 -0
  34. data/lib/mws/api/feeds/xsd/GiftCards.xsd +97 -0
  35. data/lib/mws/api/feeds/xsd/Gourmet.xsd +85 -0
  36. data/lib/mws/api/feeds/xsd/Health.xsd +335 -0
  37. data/lib/mws/api/feeds/xsd/Home.xsd +1362 -0
  38. data/lib/mws/api/feeds/xsd/HomeImprovement.xsd +1065 -0
  39. data/lib/mws/api/feeds/xsd/Industrial.xsd +315 -0
  40. data/lib/mws/api/feeds/xsd/Inventory.xsd +49 -0
  41. data/lib/mws/api/feeds/xsd/Jewelry.xsd +916 -0
  42. data/lib/mws/api/feeds/xsd/LabSupplies.xsd +178 -0
  43. data/lib/mws/api/feeds/xsd/LargeAppliances.xsd +646 -0
  44. data/lib/mws/api/feeds/xsd/Lighting.xsd +243 -0
  45. data/lib/mws/api/feeds/xsd/Listings.xsd +32 -0
  46. data/lib/mws/api/feeds/xsd/Luggage.xsd +93 -0
  47. data/lib/mws/api/feeds/xsd/MechanicalFasteners.xsd +172 -0
  48. data/lib/mws/api/feeds/xsd/Miscellaneous.xsd +157 -0
  49. data/lib/mws/api/feeds/xsd/Motorcycles.xsd +348 -0
  50. data/lib/mws/api/feeds/xsd/Music.xsd +251 -0
  51. data/lib/mws/api/feeds/xsd/MusicalInstruments.xsd +853 -0
  52. data/lib/mws/api/feeds/xsd/Office.xsd +586 -0
  53. data/lib/mws/api/feeds/xsd/OrderAcknowledgement.xsd +55 -0
  54. data/lib/mws/api/feeds/xsd/OrderAdjustment.xsd +175 -0
  55. data/lib/mws/api/feeds/xsd/OrderFulfillment.xsd +57 -0
  56. data/lib/mws/api/feeds/xsd/Override.xsd +48 -0
  57. data/lib/mws/api/feeds/xsd/PetSupplies.xsd +197 -0
  58. data/lib/mws/api/feeds/xsd/PowerTransmission.xsd +87 -0
  59. data/lib/mws/api/feeds/xsd/Price.xsd +59 -0
  60. data/lib/mws/api/feeds/xsd/ProcessingReport.xsd +87 -0
  61. data/lib/mws/api/feeds/xsd/Product.xsd +399 -0
  62. data/lib/mws/api/feeds/xsd/ProductClothing.xsd +285 -0
  63. data/lib/mws/api/feeds/xsd/ProductImage.xsd +39 -0
  64. data/lib/mws/api/feeds/xsd/RawMaterials.xsd +125 -0
  65. data/lib/mws/api/feeds/xsd/Relationship.xsd +47 -0
  66. data/lib/mws/api/feeds/xsd/SWVG.xsd +345 -0
  67. data/lib/mws/api/feeds/xsd/SettlementReport.xsd +158 -0
  68. data/lib/mws/api/feeds/xsd/Shoes.xsd +213 -0
  69. data/lib/mws/api/feeds/xsd/Sports.xsd +772 -0
  70. data/lib/mws/api/feeds/xsd/SportsMemorabilia.xsd +55 -0
  71. data/lib/mws/api/feeds/xsd/TiresAndWheels.xsd +159 -0
  72. data/lib/mws/api/feeds/xsd/Tools.xsd +82 -0
  73. data/lib/mws/api/feeds/xsd/Toys.xsd +272 -0
  74. data/lib/mws/api/feeds/xsd/ToysBaby.xsd +335 -0
  75. data/lib/mws/api/feeds/xsd/Video.xsd +406 -0
  76. data/lib/mws/api/feeds/xsd/WineAndAlcohol.xsd +181 -0
  77. data/lib/mws/api/feeds/xsd/Wireless.xsd +128 -0
  78. data/lib/mws/api/feeds/xsd/amzn-base.xsd +4350 -0
  79. data/lib/mws/api/feeds/xsd/amzn-envelope.xsd +98 -0
  80. data/lib/mws/api/feeds/xsd/amzn-header.xsd +45 -0
  81. data/lib/mws/api/fulfillment_inbound_shipment.rb +16 -0
  82. data/lib/mws/api/fulfillment_inventory.rb +14 -0
  83. data/lib/mws/api/fulfillment_outbound_shipment.rb +24 -0
  84. data/lib/mws/api/orders.rb +16 -0
  85. data/lib/mws/api/products.rb +19 -0
  86. data/lib/mws/api/recommendations.rb +14 -0
  87. data/lib/mws/api/reports.rb +17 -0
  88. data/lib/mws/api/sellers.rb +18 -0
  89. data/lib/mws/api/subscriptions.rb +15 -0
  90. data/lib/mws/connection.rb +56 -0
  91. data/lib/mws/query.rb +104 -0
  92. data/lib/mws/version.rb +4 -0
  93. data/mws_rb.gemspec +32 -0
  94. data/spec/fixtures/vcr_cassettes/feeds/submit_feed/invalid_request.yml +194 -0
  95. data/spec/fixtures/vcr_cassettes/feeds/submit_feed/text_request.yml +188 -0
  96. data/spec/fixtures/vcr_cassettes/feeds/submit_feed/xml_request.yml +224 -0
  97. data/spec/mws-rb/api/base_spec.rb +48 -0
  98. data/spec/mws-rb/api/feeds/envelope/general_spec.rb +31 -0
  99. data/spec/mws-rb/api/feeds/envelope/xml_building_spec.rb +101 -0
  100. data/spec/mws-rb/api/feeds_spec.rb +88 -0
  101. data/spec/mws-rb/api/fulfillment_inbound_shipment_spec.rb +24 -0
  102. data/spec/mws-rb/api/fulfillment_inventory_spec.rb +24 -0
  103. data/spec/mws-rb/api/fulfillment_outbound_shipment_spec.rb +24 -0
  104. data/spec/mws-rb/api/orders_spec.rb +24 -0
  105. data/spec/mws-rb/api/products_spec.rb +24 -0
  106. data/spec/mws-rb/api/recommendations_spec.rb +24 -0
  107. data/spec/mws-rb/api/reports_spec.rb +24 -0
  108. data/spec/mws-rb/api/sellers_spec.rb +28 -0
  109. data/spec/mws-rb/api/subscriptions_spec.rb +24 -0
  110. data/spec/mws-rb/connection_spec.rb +77 -0
  111. data/spec/mws-rb/mws_spec.rb +12 -0
  112. data/spec/mws-rb/query_spec.rb +150 -0
  113. data/spec/spec_helper.rb +17 -0
  114. metadata +310 -0
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe MWS::API::Base do
4
+ let(:connection) do
5
+ MWS::Connection.new(aws_access_key_id: 'access key',
6
+ aws_secret_access_key: 'secret key',
7
+ seller_id: 'seller id',
8
+ mws_auth_token: 'auth token')
9
+ end
10
+
11
+ let(:base) { MWS::API::Base.new(connection) }
12
+
13
+ it 'should receive a connection object' do
14
+ expect(base.connection).to eq(connection)
15
+ end
16
+
17
+ it 'should respond to .call' do
18
+ expect(base).to respond_to(:call)
19
+ end
20
+
21
+ it 'should respond to :uri and :version and :verb' do
22
+ expect(base).to respond_to(:uri)
23
+ expect(base).to respond_to(:version)
24
+ expect(base).to respond_to(:verb)
25
+ end
26
+
27
+ it 'should set :verb to :get as default' do
28
+ expect(base.verb).to eq(:get)
29
+ end
30
+
31
+ describe 'method_missing to call actions' do
32
+ class TestApi < MWS::API::Base
33
+ ACTIONS = [:test_action]
34
+ def initialize(connection)
35
+ @uri = '/Products/2011-10-01'
36
+ @version = '2011-10-01'
37
+ super(connection)
38
+ end
39
+ end
40
+
41
+ let(:test_api) { TestApi.new(connection) }
42
+ before(:each) { allow(HTTParty).to receive(:get).and_return({}) }
43
+
44
+ it 'should raise exception if Actions do not contain the action name' do
45
+ expect { test_api.action_not_found }.to raise_error(NoMethodError)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe MWS::API::Feeds::Envelope do
4
+ it 'should validate the envelope' do
5
+ expect do
6
+ MWS::API::Feeds::Envelope.new(message_type: 'InvalidMessageType', message: { 'InvalidItem' => 'Invalid' })
7
+ end.to raise_error RuntimeError
8
+ end
9
+
10
+ it 'accepts text based envelope' do
11
+ expect(MWS::API::Feeds::Envelope.new(type: :text, message: 'test').to_s).to eq('test')
12
+ end
13
+
14
+ it 'should skip validation when param skip_schema_validation is true' do
15
+ MWS::API::Feeds::Envelope.new(message_type: 'InvalidMessageType', message: { 'InvalidItem' => 'Invalid' }, skip_schema_validation: true)
16
+ end
17
+
18
+ it 'should remove array items' do
19
+ envelope = MWS::API::Feeds::Envelope.new(
20
+ message_type: 'InvalidMessageType',
21
+ message: {
22
+ 'Items' => [{ item_1: '1' }, { item_2: '2' }],
23
+ 'Inventories' => [{ inventory_1: '1' }]
24
+ },
25
+ skip_schema_validation: true)
26
+
27
+ expect(envelope.to_s.include?('Items')).to eq(false)
28
+ expect(envelope.to_s.include?('Inventories')).to eq(false)
29
+ expect(envelope.to_s.include?('array')).to eq(false)
30
+ end
31
+ end
@@ -0,0 +1,101 @@
1
+ require 'spec_helper'
2
+
3
+ describe MWS::API::Feeds::Envelope, 'built xml' do
4
+ subject { described_class.new(params) }
5
+
6
+ context 'when passed message param' do
7
+ let(:params) do
8
+ { feed_type: '_POST_INVENTORY_AVAILABILITY_DATA_',
9
+ message_type: :inventory,
10
+ message: {
11
+ 'MessageID' => '123123123',
12
+ 'OperationType' => 'Update',
13
+ 'Inventory' => {
14
+ 'SKU' => 'ANY-SKU',
15
+ 'Quantity' => '50'
16
+ } } }
17
+ end
18
+
19
+ it 'should contain passed data' do
20
+ expect(subject.to_s).to include("<MessageType>Inventory</MessageType><PurgeAndReplace>false</PurgeAndReplace><Message>\n <MessageID>123123123</MessageID>\n <OperationType>Update</OperationType>\n <Inventory>\n <SKU>ANY-SKU</SKU>\n <Quantity>50</Quantity>\n </Inventory>\n</Message>")
21
+ end
22
+
23
+ it 'should be valid' do
24
+ expect(subject).to be_valid
25
+ end
26
+ end
27
+
28
+ context 'when passed \'messages\' param' do
29
+ let(:params) do
30
+ { feed_type: '_POST_INVENTORY_AVAILABILITY_DATA_',
31
+ message_type: :inventory,
32
+ messages: [
33
+ {
34
+ 'MessageID' => '123123123',
35
+ 'OperationType' => 'Update',
36
+ 'Inventory' => {
37
+ 'SKU' => 'ANY-SKU',
38
+ 'Quantity' => '50'
39
+ }
40
+ },
41
+ { 'MessageID' => '321321321',
42
+ 'OperationType' => 'Update',
43
+ 'Inventory' => {
44
+ 'SKU' => 'ANY-OTHER-SKU',
45
+ 'Quantity' => '10'
46
+ }
47
+ }] }
48
+ end
49
+
50
+ it 'should contain passed data of each message' do
51
+ expect(subject.to_s).to include("<MessageType>Inventory</MessageType><PurgeAndReplace>false</PurgeAndReplace><Message>\n <MessageID>123123123</MessageID>\n <OperationType>Update</OperationType>\n <Inventory>\n <SKU>ANY-SKU</SKU>\n <Quantity>50</Quantity>\n </Inventory>\n</Message>")
52
+ expect(subject.to_s).to include("<Message>\n <MessageID>321321321</MessageID>\n <OperationType>Update</OperationType>\n <Inventory>\n <SKU>ANY-OTHER-SKU</SKU>\n <Quantity>10</Quantity>\n </Inventory>\n</Message>")
53
+ end
54
+
55
+ it 'should be valid' do
56
+ expect(subject).to be_valid
57
+ end
58
+ end
59
+
60
+ context 'when passed \'message\' and \'messages\'' do
61
+ let(:multiple_messages) do
62
+ { messages: [
63
+ {
64
+ 'MessageID' => '123123123',
65
+ 'OperationType' => 'Update',
66
+ 'Inventory' => {
67
+ 'SKU' => 'ANY-SKU',
68
+ 'Quantity' => '50'
69
+ }
70
+ },
71
+ { 'MessageID' => '321321321',
72
+ 'OperationType' => 'Update',
73
+ 'Inventory' => {
74
+ 'SKU' => 'ANY-OTHER-SKU',
75
+ 'Quantity' => '10'
76
+ }
77
+ }] }
78
+ end
79
+
80
+ let(:single_message) do
81
+ { message: {
82
+ 'MessageID' => '987654321',
83
+ 'OperationType' => 'Update',
84
+ 'Inventory' => {
85
+ 'SKU' => 'SINGLE-SKU',
86
+ 'Quantity' => '20'
87
+ } } }
88
+ end
89
+
90
+ let(:params) do
91
+ { feed_type: '_POST_INVENTORY_AVAILABILITY_DATA_',
92
+ message_type: :inventory }.merge(multiple_messages).merge(single_message)
93
+ end
94
+
95
+ it 'should contain info from all of these keys' do
96
+ expect(subject.to_s).to include("<Message>\n <MessageID>123123123</MessageID>\n <OperationType>Update</OperationType>\n <Inventory>\n <SKU>ANY-SKU</SKU>\n <Quantity>50</Quantity>\n </Inventory>\n</Message>")
97
+ expect(subject.to_s).to include("<Message>\n <MessageID>321321321</MessageID>\n <OperationType>Update</OperationType>\n <Inventory>\n <SKU>ANY-OTHER-SKU</SKU>\n <Quantity>10</Quantity>\n </Inventory>\n</Message>")
98
+ expect(subject.to_s).to include("<Message>\n <MessageID>987654321</MessageID>\n <OperationType>Update</OperationType>\n <Inventory>\n <SKU>SINGLE-SKU</SKU>\n <Quantity>20</Quantity>\n </Inventory>\n</Message>")
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,88 @@
1
+ require 'spec_helper'
2
+
3
+ describe MWS::API::Feeds do
4
+ let(:connection) do
5
+ MWS::Connection.new(aws_access_key_id: 'access key',
6
+ aws_secret_access_key: 'secret key',
7
+ seller_id: 'seller id',
8
+ mws_auth_token: 'auth token')
9
+ end
10
+
11
+ let(:feeds) { MWS::API::Feeds.new(connection) }
12
+
13
+ it 'should inheritance from MWS::API::Base' do
14
+ expect(MWS::API::Feeds.superclass).to eq(MWS::API::Base)
15
+ end
16
+
17
+ it 'should set the right :uri' do
18
+ expect(feeds.uri).to eq('/')
19
+ end
20
+
21
+ it 'should set the right :version' do
22
+ expect(feeds.version).to eq('2009-01-01')
23
+ end
24
+
25
+ describe '#submit_feed' do
26
+ let(:mws_api) do
27
+ MWS.new(
28
+ host: 'mws-eu.amazonservices.com',
29
+ aws_access_key_id: ENV['AWS_ACCESS_KEY'] || 'DUMMY_AWS_ACCESS_KEY',
30
+ aws_secret_access_key: ENV['AWS_SECRET_KEY'] || 'DUMMY_AWS_SECRET_KEY',
31
+ seller_id: ENV['AWS_SELLER_ID'] || 'DUMMY_AWS_SELLER_ID'
32
+ )
33
+ end
34
+
35
+ subject { mws_api.feeds.submit_feed(feed_data) }
36
+
37
+ context 'with xml request', vcr: { cassette_name: 'feeds/submit_feed/xml_request' } do
38
+ let(:feed_data) do
39
+ {
40
+ feed_type: '_POST_INVENTORY_AVAILABILITY_DATA_',
41
+ message_type: :inventory,
42
+ messages: [
43
+ {
44
+ 'MessageID' => (Time.now.to_i * rand).ceil.to_s,
45
+ 'OperationType' => 'Update',
46
+ 'Inventory' => {
47
+ 'SKU' => 'LG-WHITE-1389247',
48
+ 'Quantity' => '9'
49
+ }
50
+ }
51
+ ]
52
+ }
53
+ end
54
+
55
+ it 'returns a kind of hash' do
56
+ expect(subject).to be_kind_of(Hash)
57
+ end
58
+ end
59
+
60
+ context 'with text request', vcr: { cassette_name: 'feeds/submit_feed/text_request' } do
61
+ let(:feed_data) do
62
+ {
63
+ feed_type: '_POST_FLAT_FILE_INVLOADER_DATA_',
64
+ type: 'text',
65
+ message: "sku\tquantity\nLG-WHITE-1389247\t9"
66
+ }
67
+ end
68
+
69
+ it 'returns a kind of hash' do
70
+ expect(subject).to be_kind_of(Hash)
71
+ end
72
+ end
73
+
74
+ context 'with invalid request', vcr: { cassette_name: 'feeds/submit_feed/invalid_request' } do
75
+ let(:feed_data) do
76
+ {
77
+ # feed_type is missed
78
+ type: 'text',
79
+ message: "sku\tquantity\nLG-WHITE-1389247\t9"
80
+ }
81
+ end
82
+
83
+ it 'returns a kind of hash' do
84
+ expect(subject).to be_kind_of(Hash)
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe MWS::API::FulfillmentInboundShipment do
4
+ let(:connection) do
5
+ MWS::Connection.new(aws_access_key_id: 'access key',
6
+ aws_secret_access_key: 'secret key',
7
+ seller_id: 'seller id',
8
+ mws_auth_token: 'auth token')
9
+ end
10
+
11
+ let(:fulfillment_inbound_shipment) { MWS::API::FulfillmentInboundShipment.new(connection) }
12
+
13
+ it 'should inheritance from MWS::API::Base' do
14
+ expect(MWS::API::Feeds.superclass).to eq(MWS::API::Base)
15
+ end
16
+
17
+ it 'should set the right :uri' do
18
+ expect(fulfillment_inbound_shipment.uri).to eq('/FulfillmentInboundShipment/2010-10-01')
19
+ end
20
+
21
+ it 'should set the right :version' do
22
+ expect(fulfillment_inbound_shipment.version).to eq('2010-10-01')
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe MWS::API::FulfillmentInventory do
4
+ let(:connection) do
5
+ MWS::Connection.new(aws_access_key_id: 'access key',
6
+ aws_secret_access_key: 'secret key',
7
+ seller_id: 'seller id',
8
+ mws_auth_token: 'auth token')
9
+ end
10
+
11
+ let(:fulfillment_inventory) { MWS::API::FulfillmentInventory.new(connection) }
12
+
13
+ it 'should inheritance from MWS::API::Base' do
14
+ expect(MWS::API::FulfillmentInventory.superclass).to eq(MWS::API::Base)
15
+ end
16
+
17
+ it 'should set the right :uri' do
18
+ expect(fulfillment_inventory.uri).to eq('/FulfillmentInventory/2010-10-01')
19
+ end
20
+
21
+ it 'should set the right :version' do
22
+ expect(fulfillment_inventory.version).to eq('2010-10-01')
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe MWS::API::FulfillmentOutboundShipment do
4
+ let(:connection) do
5
+ MWS::Connection.new(aws_access_key_id: 'access key',
6
+ aws_secret_access_key: 'secret key',
7
+ seller_id: 'seller id',
8
+ mws_auth_token: 'auth token')
9
+ end
10
+
11
+ let(:fulfillment_outbound_shipment) { MWS::API::FulfillmentOutboundShipment.new(connection) }
12
+
13
+ it 'should inheritance from MWS::API::Base' do
14
+ expect(MWS::API::FulfillmentOutboundShipment.superclass).to eq(MWS::API::Base)
15
+ end
16
+
17
+ it 'should set the right :uri' do
18
+ expect(fulfillment_outbound_shipment.uri).to eq('/FulfillmentOutboundShipment/2010-10-01')
19
+ end
20
+
21
+ it 'should set the right :version' do
22
+ expect(fulfillment_outbound_shipment.version).to eq('2010-10-01')
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe MWS::API::Orders do
4
+ let(:connection) do
5
+ MWS::Connection.new(aws_access_key_id: 'access key',
6
+ aws_secret_access_key: 'secret key',
7
+ seller_id: 'seller id',
8
+ mws_auth_token: 'auth token')
9
+ end
10
+
11
+ let(:orders) { MWS::API::Orders.new(connection) }
12
+
13
+ it 'should inheritance from MWS::API::Base' do
14
+ expect(MWS::API::Orders.superclass).to eq(MWS::API::Base)
15
+ end
16
+
17
+ it 'should set the right :uri' do
18
+ expect(orders.uri).to eq('/Orders/2013-09-01')
19
+ end
20
+
21
+ it 'should set the right :version' do
22
+ expect(orders.version).to eq('2013-09-01')
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe MWS::API::Products do
4
+ let(:connection) do
5
+ MWS::Connection.new(aws_access_key_id: 'access key',
6
+ aws_secret_access_key: 'secret key',
7
+ seller_id: 'seller id',
8
+ mws_auth_token: 'auth token')
9
+ end
10
+
11
+ let(:orders) { MWS::API::Products.new(connection) }
12
+
13
+ it 'should inheritance from MWS::API::Base' do
14
+ expect(MWS::API::Products.superclass).to eq(MWS::API::Base)
15
+ end
16
+
17
+ it 'should set the right :uri' do
18
+ expect(orders.uri).to eq('/Products/2011-10-01')
19
+ end
20
+
21
+ it 'should set the right :version' do
22
+ expect(orders.version).to eq('2011-10-01')
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe MWS::API::Recommendations do
4
+ let(:connection) do
5
+ MWS::Connection.new(aws_access_key_id: 'access key',
6
+ aws_secret_access_key: 'secret key',
7
+ seller_id: 'seller id',
8
+ mws_auth_token: 'auth token')
9
+ end
10
+
11
+ let(:recommendations) { MWS::API::Recommendations.new(connection) }
12
+
13
+ it 'should inheritance from MWS::API::Base' do
14
+ expect(MWS::API::Recommendations.superclass).to eq(MWS::API::Base)
15
+ end
16
+
17
+ it 'should set the right :uri' do
18
+ expect(recommendations.uri).to eq('/Recommendations/2013-04-01')
19
+ end
20
+
21
+ it 'should set the right :version' do
22
+ expect(recommendations.version).to eq('2013-04-01')
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe MWS::API::Reports do
4
+ let(:connection) do
5
+ MWS::Connection.new(aws_access_key_id: 'access key',
6
+ aws_secret_access_key: 'secret key',
7
+ seller_id: 'seller id',
8
+ mws_auth_token: 'auth token')
9
+ end
10
+
11
+ let(:reports) { MWS::API::Reports.new(connection) }
12
+
13
+ it 'should inheritance from MWS::API::Base' do
14
+ expect(MWS::API::Reports.superclass).to eq(MWS::API::Base)
15
+ end
16
+
17
+ it 'should set the right :uri' do
18
+ expect(reports.uri).to eq('/')
19
+ end
20
+
21
+ it 'should set the right :version' do
22
+ expect(reports.version).to eq('2009-01-01')
23
+ end
24
+ end