endicia_ruby 0.2.4 → 0.2.5

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
  SHA256:
3
- metadata.gz: 2cdc079607f4c753f5db554c3053a7a6a236562ec2dd90629a69c1dc298a9747
4
- data.tar.gz: 85c06e55fe903f27b7e9aa7af859a8473cf452f98f4f50627f402785e28d0875
3
+ metadata.gz: 75d9de0c42a228aa96632899b3b6842f47b78aa2aa685aaea4b91f067748acf7
4
+ data.tar.gz: 4bea5eba4b75b4a4d8d452e4eb243f50c8873d846af7ba0cbc446ced60945081
5
5
  SHA512:
6
- metadata.gz: 379a20445062689aec87ba460a7674cd5c6fbd0d6ce7b1ae2ff2dbb362c713a24fee21d44f5f4c19ba1b709c311d4489e433189ed79b3954031a19458bd05004
7
- data.tar.gz: 868de66b68e2d7733af244a91f7b6c334491d0dcc71834681f801cfe27489c0a40f638c9283ecbfe66d4a69542f4496e133b633af936c91949e6313a24aa8baa
6
+ metadata.gz: a436147ebe59068cb790cb70d2a558d66e0e66fde113b632d3e146ce4d52fc9721d91d284867a0b2631f9dc30e83f87624974d87e3b92872cbe3f1dfadd79488
7
+ data.tar.gz: 8abf87be5579c29b96c277678eb10d4cb80225774a0cb4880c5811af9380a3044e98c7a30fd06142b80636ad161e1f6ed0e75b2dfc5837fac6df81c345f9c6b3
@@ -81,7 +81,7 @@ module Endicia
81
81
 
82
82
  def filter_response_body(string)
83
83
  # Strip image data for readability:
84
- string.sub(/<([[:alnum:]]*Image)>.+?<\/[[:alnum:]]*Image>/, '<\1>[data]</\1>')
84
+ string.gsub(/<((Base64Label)?Image( PartNumber=\"\d+\")?)>.+?<\/((Base64Label)?Image)>/, '<\1>[data]</\4>')
85
85
  end
86
86
  end
87
87
  end
@@ -1,3 +1,3 @@
1
1
  module Endicia
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -25,9 +25,10 @@ describe Endicia::LabelResponse do
25
25
  "RequestUrl" => Faker::Lorem.sentence,
26
26
  "Ignored" => Faker::Lorem.sentence,
27
27
  },
28
- body: "<Image>ksadjhfalskjfhalsjfhaslfjhasdljkf</Image>"
28
+ body: image_body
29
29
  )
30
30
  }
31
+ let(:image_body) { "<Image>ksadjhfalskjfhalsjfhaslfjhasdljkf</Image>" }
31
32
  let(:expected_image_value) { Faker::Lorem.sentence }
32
33
  let(:different_image_value) { "a throwaway addendum" }
33
34
  let(:image_key) { "Base64LabelImage" }
@@ -82,18 +83,23 @@ describe Endicia::LabelResponse do
82
83
  it "translates Base64LabelImage to 'image'" do
83
84
  expect(response.image).to eq(expected_image_value)
84
85
  end
86
+
87
+ it "masks data in the body" do
88
+ expect(response.response_body).to eq("<Image>[data]</Image>")
89
+ end
85
90
  end
86
91
 
87
92
  context "when there are multiple Image parts" do
93
+ let(:image_body) { '<Image PartNumber="1">ksadjhfalskjfhalsjfhaslfjhasdljkf</Image><Image PartNumber="2">taoenusaoetuhnoaeuteoa</Image>' }
88
94
  let(:image_key) { "Label" }
89
95
  let(:image_value) {
90
96
  {
91
97
  "Image" => [
92
98
  {
93
- "__content__" => expected_image_value
99
+ "__content__" => expected_image_value,
94
100
  },
95
101
  {
96
- "__content__" => different_image_value
102
+ "__content__" => different_image_value,
97
103
  },
98
104
  ],
99
105
  }
@@ -102,6 +108,10 @@ describe Endicia::LabelResponse do
102
108
  it "translates the first Image part to 'image'" do
103
109
  expect(response.image).to eq(expected_image_value)
104
110
  end
111
+
112
+ it "masks data in the body" do
113
+ expect(response.response_body).to eq('<Image PartNumber="1">[data]</Image><Image PartNumber="2">[data]</Image>')
114
+ end
105
115
  end
106
116
  end
107
117
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: endicia_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Dean
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-02-14 00:00:00.000000000 Z
12
+ date: 2018-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri