active_fulfillment 3.2.0 → 3.2.1

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: 896f8d4e8c451d593ead06905c6914bf5a34d62f
4
- data.tar.gz: bbe1f6a4ed91ddb19b23048a8353204a3f64dea4
3
+ metadata.gz: 804e3e5791d47c2869a62f774dcc13c0ca086fd8
4
+ data.tar.gz: acc14cb632a432229594ed0de859026a71a778ea
5
5
  SHA512:
6
- metadata.gz: bf5daad36c2acd832108700225641ecd2171e43735d4a0856016c18e5863a0bc204d980e399c9332687cfdde5a18cc79b606155fb7d01f69fff10c694939036e
7
- data.tar.gz: b19394f446f02846b7ea61088dde163c7cfb86c7e32974e45103150fcc7495c46249603b113fd74ea907618d93a8bebde70f6afb493a38acdfa34a4f8a431aef
6
+ metadata.gz: ab2f0781d5aee8b146f740b754b8a7219f89509dd0219e0ebf490b1293b3d4009c67c3602039f1bbc897180f8f7ca0942efbdba3f8c74392c07eefc406ecc4b3
7
+ data.tar.gz: 86a092f5142799e14d2d440319daa2381812bf53ed97f43300796c45eb1b69581dcf9d036406bff93f5c5fd92248af18c4e61a41ff6b7b77ae68c4e71b98fdd3
data/CHANGELOG.md CHANGED
@@ -1,9 +1,19 @@
1
1
  # ActiveFulfillment changelog
2
2
 
3
+ ### Version 3.2.1
4
+
5
+ - Allow truncating the Amazon response log.
6
+
7
+ ### Version 3.2.0
8
+
9
+ - Add support for ActiveSupport 5.1
10
+
3
11
  ### Version 3.1.1 (March 2017)
12
+
4
13
  - Bump Nokogiri dependency >= 1.6.8.
5
14
 
6
15
  ### Version 3.1.0 (March 2017)
16
+
7
17
  - Update dependencies
8
18
 
9
19
  ### Version 3.0.1 (January 2015)
@@ -74,6 +74,7 @@ module ActiveFulfillment
74
74
  requires!(options, :login, :password)
75
75
  @seller_id = options[:seller_id]
76
76
  @mws_auth_token = options[:mws_auth_token]
77
+ @maximum_response_log_size = options[:maximum_response_log_size] || 0
77
78
  super
78
79
  end
79
80
 
@@ -172,7 +173,8 @@ module ActiveFulfillment
172
173
 
173
174
  logger.info "[#{self.class}][#{action}] query=#{log_query}"
174
175
  data = ssl_post(uri.to_s, query, headers)
175
- logger.info "[#{self.class}][#{action}] response=#{data}"
176
+ log_data = truncate_long_response(data)
177
+ logger.info "[#{self.class}][#{action}] response=#{log_data}"
176
178
  data
177
179
  end
178
180
 
@@ -438,6 +440,14 @@ module ActiveFulfillment
438
440
  sleep(throttle_options[:sleep_time]) if (index % interval).zero?
439
441
  end
440
442
 
443
+ def truncate_long_response(data)
444
+ return data unless @maximum_response_log_size > 0
445
+ return data unless @maximum_response_log_size < data.length
446
+
447
+ truncated = data.slice(0, @maximum_response_log_size)
448
+ "#{truncated}[...TRUNCATED...]"
449
+ end
450
+
441
451
  def secure_compare(a, b)
442
452
  return false unless a.bytesize == b.bytesize
443
453
 
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module ActiveFulfillment
3
- VERSION = "3.2.0"
3
+ VERSION = "3.2.1"
4
4
  end
@@ -295,6 +295,27 @@ class AmazonMarketplaceWebServiceTest < Minitest::Test
295
295
  assert_equal 199, response.stock_levels['GN-00-02A']
296
296
  end
297
297
 
298
+ def test_truncated_logging
299
+ service = ActiveFulfillment::AmazonMarketplaceWebService.new(
300
+ :login => 'login',
301
+ :password => 'password',
302
+ :maximum_response_log_size => 9
303
+ )
304
+ service.expects(:ssl_post).with do |uri, _, _|
305
+ assert_equal 'https://mws.amazonservices.com/FulfillmentInventory/2010-10-01', uri
306
+ end.returns(xml_fixture('amazon_mws/inventory_list_inventory_supply'))
307
+
308
+ messages = []
309
+ service.class.logger.expects(:info).with { |message| messages << message }.twice
310
+
311
+ service.fetch_stock_levels
312
+
313
+ assert_equal(
314
+ "[ActiveFulfillment::AmazonMarketplaceWebService][FulfillmentInventory] response=<?xml ver[...TRUNCATED...]",
315
+ messages[1]
316
+ )
317
+ end
318
+
298
319
  def test_get_inventory_multipage
299
320
  @service.expects(:ssl_post).with() { |uri, query, headers|
300
321
  assert_equal 'https://mws.amazonservices.com/FulfillmentInventory/2010-10-01', uri
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.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Fauser
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-05-18 00:00:00.000000000 Z
12
+ date: 2017-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport