soap4juddi 0.1.4 → 0.1.5
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/soap4juddi/broker.rb +55 -6
- data/lib/soap4juddi/version.rb +1 -1
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2c6614925393d9761a78bac1ee84d041f6ea22e
|
4
|
+
data.tar.gz: cd65081862cf7516743c54b37f3c61f89acb2937
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2322330be833f8c865094d67372617d8fa7313a05d3cd1f51a3cd61fd89d8ac907587f89c43209875be69d1fb756515904987fb4d9d41d8ab7bbe64c42314d58
|
7
|
+
data.tar.gz: d2e1aea61871e9cc29e1a9e9c77f51b82d87cc6381b9c0a9db4a151282bbdb4f76a40c4764ca42b90b0229736f10ec8fb325d522857412d9fd2986db3c3dced9
|
data/lib/soap4juddi/broker.rb
CHANGED
@@ -35,7 +35,7 @@ module Soap4juddi
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
def save_business(key, name, description)
|
38
|
+
def save_business(key, name, description, contacts)
|
39
39
|
body = @soap_xml.element_with_value("name", name)
|
40
40
|
if description
|
41
41
|
description.each do |desc|
|
@@ -44,6 +44,20 @@ module Soap4juddi
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
if contacts
|
48
|
+
# byebug
|
49
|
+
contacts_xml = ""
|
50
|
+
contacts.each do |contact|
|
51
|
+
# contact_details = "<contact useType='(Job Title, Role)'> <description>Primary Contact</description> <personName>Ernst</personName> <phone useType='(Extension, Domestic, International, DSN)'>0217881441</phone> <email useType='Email'>ernst@b.com</email> </contact>"
|
52
|
+
|
53
|
+
contact_details = "<contact useType='(Job Title, Role)'> <description>#{contact['description']}</description> <personName>#{contact['name']}</personName> <phone useType='(Extension, Domestic, International, DSN)'>#{contact['phone']}</phone> <email useType='Email'>#{contact['email']}</email> </contact>"
|
54
|
+
|
55
|
+
contacts_xml = contacts_xml + contact_details
|
56
|
+
end
|
57
|
+
xml = @soap_xml.element_with_value("contacts", contacts_xml)
|
58
|
+
body = "#{body}#{xml}" if xml and not (xml == "")
|
59
|
+
end
|
60
|
+
|
47
61
|
businessEntity = @soap_xml.element_with_value('businessEntity', body, {'businessKey' => key})
|
48
62
|
@soap_connector.request_soap(@base_uri,
|
49
63
|
'publishv2', 'save_business',
|
@@ -163,7 +177,7 @@ module Soap4juddi
|
|
163
177
|
entry = soap[/<ns2:serviceInfos>(.*?)<\/ns2:serviceInfos>/, 1]
|
164
178
|
while entry do
|
165
179
|
service = entry[/<ns2:serviceInfo (.*?)<\/ns2:serviceInfo>/, 1]
|
166
|
-
break if service.nil?
|
180
|
+
break if service.nil? or ((service.is_a? String) and (service.strip == ""))
|
167
181
|
id = @soap_xml.extract_id(service, 'serviceKey')
|
168
182
|
entries[id.gsub(urn, "")] = { 'id' => id, 'name' => extract_name(service) } if id.include?(urn)
|
169
183
|
entry[/<ns2:serviceInfo (.*?)<\/ns2:serviceInfo>/, 1] = ""
|
@@ -175,7 +189,7 @@ module Soap4juddi
|
|
175
189
|
|
176
190
|
def extract_business(soap)
|
177
191
|
entries = {}
|
178
|
-
entries[@soap_xml.extract_id(soap, 'businessKey').gsub(@urns['domains'], "").gsub(@urns['teams'], "")] = { 'name' => extract_name(soap), 'description' => extract_descriptions(soap) }
|
192
|
+
entries[@soap_xml.extract_id(soap, 'businessKey').gsub(@urns['domains'], "").gsub(@urns['teams'], "")] = { 'name' => extract_name(soap), 'description' => extract_descriptions(soap), 'contacts' => extract_contacts(soap) }
|
179
193
|
entries
|
180
194
|
end
|
181
195
|
|
@@ -184,7 +198,7 @@ module Soap4juddi
|
|
184
198
|
entry = soap[/<ns2:businessList (.*?)<\/ns2:businessList>/, 1]
|
185
199
|
while entry do
|
186
200
|
business = entry[/<ns2:businessInfo (.*?)<\/ns2:businessInfo>/, 1]
|
187
|
-
break if business.nil?
|
201
|
+
break if business.nil? or ((business.is_a? String) and (business.strip == ""))
|
188
202
|
business[/<ns2:serviceInfos(.*?)<\/ns2:serviceInfos>/, 1] = "" if business[/<ns2:serviceInfos(.*?)<\/ns2:serviceInfos>/, 1]
|
189
203
|
id = @soap_xml.extract_id(entry, 'businessKey')
|
190
204
|
key = id.gsub(@urns['domains'], "").gsub(@urns['teams'], "")
|
@@ -230,7 +244,7 @@ module Soap4juddi
|
|
230
244
|
entry = soap[/<ns2:bindingTemplates>(.*?)<\/ns2:bindingTemplates>/, 1]
|
231
245
|
while entry do
|
232
246
|
binding = entry[/<ns2:bindingTemplate (.*?)<\/ns2:bindingTemplate>/, 1]
|
233
|
-
break if binding.nil?
|
247
|
+
break if binding.nil? or ((binding.is_a? String) and (binding.strip == ""))
|
234
248
|
id = @soap_xml.extract_id(binding, 'bindingKey')
|
235
249
|
entries[id] = {'access_point' => extract_access_point(binding), 'description' => extract_description(binding)}
|
236
250
|
entry[/<ns2:bindingTemplate (.*?)<\/ns2:bindingTemplate>/, 1] = ""
|
@@ -240,12 +254,29 @@ module Soap4juddi
|
|
240
254
|
{ 'bindings' => entries }
|
241
255
|
end
|
242
256
|
|
257
|
+
def extract_contacts(soap)
|
258
|
+
entries = []
|
259
|
+
entry = soap[/<ns2:contacts>(.*?)<\/ns2:contacts>/, 1]
|
260
|
+
while entry do
|
261
|
+
entry.gsub!('useType="(Extension, Domestic, International, DSN)"', "") if entry
|
262
|
+
entry.gsub!('useType="Email"', "") if entry
|
263
|
+
contact = entry[/<ns2:contact (.*?)<\/ns2:contact>/, 1]
|
264
|
+
break if contact.nil? or ((contact.is_a? String) and (contact.strip == ""))
|
265
|
+
# byebug
|
266
|
+
entries << { 'name' => extract_person_name(contact), 'description' => extract_description(contact), 'phone' => extract_phone(contact), 'email' => extract_email(contact)}
|
267
|
+
entry[/<ns2:contact (.*?)<\/ns2:contact>/, 1] = ""
|
268
|
+
entry.gsub!("<ns2:contagct </ns2:contact>", "")
|
269
|
+
entry = nil if entry.strip == ""
|
270
|
+
end
|
271
|
+
entries
|
272
|
+
end
|
273
|
+
|
243
274
|
def extract_bindings_access_points(soap)
|
244
275
|
entries = []
|
245
276
|
entry = soap[/<ns2:bindingTemplates>(.*?)<\/ns2:bindingTemplates>/, 1]
|
246
277
|
while entry do
|
247
278
|
binding = entry[/<ns2:bindingTemplate (.*?)<\/ns2:bindingTemplate>/, 1]
|
248
|
-
break if binding.nil?
|
279
|
+
break if binding.nil? or ((binding.is_a? String) and (binding.strip == ""))
|
249
280
|
id = @soap_xml.extract_id(binding, 'bindingKey')
|
250
281
|
entries << extract_access_point(binding)
|
251
282
|
entry[/<ns2:bindingTemplate (.*?)<\/ns2:bindingTemplate>/, 1] = ""
|
@@ -271,6 +302,24 @@ module Soap4juddi
|
|
271
302
|
description
|
272
303
|
end
|
273
304
|
|
305
|
+
def extract_email(soap)
|
306
|
+
email = soap[/<ns2:email xml:lang="en">(.*?)<\/ns2:email>/, 1]
|
307
|
+
email ||= soap[/<ns2:email >(.*?)<\/ns2:email>/, 1]
|
308
|
+
email
|
309
|
+
end
|
310
|
+
|
311
|
+
def extract_person_name(soap)
|
312
|
+
person_name = soap[/<ns2:personName xml:lang="en">(.*?)<\/ns2:personName>/, 1]
|
313
|
+
person_name ||= soap[/<ns2:personName>(.*?)<\/ns2:personName>/, 1]
|
314
|
+
person_name
|
315
|
+
end
|
316
|
+
|
317
|
+
def extract_phone(soap)
|
318
|
+
phone = soap[/<ns2:phone xml:lang="en">(.*?)<\/ns2:phone>/, 1]
|
319
|
+
phone ||= soap[/<ns2:phone >(.*?)<\/ns2:phone>/, 1]
|
320
|
+
phone
|
321
|
+
end
|
322
|
+
|
274
323
|
def extract_descriptions(soap)
|
275
324
|
descriptions = []
|
276
325
|
description = soap[/<ns2:description xml:lang="en">(.*?)<\/ns2:description>/, 1]
|
data/lib/soap4juddi/version.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soap4juddi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernst van Graan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Provides connector, xml and brokerage facilities to a jUDDI consumer
|
@@ -59,9 +59,9 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
63
|
-
- .rspec
|
64
|
-
- .travis.yml
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
65
|
- Gemfile
|
66
66
|
- LICENSE.txt
|
67
67
|
- README.md
|
@@ -85,19 +85,18 @@ require_paths:
|
|
85
85
|
- lib
|
86
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 2.0.0
|
91
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.4.6
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Provides connector, xml and brokerage facilities to a jUDDI consumer
|
102
102
|
test_files: []
|
103
|
-
has_rdoc:
|