active_fulfillment 3.0.0.pre7 → 3.0.0.pre8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29a4fec3de142f490e9532546920f1badabb155f
4
- data.tar.gz: 3a603f15f239767db8ca8bb3749f0501a64ab44d
3
+ metadata.gz: 81e4d46fc9e29790dedd89eeab465416f9bc2b8e
4
+ data.tar.gz: f8b1cb46b86a27625bb50fc3a68e4c301eed1315
5
5
  SHA512:
6
- metadata.gz: 7775f6ec5b95a3750097587b34a73fba8ec83905167826aea18d355f099e717f7fb31eeb610ab8895d487e8d626c1c148f792e06e8baf331d2ba087a19ec6ee2
7
- data.tar.gz: f3d6f781d3b23b7fb81a093c586855ed4f4bdd0a6a24b42fa4f88c6fffe4017e8bd388fdfed31927f0c0892984c86ea1a73f82dd65439859438d1b0c8b167454
6
+ metadata.gz: faff4e5e9c15dda5586ead4afcb10a973d78ddbf56f4bac42ae7403e7a90ff1f2558287ee23e0878c08dc0bea01259ad03d28a47ce12fcdc63a3c8a7b28285e5
7
+ data.tar.gz: 06bbeab03d5155dd553af4ffe72fae585aeb06764e904218f5310e75c6f04933e90b0adeb71a95da7289b7efd9953ef40ed0f10ee01f5bbb72c12488268e1393
@@ -85,21 +85,21 @@ module ActiveFulfillment
85
85
  def fulfill(order_id, shipping_address, line_items, options = {})
86
86
  requires!(options, :order_date, :shipping_method)
87
87
  with_error_handling do
88
- data = commit :post, 'CreateFulfillmentOrder', build_fulfillment_request(order_id, shipping_address, line_items, options)
88
+ data = commit :post, 'FulfillmentOutboundShipment', build_fulfillment_request(order_id, shipping_address, line_items, options)
89
89
  parse_fulfillment_response(parse_document(data), 'Successfully submitted the order')
90
90
  end
91
91
  end
92
92
 
93
93
  def status
94
94
  with_error_handling do
95
- data = commit :post, 'GetServiceStatus', build_basic_api_query({ :Action => 'GetServiceStatus' })
95
+ data = commit :post, 'FulfillmentOutboundShipment', build_basic_api_query({ :Action => 'GetServiceStatus' })
96
96
  parse_tracking_response(parse_document(data))
97
97
  end
98
98
  end
99
99
 
100
100
  def fetch_current_orders
101
101
  with_error_handling do
102
- data = commit :post, 'GetServiceStatus', build_get_current_fulfillment_orders_request
102
+ data = commit :post, 'FulfillmentOutboundShipment', build_get_current_fulfillment_orders_request
103
103
  parse_tracking_response(parse_document(data))
104
104
  end
105
105
  end
@@ -107,12 +107,12 @@ module ActiveFulfillment
107
107
  def fetch_stock_levels(options = {})
108
108
  options[:skus] = [options.delete(:sku)] if options.include?(:sku)
109
109
  response = with_error_handling do
110
- data = commit :post, 'ListInventorySupply', build_inventory_list_request(options)
110
+ data = commit :post, 'FulfillmentInventory', build_inventory_list_request(options)
111
111
  parse_inventory_response(parse_document(data))
112
112
  end
113
113
  while token = response.params['next_token'] do
114
114
  next_page = with_error_handling do
115
- data = commit :post, 'ListInventorySupplyByNextToken', build_next_inventory_list_request(token)
115
+ data = commit :post, 'FulfillmentInventory', build_next_inventory_list_request(token)
116
116
  parse_inventory_response(parse_document(data))
117
117
  end
118
118
 
@@ -130,7 +130,7 @@ module ActiveFulfillment
130
130
  order_ids.reduce(nil) do |previous, order_id|
131
131
  index += 1
132
132
  response = with_error_handling do
133
- data = commit :post, 'GetFulfillmentOrder', build_tracking_request(order_id, options)
133
+ data = commit :post, 'FulfillmentOutboundShipment', build_tracking_request(order_id, options)
134
134
  parse_tracking_response(parse_document(data))
135
135
  end
136
136
 
@@ -241,7 +241,6 @@ module ActiveFulfillment
241
241
  response[:next_token] = next_token ? next_token.text : nil
242
242
 
243
243
  response[:response_status] = SUCCESS
244
- response
245
244
  Response.new(success?(response), message_from(response), response)
246
245
  end
247
246
 
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module ActiveFulfillment
3
- VERSION = "3.0.0.pre7"
3
+ VERSION = "3.0.0.pre8"
4
4
  end
@@ -245,7 +245,9 @@ class AmazonMarketplaceWebServiceTest < Minitest::Test
245
245
  end
246
246
 
247
247
  def test_successful_fulfillment
248
- @service.expects(:ssl_post).returns(successful_fulfillment_response)
248
+ @service.expects(:ssl_post).with do |uri, query, headers|
249
+ assert_equal 'https://mws.amazonservices.com/FulfillmentOutboundShipment/2010-10-01', uri
250
+ end.returns(successful_fulfillment_response)
249
251
  response = @service.fulfill('12345678', @address, @line_items, @options)
250
252
  assert response.success?
251
253
  end
@@ -276,7 +278,9 @@ class AmazonMarketplaceWebServiceTest < Minitest::Test
276
278
  end
277
279
 
278
280
  def test_get_inventory
279
- @service.expects(:ssl_post).returns(xml_fixture('amazon_mws/inventory_list_inventory_supply'))
281
+ @service.expects(:ssl_post).with do |uri, _, _|
282
+ assert_equal 'https://mws.amazonservices.com/FulfillmentInventory/2010-10-01', uri
283
+ end.returns(xml_fixture('amazon_mws/inventory_list_inventory_supply'))
280
284
 
281
285
  @service.class.logger.expects(:info).with do |message|
282
286
  assert_match /ListInventorySupply/, message unless message.include?('ListInventorySupplyResult')
@@ -293,10 +297,12 @@ class AmazonMarketplaceWebServiceTest < Minitest::Test
293
297
 
294
298
  def test_get_inventory_multipage
295
299
  @service.expects(:ssl_post).with() { |uri, query, headers|
300
+ assert_equal 'https://mws.amazonservices.com/FulfillmentInventory/2010-10-01', uri
296
301
  query.include?('ListInventorySupply') && !query.include?('ListInventorySupplyByNextToken')
297
302
  }.returns(xml_fixture('amazon_mws/inventory_list_inventory_supply_by_next_token'))
298
303
 
299
304
  @service.expects(:ssl_post).with() { |uri, query, headers|
305
+ assert_equal 'https://mws.amazonservices.com/FulfillmentInventory/2010-10-01', uri
300
306
  assert query.include?('login')
301
307
  query.include?('ListInventorySupplyByNextToken') && query.include?('NextToken')
302
308
  }.returns(xml_fixture('amazon_mws/inventory_list_inventory_supply'))
@@ -312,15 +318,15 @@ class AmazonMarketplaceWebServiceTest < Minitest::Test
312
318
 
313
319
  def test_get_inventory_multipage_missing_stock
314
320
 
315
- @service.expects(:ssl_post).with() { |uri, query, headers|
321
+ @service.expects(:ssl_post).with { |uri, query, headers|
316
322
  query.include?('ListInventorySupply') && !query.include?('ListInventorySupplyByNextToken')
317
323
  }.returns(xml_fixture('amazon_mws/inventory_list_inventory_supply_by_next_token'))
318
324
 
319
325
  # force missing stock by returning token'd ssl_post with a 503 error
320
326
  http_response = build_mock_response(response_from_503, "", 503)
321
- @service.expects(:ssl_post).with() { |uri, query, headers|
327
+ @service.expects(:ssl_post).with do |uri, query, headers|
322
328
  query.include?('ListInventorySupplyByNextToken') && query.include?('NextToken')
323
- }.raises(ActiveUtils::ResponseError.new(http_response))
329
+ end.raises(ActiveUtils::ResponseError.new(http_response))
324
330
 
325
331
  response = @service.fetch_stock_levels
326
332
  assert !response.success?
@@ -332,8 +338,9 @@ class AmazonMarketplaceWebServiceTest < Minitest::Test
332
338
  end
333
339
 
334
340
  def test_fetch_tracking_numbers
335
- @service.expects(:ssl_post).twice.
336
- returns(xml_fixture('amazon_mws/fulfillment_get_fulfillment_order')).
341
+ @service.expects(:ssl_post).twice.with do |uri, query, headers|
342
+ assert_equal 'https://mws.amazonservices.com/FulfillmentOutboundShipment/2010-10-01', uri
343
+ end.returns(xml_fixture('amazon_mws/fulfillment_get_fulfillment_order')).
337
344
  returns(xml_fixture('amazon_mws/fulfillment_get_fulfillment_order_2'))
338
345
 
339
346
  response = @service.fetch_tracking_numbers(['extern_id_1154539615776', 'extern_id_1154539615777'])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_fulfillment
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre7
4
+ version: 3.0.0.pre8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Fauser