soap-response_cutter 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/soap/response_cutter/version.rb +1 -1
- data/lib/soap/response_cutter.rb +8 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cd6a7a9f6c652e3b2118c7dfab973f0b07aefd6
|
4
|
+
data.tar.gz: 5c34f392618acb23dfbb84f5d45dbb35faf0f2a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 848141016968645738a1ba0983dbe3170ba55ab91de2f1bbbb4ea924b0d503ad6676aa984aeebe4b41ed16d9b8ecdc110940e8968103258e43defb750a2bf66f
|
7
|
+
data.tar.gz: b1569969b165791cbd500c9d6dfaf231f5248e927c266971e8c807a7b6ab9367fbde2d4b81f5a7ba756ef3626b256033ca143c6c3a5677da1b6953d6ae7d25f7
|
data/lib/soap/response_cutter.rb
CHANGED
@@ -27,20 +27,27 @@ module Soap
|
|
27
27
|
fail DeepShit, "#{response} could not be parsed" if safe_guard > 3
|
28
28
|
end
|
29
29
|
end
|
30
|
-
response
|
30
|
+
response || true
|
31
31
|
end
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
+
# rubocop:disable AbcSize
|
35
36
|
def flatten_response
|
36
37
|
USELESS_KEYS.each do |suffix|
|
37
38
|
@response = response.fetch(key(suffix)) do
|
38
39
|
response.fetch(reverse_key(suffix)) { response }
|
39
40
|
end
|
40
41
|
throw :done unless response.is_a?(Hash)
|
42
|
+
clear_xmlns_keys
|
41
43
|
throw :done unless useless_nesting?
|
42
44
|
end
|
43
45
|
end
|
46
|
+
# rubocop:enable AbcSize
|
47
|
+
|
48
|
+
def clear_xmlns_keys
|
49
|
+
response.delete_if { |k| k.to_s =~ /xmlns/ }
|
50
|
+
end
|
44
51
|
|
45
52
|
def useless_nesting?
|
46
53
|
response.any? { |k| k.to_s =~ /response|result|return/ }
|