soap4juddi 0.1.9 → 0.1.10

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: c5d6ed10a454d01edbdc896dac4cf139f7fad13f
4
- data.tar.gz: 3951fb5e9c27d94921b19cf087f4ee259a5a8def
3
+ metadata.gz: 45d54feebdd6c0c2ef331e7b62cbe266bcda4516
4
+ data.tar.gz: 71e0654c9f9bcc857c863f8e17a1a8fa5a289f8c
5
5
  SHA512:
6
- metadata.gz: 383d9a1f87566cee0ad1fd587e4c519e8b6ff993e93942dea663dfbd3d400e8227cb8426a5809f704d944a0bfdd926e194e66940da7eb921ef7552bec4255cb7
7
- data.tar.gz: e5a599a184d25c84129ee6210a8dbcd8b8f7d09a8a04fc72d48c342b5f8a920ed963692eb3244da5942e2f7ebec22230ee745239993055fedb89f31e1f727f79
6
+ metadata.gz: e3966c3d7617914a4d48cf862ee88fa9ea259b61bbd8badfbebc3fe1682e2c350ed193d6b85ae758a4b792410e482510cfd2154a53fb372ddbfef581050eba08
7
+ data.tar.gz: ff3fbbfc8a6d5155884ab5eb8e10f5c716236058a8474b8c89207d182779693c22e73bece3d98abe4241a6209df19a9df5cb748acb4de9c2c057cd7e6c267854
@@ -14,23 +14,10 @@ module Soap4juddi
14
14
  @soap_xml = Soap4juddi::XML.new
15
15
  end
16
16
 
17
- def auth_body
18
- @soap_xml.element_with_key_value("authInfo", "authtoken", @auth_token)
19
- end
20
-
21
17
  def save_element_bindings(service, bindings, urn, description)
18
+ validate_bindings(bindings)
22
19
  body = auth_body
23
- if (not bindings.nil?) and (not (bindings.size == 0))
24
- bindings.each do |binding|
25
- access_point = @soap_xml.element_with_value('accessPoint', binding, {'URLType' => extract_binding_url_type(binding)})
26
- description = @soap_xml.element_with_value('description', description)
27
- model_instance_details = @soap_xml.element_with_value('tModelInstanceDetails', '')
28
- bindingTemplate = @soap_xml.element_with_value("bindingTemplate",
29
- "#{description}#{access_point}#{model_instance_details}",
30
- {'bindingKey' => '', 'serviceKey' => "#{urn}#{service}"})
31
- body = body + bindingTemplate
32
- end
33
- end
20
+ body = add_bindings(body, service, bindings, urn, description)
34
21
  @soap_connector.request_soap(@base_uri, 'publishv2', 'save_binding', body) do | res|
35
22
  res.body
36
23
  end
@@ -187,12 +174,6 @@ module Soap4juddi
187
174
  { 'services' => entries }
188
175
  end
189
176
 
190
- def extract_business(soap)
191
- entries = {}
192
- entries[@soap_xml.extract_value(soap, 'businessKey').gsub(@urns['domains'], "").gsub(@urns['teams'], "")] = { 'name' => extract_name(soap), 'description' => extract_descriptions(soap), 'contacts' => extract_contacts(soap) }
193
- entries
194
- end
195
-
196
177
  def extract_business_entries(soap)
197
178
  entries = {}
198
179
  entry = soap[/<ns2:businessList (.*?)<\/ns2:businessList>/, 1]
@@ -210,10 +191,6 @@ module Soap4juddi
210
191
  { 'businesses' => entries }
211
192
  end
212
193
 
213
- def extract_errno(soap)
214
- soap[/<ns2:result errno="(.*?)"\/>/, 1]
215
- end
216
-
217
194
  def authenticate(auth_user, auth_password)
218
195
  @soap_connector.authenticate(auth_user, auth_password)
219
196
  end
@@ -224,6 +201,45 @@ module Soap4juddi
224
201
 
225
202
  private
226
203
 
204
+ def add_bindings(body, service, bindings, urn, description)
205
+ if (not bindings.nil?) and (not (bindings.size == 0))
206
+ bindings.each do |binding|
207
+ body = add_binding(body, service, binding, urn, description)
208
+ end
209
+ end
210
+ body
211
+ end
212
+
213
+ def add_binding(body, service, binding, urn, description)
214
+ access_point = @soap_xml.element_with_value('accessPoint', binding, {'URLType' => extract_binding_url_type(binding)})
215
+ description_data = @soap_xml.element_with_value('description', description)
216
+ model_instance_details = @soap_xml.element_with_value('tModelInstanceDetails', '')
217
+ bindingTemplate = @soap_xml.element_with_value(
218
+ "bindingTemplate",
219
+ "#{description_data}#{access_point}#{model_instance_details}",
220
+ {'bindingKey' => '', 'serviceKey' => "#{urn}#{service}"})
221
+ body + bindingTemplate
222
+ end
223
+
224
+ def validate_bindings(bindings)
225
+ raise Soap4juddi::InvalidElementError.new('invalid bindings') if not bindings.is_a?(Array)
226
+ true
227
+ end
228
+
229
+ def extract_business(soap)
230
+ entries = {}
231
+ entries[@soap_xml.extract_value(soap, 'businessKey').gsub(@urns['domains'], "").gsub(@urns['teams'], "")] = { 'name' => extract_name(soap), 'description' => extract_descriptions(soap), 'contacts' => extract_contacts(soap) }
232
+ entries
233
+ end
234
+
235
+ def extract_errno(soap)
236
+ soap[/<ns2:result errno="(.*?)"\/>/, 1]
237
+ end
238
+
239
+ def auth_body
240
+ @soap_xml.element_with_key_value("authInfo", "authtoken", @auth_token)
241
+ end
242
+
227
243
  def find_element_bindings_access_points(name, urn)
228
244
  @soap_connector.request_soap(@base_uri, 'inquiryv2', 'get_serviceDetail', @soap_xml.element_with_value('serviceKey', "#{urn}#{name}")) do |res|
229
245
  extract_bindings_access_points(res.body)
@@ -1,3 +1,3 @@
1
1
  module Soap4juddi
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soap4juddi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernst van Graan