soaspec 0.2.22 → 0.2.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +5 -0
- data/lib/soaspec/interpreter.rb +1 -1
- data/lib/soaspec/version.rb +1 -1
- data/lib/soaspec/wsdl_generator.rb +24 -8
- 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: 984b49dfa801f4f86aeca02b864d1a0077ad9b998bce7497f8566de102dd874b
|
4
|
+
data.tar.gz: d0dff6ccbaecb663de4af1fd10a70481ca02ed75934662760476c9567366d41e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4274b58b4aa962229592148d4b45018bf7f3365f65012c7b4409e0f84fa912acd194bd2376e0563a30ad6c6b7dfa6567abfdf392cbb2999b7db4399893ac3ad
|
7
|
+
data.tar.gz: e0532bf5aef88377ae778649823068d4eb77ae8968f1c4a1204d59fedefb66b9c5361481396a5ef7fafd12caf396d42d411b2f02a9a5a9f9b96048e836a037a0
|
data/ChangeLog
CHANGED
data/lib/soaspec/interpreter.rb
CHANGED
data/lib/soaspec/version.rb
CHANGED
@@ -71,6 +71,12 @@ module Soaspec
|
|
71
71
|
!type.xpath("*/#{type.first.namespace.prefix}:enumeration").empty?
|
72
72
|
end
|
73
73
|
|
74
|
+
# @param [Nokogiri::XML::Element] element
|
75
|
+
# @return [String] Name of element excluding namespace
|
76
|
+
def name_after_namespace(element)
|
77
|
+
value_after_namespace(element.name)
|
78
|
+
end
|
79
|
+
|
74
80
|
# Return value of string after a namespace
|
75
81
|
# @param [String] string String to parse for part after namespace
|
76
82
|
# @return [String] Part after the namespace, demonstrated by ':'
|
@@ -95,7 +101,7 @@ module Soaspec
|
|
95
101
|
# @param [Nokogiri::XML::Element] element Element to check
|
96
102
|
# @return [Boolean] True if Nokogiri element is a complex type, that is, has a complexType element underneath itself
|
97
103
|
def complex_type?(element)
|
98
|
-
element.children.any? { |child| child
|
104
|
+
element.children.any? { |child| name_after_namespace(child) == 'complexType' }
|
99
105
|
end
|
100
106
|
|
101
107
|
# @param [String, Symbol] underscore_separated Snakecase value to be converted to camel case
|
@@ -104,18 +110,26 @@ module Soaspec
|
|
104
110
|
underscore_separated.to_s.split('_').collect(&:capitalize).join
|
105
111
|
end
|
106
112
|
|
113
|
+
# Element at the root of an operation
|
114
|
+
# @param [Hash] op_details Hash with details from WSDL for an operation
|
115
|
+
def root_element_for(op_details)
|
116
|
+
root_element = @wsdl_schemas.at_xpath("//*[@name='#{op_details[:input]}']")
|
117
|
+
raise 'Operation has no input defined' if root_element.nil?
|
118
|
+
|
119
|
+
root_element
|
120
|
+
end
|
121
|
+
|
122
|
+
# Returns list of elements present at the root of an operation
|
107
123
|
# @param [Hash] op_details Hash with details from WSDL for an operation
|
108
124
|
# @return [Nokogiri::XML::NodeSet] List of the root elements in the SOAP body
|
109
125
|
def root_elements_for(op_details)
|
110
126
|
raise "'@wsdl_schemas' must be defined" if @wsdl_schemas.nil?
|
111
127
|
|
112
|
-
root_element =
|
113
|
-
raise 'Operation has no input defined' if root_element.nil?
|
114
|
-
|
128
|
+
root_element = root_element_for(op_details)
|
115
129
|
schema_namespace = root_element.namespace.prefix
|
116
130
|
root_type = root_element['type']
|
117
131
|
if root_type
|
118
|
-
@wsdl_schemas.xpath("//*[@name='#{root_type
|
132
|
+
@wsdl_schemas.xpath("//*[@name='#{value_after_namespace(root_type)}']//#{schema_namespace}:element")
|
119
133
|
else
|
120
134
|
return [] unless complex_type? root_element # Empty Array if there are no root elements
|
121
135
|
|
@@ -126,6 +140,7 @@ module Soaspec
|
|
126
140
|
end
|
127
141
|
|
128
142
|
# Adds documentation content for all children of XML element
|
143
|
+
# This will be an example yaml for setting SOAP requests
|
129
144
|
# @param [Nokogiri::XML::Element] element Type to document for
|
130
145
|
# @param [Integer] depth How many times to iterate depth for
|
131
146
|
def document_type_for(element, depth = 1)
|
@@ -133,10 +148,10 @@ module Soaspec
|
|
133
148
|
return unless depth < 6
|
134
149
|
|
135
150
|
if complex_type? element
|
136
|
-
complex_type = element.children.find { |c| c
|
137
|
-
sequence = complex_type.children.find { |c| c
|
151
|
+
complex_type = element.children.find { |c| name_after_namespace(c) == 'complexType' }
|
152
|
+
sequence = complex_type.children.find { |c| name_after_namespace(c) == 'sequence' }
|
138
153
|
sequence.children.select { |node| node.class == Nokogiri::XML::Element }.each do |sub_element|
|
139
|
-
document_type_for sub_element, depth
|
154
|
+
document_type_for sub_element, depth + 1
|
140
155
|
end
|
141
156
|
else
|
142
157
|
return "No type seen for #{element}, #{element.class}" unless element['type']
|
@@ -149,6 +164,7 @@ module Soaspec
|
|
149
164
|
end
|
150
165
|
end
|
151
166
|
|
167
|
+
# @todo This should return YAML rather than just set an instance variable
|
152
168
|
# Makes a yaml string in a '@content' instance variable
|
153
169
|
# @param [Nokogiri::XML::NodeSet] list List to convert to YAML
|
154
170
|
def wsdl_to_yaml_for(list)
|
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.2.
|
4
|
+
version: 0.2.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03
|
11
|
+
date: 2019-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|