soaspec 0.0.71 → 0.0.72
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9bd5b574f650987fe784eaeed4d9733e40cbd03
|
4
|
+
data.tar.gz: c9ab8b52fe53aa3b8ebc3807af2a0253906eceec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6b62377f9886cded11a729200f801c110ded422c31139c4dad350203b9404c01e4ade7e0c3a6fc9052a800ae0f2fa6341831e44e0f2a569954ad94354100de7
|
7
|
+
data.tar.gz: 24426a3ba9435bcf73c048d955be8fea9e2e23ccf0741ef442499d900ef46bb76c0b82f11fa5f8fbc9e1351e23a43efb3dfbb473b2bd8f79ed73b7667be9a179
|
data/ChangeLog
CHANGED
@@ -74,6 +74,11 @@ module Soaspec
|
|
74
74
|
{}
|
75
75
|
end
|
76
76
|
|
77
|
+
# @return [Boolean] Whether all xpaths will be done with XML that is converted to lower case
|
78
|
+
def convert_to_lower?
|
79
|
+
false
|
80
|
+
end
|
81
|
+
|
77
82
|
# Stores a value in a method that can be accessed by the provided name
|
78
83
|
# @param [Symbol] name Name of method to use to access this value within handler
|
79
84
|
# @param [String] value Value to store
|
@@ -83,5 +83,14 @@ module Soaspec
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
+
# All xpath will be done with XML that is converted to lower case
|
87
|
+
# You must then use lower case in the xpath's to obtain the desired values
|
88
|
+
def convert_to_lower(set)
|
89
|
+
return unless set
|
90
|
+
define_method('convert_to_lower?') do
|
91
|
+
true
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
86
95
|
end
|
87
96
|
end
|
@@ -147,6 +147,14 @@ module Soaspec
|
|
147
147
|
!body.deep_find_all(expected).empty?
|
148
148
|
end
|
149
149
|
|
150
|
+
# Convert all XML nodes to lowercase
|
151
|
+
# @param [Nokogiri::XML::Document]
|
152
|
+
def convert_to_lower_case(xml_doc)
|
153
|
+
xml_doc.traverse do |node|
|
154
|
+
node.name = node.name.downcase if node.kind_of?(Nokogiri::XML::Element)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
150
158
|
# Returns the value at the provided xpath
|
151
159
|
# @param [Savon::Response] response
|
152
160
|
# @param [String] xpath
|
@@ -154,14 +162,14 @@ module Soaspec
|
|
154
162
|
# @return [String] Value inside element found through Xpath
|
155
163
|
def xpath_value_for(response: nil, xpath: nil, attribute: nil)
|
156
164
|
raise ArgumentError('response and xpath must be passed to method') unless response && xpath
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
+
temp_doc = response.doc.dup
|
166
|
+
convert_to_lower_case(temp_doc) if convert_to_lower?
|
167
|
+
result = if Soaspec.strip_namespaces? && !xpath.include?(':')
|
168
|
+
temp_doc.remove_namespaces!
|
169
|
+
temp_doc.at_xpath(xpath)
|
170
|
+
else
|
171
|
+
temp_doc.at_xpath(xpath, temp_doc.collect_namespaces)
|
172
|
+
end
|
165
173
|
raise NoElementAtPath, "No value at Xpath '#{xpath}' in XML #{response.doc}" unless result
|
166
174
|
return result.inner_text if attribute.nil?
|
167
175
|
result.attributes[attribute].inner_text
|
data/lib/soaspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soaspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.72
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|