wasabi 3.2.1 → 3.2.2

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: 7f06aeea996211efa89a8230086c61177c28b4fa
4
- data.tar.gz: c1e5bcaacd35bfe0122f4bd5b522dd1fad86abe0
3
+ metadata.gz: 15e2f65da4e86bbb4c50c5276f475a86d6d6a149
4
+ data.tar.gz: 18762d7946965501f5eb64a0294aac13c151aaaf
5
5
  SHA512:
6
- metadata.gz: 4b933663d3edb5ceed9a492cf25189f8d838758f58fd6f88d7353018813267006981b05ede2a8d3057e0e5b1f5696e4636f2aa6778137a0b0f493795565b43a0
7
- data.tar.gz: 03cfffac4886354d15a5d69aab5f444356e5ec69c5b4109ec5735e5138fa37775f463c7b75acda2fe001ca96d1762f15b1b7624e4e334180c26c9fbafc1b815a
6
+ metadata.gz: 3bcbf70c7681e5bf8dd07518f562c6715fe7fff2ba613f3186027e51359479f347f82241bc5f753b3fc666fd31b4330edaf610d948f2c36aa40e578ea3e6d42d
7
+ data.tar.gz: ae4b73c2cb9b53cb53f6df356e351d75438b335d6b44dc28374ce57162dba64d79d357c70012bf3c92e83c9eadad82ed05f9de6b516156df521226add6ca4437
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 3.2.2 (2013-12-09)
2
+
3
+ * Fix: [#32](https://github.com/savonrb/wasabi/issues/32) fixes a regression in operation names that was adversely affecting Savon: https://github.com/savonrb/savon/issues/520
4
+
5
+ # 3.2.1 (2013-12-05)
6
+
7
+ * Feature: Drops requirement for Nokogiri <= 1.6 for modern rubies. This was in place for ruby 1.8 but since support for that is going away, we shouldn't prevent users from using newer versions of Nokogiri.
8
+
1
9
  ## 3.2.0 (2013-07-26)
2
10
 
3
11
  * Feature: [#20](https://github.com/savonrb/wasabi/issues/20) Limited support for listing an
data/lib/wasabi/parser.rb CHANGED
@@ -1,5 +1,5 @@
1
- require "uri"
2
- require "wasabi/core_ext/string"
1
+ require 'uri'
2
+ require 'wasabi/core_ext/string'
3
3
 
4
4
  module Wasabi
5
5
 
@@ -8,10 +8,10 @@ module Wasabi
8
8
  # Parses WSDL documents and remembers their important parts.
9
9
  class Parser
10
10
 
11
- XSD = "http://www.w3.org/2001/XMLSchema"
12
- WSDL = "http://schemas.xmlsoap.org/wsdl/"
13
- SOAP_1_1 = "http://schemas.xmlsoap.org/wsdl/soap/"
14
- SOAP_1_2 = "http://schemas.xmlsoap.org/wsdl/soap12/"
11
+ XSD = 'http://www.w3.org/2001/XMLSchema'
12
+ WSDL = 'http://schemas.xmlsoap.org/wsdl/'
13
+ SOAP_1_1 = 'http://schemas.xmlsoap.org/wsdl/soap/'
14
+ SOAP_1_2 = 'http://schemas.xmlsoap.org/wsdl/soap12/'
15
15
 
16
16
  def initialize(document)
17
17
  self.document = document
@@ -71,15 +71,15 @@ module Wasabi
71
71
  @namespace = namespace.to_s if namespace
72
72
 
73
73
  @namespaces = @document.namespaces.inject({}) do |memo, (key, value)|
74
- memo[key.sub("xmlns:", "")] = value
74
+ memo[key.sub('xmlns:', '')] = value
75
75
  memo
76
76
  end
77
77
  end
78
78
 
79
79
  def parse_endpoint
80
80
  if service_node = service
81
- endpoint = service_node.at_xpath(".//soap11:address/@location", 'soap11' => SOAP_1_1)
82
- endpoint ||= service_node.at_xpath(service_node, ".//soap12:address/@location", 'soap12' => SOAP_1_2)
81
+ endpoint = service_node.at_xpath('.//soap11:address/@location', 'soap11' => SOAP_1_1)
82
+ endpoint ||= service_node.at_xpath(service_node, './/soap12:address/@location', 'soap12' => SOAP_1_2)
83
83
  end
84
84
 
85
85
  @endpoint = parse_url(endpoint) if endpoint
@@ -118,12 +118,12 @@ module Wasabi
118
118
 
119
119
  def parse_operations_parameters
120
120
  root_elements = document.xpath("wsdl:definitions/wsdl:types/*[local-name()='schema']/*[local-name()='element']", 'wsdl' => WSDL).each do |element|
121
- name = element.attribute("name").to_s.snakecase.to_sym
121
+ name = element.attribute('name').to_s.snakecase.to_sym
122
122
 
123
123
  if operation = @operations[name]
124
124
  element.xpath("*[local-name() ='complexType']/*[local-name() ='sequence']/*[local-name() ='element']").each do |child_element|
125
- attr_name = child_element.attribute("name").to_s
126
- attr_type = (attr_type = child_element.attribute("type").to_s.split(":")).size > 1 ? attr_type[1] : attr_type[0]
125
+ attr_name = child_element.attribute('name').to_s
126
+ attr_type = (attr_type = child_element.attribute('type').to_s.split(':')).size > 1 ? attr_type[1] : attr_type[0]
127
127
 
128
128
  operation[:parameters] ||= {}
129
129
  operation[:parameters][attr_name.to_sym] = { :name => attr_name, :type => attr_type }
@@ -133,9 +133,9 @@ module Wasabi
133
133
  end
134
134
 
135
135
  def parse_operations
136
- operations = document.xpath("wsdl:definitions/wsdl:binding/wsdl:operation", 'wsdl' => WSDL)
136
+ operations = document.xpath('wsdl:definitions/wsdl:binding/wsdl:operation', 'wsdl' => WSDL)
137
137
  operations.each do |operation|
138
- name = operation.attribute("name").to_s
138
+ name = operation.attribute('name').to_s
139
139
 
140
140
  # TODO: check for soap namespace?
141
141
  soap_operation = operation.element_children.find { |node| node.name == 'operation' }
@@ -179,20 +179,20 @@ module Wasabi
179
179
  @types[name] ||= { :namespace => namespace }
180
180
  @types[name][:order!] = []
181
181
 
182
- type.xpath("./xs:sequence/xs:element", 'xs' => XSD).each do |inner|
183
- element_name = inner.attribute("name").to_s
184
- @types[name][element_name] = { :type => inner.attribute("type").to_s }
182
+ type.xpath('./xs:sequence/xs:element', 'xs' => XSD).each do |inner|
183
+ element_name = inner.attribute('name').to_s
184
+ @types[name][element_name] = { :type => inner.attribute('type').to_s }
185
185
 
186
186
  [ :nillable, :minOccurs, :maxOccurs ].each do |attr|
187
187
  if v = inner.attribute(attr.to_s)
188
- @types[name][element_name][attr] = v.to_s
188
+ @types[name][element_name][attr] = v.to_s
189
189
  end
190
190
  end
191
191
 
192
192
  @types[name][:order!] << element_name
193
193
  end
194
194
 
195
- type.xpath("./xs:complexContent/xs:extension/xs:sequence/xs:element", 'xs' => XSD).each do |inner_element|
195
+ type.xpath('./xs:complexContent/xs:extension/xs:sequence/xs:element', 'xs' => XSD).each do |inner_element|
196
196
  element_name = inner_element.attribute('name').to_s
197
197
  @types[name][element_name] = { :type => inner_element.attribute('type').to_s }
198
198
 
@@ -226,15 +226,15 @@ module Wasabi
226
226
  end
227
227
 
228
228
  def input_for(operation)
229
- input_output_for(operation, "input")
229
+ input_output_for(operation, 'input')
230
230
  end
231
231
 
232
232
  def output_for(operation)
233
- input_output_for(operation, "output")
233
+ input_output_for(operation, 'output')
234
234
  end
235
235
 
236
236
  def input_output_for(operation, input_output)
237
- operation_name = operation["name"]
237
+ operation_name = operation['name']
238
238
 
239
239
  # Look up the input by walking up to portType, then up to the message.
240
240
 
@@ -244,15 +244,15 @@ module Wasabi
244
244
  end
245
245
 
246
246
  port_type_input_output = port_type_operation &&
247
- port_type_operation.element_children.find { |node| node.name == input_output }
247
+ port_type_operation.element_children.find { |node| node.name == input_output }
248
248
 
249
249
  # TODO: Stupid fix for missing support for imports.
250
250
  # Sometimes portTypes are actually included in a separate WSDL.
251
251
  if port_type_input_output
252
- if port_type_input_output.attribute("message").to_s.include? ':'
253
- port_message_ns_id, port_message_type = port_type_input_output.attribute("message").to_s.split(':')
252
+ if port_type_input_output.attribute('message').to_s.include? ':'
253
+ port_message_ns_id, port_message_type = port_type_input_output.attribute('message').to_s.split(':')
254
254
  else
255
- port_message_type = port_type_input_output.attribute("message").to_s
255
+ port_message_type = port_type_input_output.attribute('message').to_s
256
256
  end
257
257
 
258
258
  message_ns_id, message_type = nil
@@ -262,16 +262,16 @@ module Wasabi
262
262
  port_message_part = message.element_children.find { |node| node.name == 'part' }
263
263
 
264
264
  if port_message_part
265
- if (port_message_part_element = port_message_part.attribute("element"))
265
+ if (port_message_part_element = port_message_part.attribute('element'))
266
266
  message_ns_id, message_type = port_message_part_element.to_s.split(':')
267
267
  end
268
268
  end
269
269
 
270
270
  # Fall back to the name of the binding operation
271
271
  if message_type
272
- [message_ns_id, message_type]
272
+ [message_ns_id, operation_name]
273
273
  else
274
- [port_message_ns_id, port_message_type]
274
+ [port_message_ns_id, operation_name]
275
275
  end
276
276
  else
277
277
  [nil, operation_name]
@@ -302,7 +302,5 @@ module Wasabi
302
302
 
303
303
  @sections = sections
304
304
  end
305
-
306
305
  end
307
-
308
306
  end
@@ -1,3 +1,3 @@
1
1
  module Wasabi
2
- VERSION = "3.2.1"
2
+ VERSION = "3.2.2"
3
3
  end
@@ -15,7 +15,7 @@ describe Wasabi::Document do
15
15
 
16
16
  its(:operations) do
17
17
  should == {
18
- :authenticate => { :input => "authenticate", :output => "authenticateResponse", :action => "authenticate", :namespace_identifier => "tns" }
18
+ :authenticate => { :input => "authenticate", :output => "authenticate", :action => "authenticate", :namespace_identifier => "tns" }
19
19
  }
20
20
  end
21
21
 
@@ -14,7 +14,7 @@ describe Wasabi::Document do
14
14
  it { should have(1).operations }
15
15
 
16
16
  its(:operations) do
17
- should == { :save => { :input => "Save", :output=>"SaveResponse", :action => "http://example.com/actions.Save", :namespace_identifier => "actions", :parameters => { :article => { :name => "article", :type => "Article" } } } }
17
+ should == { :save => { :input => "Save", :output=>"Save", :action => "http://example.com/actions.Save", :namespace_identifier => "actions", :parameters => { :article => { :name => "article", :type => "Article" } } } }
18
18
  end
19
19
 
20
20
  its(:type_namespaces) do
@@ -15,9 +15,9 @@ describe Wasabi::Document do
15
15
 
16
16
  its(:operations) do
17
17
  should include(
18
- { :delete_client => { :input => "Client.Delete", :output => "Client.DeleteResponse", :action => "http://api.example.com/api/Client.Delete", :namespace_identifier => "tns" } },
19
- { :get_clients => { :input => "User.GetClients", :output => "User.GetClientsResponse", :action => "http://api.example.com/api/User.GetClients", :namespace_identifier => "tns" } },
20
- { :get_api_key => { :input => "User.GetApiKey", :output => "User.GetApiKeyResponse", :action => "http://api.example.com/api/User.GetApiKey", :namespace_identifier => "tns" } }
18
+ { :delete_client => { :input => "DeleteClient", :output => "DeleteClient", :action => "http://api.example.com/api/Client.Delete", :namespace_identifier => "tns" } },
19
+ { :get_clients => { :input => "GetClients", :output => "GetClients", :action => "http://api.example.com/api/User.GetClients", :namespace_identifier => "tns" } },
20
+ { :get_api_key => { :input => "GetApiKey", :output => "GetApiKey", :action => "http://api.example.com/api/User.GetApiKey", :namespace_identifier => "tns" } }
21
21
  )
22
22
  end
23
23
 
@@ -15,9 +15,9 @@ describe Wasabi::Document do
15
15
 
16
16
  its(:operations) do
17
17
  should include(
18
- { :get_user_login_by_id => { :input => "GetUserLoginById", :output => "GetUserLoginByIdResponse", :action => "/api/api/GetUserLoginById", :namespace_identifier => "typens" } },
19
- { :get_all_contacts => { :input => "GetAllContacts", :output =>"GetAllContactsResponse", :action => "/api/api/GetAllContacts", :namespace_identifier => "typens" } },
20
- { :search_user => { :input => "SearchUser", :output =>"SearchUserResponse", :action => "/api/api/SearchUser", :namespace_identifier => nil } }
18
+ { :get_user_login_by_id => { :input => "GetUserLoginById", :output => "GetUserLoginById", :action => "/api/api/GetUserLoginById", :namespace_identifier => "typens" } },
19
+ { :get_all_contacts => { :input => "GetAllContacts", :output =>"GetAllContacts", :action => "/api/api/GetAllContacts", :namespace_identifier => "typens" } },
20
+ { :search_user => { :input => "SearchUser", :output =>"SearchUser", :action => "/api/api/SearchUser", :namespace_identifier => nil } }
21
21
  )
22
22
  end
23
23
 
@@ -7,7 +7,7 @@ describe Wasabi::Document do
7
7
 
8
8
  its(:operations) do
9
9
  should include(
10
- { :sendsms => { :input => "sendsmsRequest", :output => "sendsmsResponse", :action => "sendsms", :namespace_identifier => "tns" } }
10
+ { :sendsms => { :input => "sendsms", :output => "sendsms", :action => "sendsms", :namespace_identifier => "tns" } }
11
11
  )
12
12
  end
13
13
 
@@ -1,7 +1,7 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Wasabi::Parser do
4
- context "with: no_message_parts.wsdl" do
4
+ context 'with: no_message_parts.wsdl' do
5
5
 
6
6
  subject do
7
7
  parser = Wasabi::Parser.new Nokogiri::XML(xml)
@@ -11,16 +11,16 @@ describe Wasabi::Parser do
11
11
 
12
12
  let(:xml) { fixture(:no_message_parts).read }
13
13
 
14
- it "falls back to using the message type in the port element" do
14
+ it 'falls back to using the message type in the port element' do
15
15
  # Operation's input has no part element in the message, so using the message type.
16
- subject.operations[:save][:input].should == "SaveSoapIn"
16
+ subject.operations[:save][:input].should == 'Save'
17
17
 
18
18
  # Operation's output has part element in the message, so using part element's type.
19
- subject.operations[:save][:output].should == "SaveResponse"
19
+ subject.operations[:save][:output].should == 'Save'
20
20
  end
21
21
 
22
- it "falls back to using the namespace ID in the port element" do
23
- subject.operations[:save][:namespace_identifier].should == "actions"
22
+ it 'falls back to using the namespace ID in the port element' do
23
+ subject.operations[:save][:namespace_identifier].should == 'actions'
24
24
  end
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wasabi
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Harrington
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-06 00:00:00.000000000 Z
11
+ date: 2013-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpi