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 +4 -4
- data/lib/endicia_ruby/label_response.rb +1 -1
- data/lib/endicia_ruby/version.rb +1 -1
- data/spec/label_response_spec.rb +13 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75d9de0c42a228aa96632899b3b6842f47b78aa2aa685aaea4b91f067748acf7
|
4
|
+
data.tar.gz: 4bea5eba4b75b4a4d8d452e4eb243f50c8873d846af7ba0cbc446ced60945081
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
84
|
+
string.gsub(/<((Base64Label)?Image( PartNumber=\"\d+\")?)>.+?<\/((Base64Label)?Image)>/, '<\1>[data]</\4>')
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
data/lib/endicia_ruby/version.rb
CHANGED
data/spec/label_response_spec.rb
CHANGED
@@ -25,9 +25,10 @@ describe Endicia::LabelResponse do
|
|
25
25
|
"RequestUrl" => Faker::Lorem.sentence,
|
26
26
|
"Ignored" => Faker::Lorem.sentence,
|
27
27
|
},
|
28
|
-
body:
|
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
|
+
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-
|
12
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|