soap-response_cutter 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/soap/response_cutter/version.rb +1 -1
- data/lib/soap/response_cutter.rb +8 -3
- 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: c00c69445799398a9a6b6eef6c412b2e86a2569d
|
4
|
+
data.tar.gz: a9e3e7c8824ea9e923989a20dd47533609e6f559
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af666b1f590b9d229269e225ec9a38396bf253aabae627f24fd0f3e2a33116d8c1562d1dd0ccbb27e757720ca618cf82da0324516e0ab96eb3d07dcd6abba477
|
7
|
+
data.tar.gz: b14418e84a7fe1600e2d9eb297050d46732c27d4a8353257971a91431f5120aeb3beca6d881adbb423f3f5271d52c80340b535d9ed7fc07b187127ea5d65233e
|
data/lib/soap/response_cutter.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'soap/response_cutter/version'
|
2
2
|
require 'active_support/core_ext/hash'
|
3
|
+
|
3
4
|
module Soap
|
4
5
|
# Those are a crazy duplication and calls for some really ugly hacks
|
5
6
|
# to get the data you are reall interested in. Fuck SOAP!
|
@@ -7,6 +8,7 @@ module Soap
|
|
7
8
|
# Examples:
|
8
9
|
# ResponseCutter.new(:soap_action, { somes: 'value'})
|
9
10
|
class ResponseCutter
|
11
|
+
DeepShit = Class.new(StandardError)
|
10
12
|
USELESS_KEYS = %w(response result return)
|
11
13
|
attr_reader :action, :response
|
12
14
|
|
@@ -16,14 +18,17 @@ module Soap
|
|
16
18
|
@response = response.dup.deep_symbolize_keys!
|
17
19
|
end
|
18
20
|
|
19
|
-
# rubocop:disable MethodLength
|
20
21
|
def parse
|
21
22
|
catch :done do
|
22
|
-
|
23
|
+
safe_guard = 0
|
24
|
+
while useless_nesting?
|
25
|
+
flatten_response
|
26
|
+
safe_guard += 1
|
27
|
+
fail DeepShit, "#{response} could not be parsed" if safe_guard > 3
|
28
|
+
end
|
23
29
|
end
|
24
30
|
response
|
25
31
|
end
|
26
|
-
# rubocop:enable MethodLength
|
27
32
|
|
28
33
|
private
|
29
34
|
|