wasabi 2.1.1 → 2.2.0
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.
- data/CHANGELOG.md +8 -0
- data/lib/wasabi/parser.rb +28 -2
- data/lib/wasabi/version.rb +1 -1
- data/spec/fixtures/{authentication.xml → authentication.wsdl} +0 -0
- data/spec/fixtures/{geotrust.xml → geotrust.wsdl} +0 -0
- data/spec/fixtures/{lower_camel.xml → lower_camel.wsdl} +0 -0
- data/spec/fixtures/{multiple_namespaces.xml → multiple_namespaces.wsdl} +0 -0
- data/spec/fixtures/{multiple_types.xml → multiple_types.wsdl} +0 -0
- data/spec/fixtures/{namespaced_actions.xml → namespaced_actions.wsdl} +0 -0
- data/spec/fixtures/{no_namespace.xml → no_namespace.wsdl} +0 -0
- data/spec/fixtures/{soap12.xml → soap12.wsdl} +0 -0
- data/spec/fixtures/{symbolic_endpoint.xml → symbolic_endpoint.wsdl} +0 -0
- data/spec/fixtures/{two_bindings.xml → two_bindings.wsdl} +0 -0
- data/spec/support/fixture.rb +11 -4
- data/spec/wasabi/document/authentication_spec.rb +2 -2
- data/spec/wasabi/document/geotrust_spec.rb +1 -1
- data/spec/wasabi/document/multiple_namespaces_spec.rb +2 -2
- data/spec/wasabi/document/namespaced_actions_spec.rb +4 -4
- data/spec/wasabi/document/no_namespace_spec.rb +4 -4
- data/spec/wasabi/document/soap12_spec.rb +1 -1
- data/spec/wasabi/document/two_bindings_spec.rb +1 -1
- data/spec/wasabi/parser/multiple_namespaces_spec.rb +1 -1
- data/spec/wasabi/parser/no_namespace_spec.rb +1 -1
- data/spec/wasabi/parser/symbolic_endpoint_spec.rb +1 -1
- metadata +25 -25
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 2.2.0 (2012-06-06)
|
2
|
+
|
3
|
+
* Improvement: [#5](https://github.com/rubiii/wasabi/pull/5) - Get input from message
|
4
|
+
element or portType input. See [rubiii/savon#277](https://github.com/rubiii/savon/pull/277)
|
5
|
+
to get the full picture on how this all works together, and enables you to pass a single
|
6
|
+
symbol into the `Savon::Client#request` method and get automatic namespace mapping, as well
|
7
|
+
as the proper operation name -> input message mapping.
|
8
|
+
|
1
9
|
## 2.1.1 (2012-05-18)
|
2
10
|
|
3
11
|
* Fix: [issue 7](https://github.com/rubiii/wasabi/issues/7) - Performance regression.
|
data/lib/wasabi/parser.rb
CHANGED
@@ -82,8 +82,12 @@ module Wasabi
|
|
82
82
|
if soap_action
|
83
83
|
soap_action = soap_action.to_s
|
84
84
|
action = soap_action.blank? ? name : soap_action
|
85
|
-
|
86
|
-
|
85
|
+
|
86
|
+
# There should be a matching portType for each binding, so we will lookup the input from there.
|
87
|
+
namespace_id, input = input_for(operation)
|
88
|
+
|
89
|
+
# Store namespace identifier so this operation can be mapped to the proper namespace.
|
90
|
+
@operations[name.snakecase.to_sym] = { :action => action, :input => input, :namespace_identifier => namespace_id }
|
87
91
|
elsif !@operations[name.snakecase.to_sym]
|
88
92
|
@operations[name.snakecase.to_sym] = { :action => name, :input => name }
|
89
93
|
end
|
@@ -111,5 +115,27 @@ module Wasabi
|
|
111
115
|
schema_namespace ? schema_namespace.to_s : @namespace
|
112
116
|
end
|
113
117
|
|
118
|
+
def input_for(operation)
|
119
|
+
operation_name = operation.attribute("name")
|
120
|
+
|
121
|
+
# Look up the input by walking up to portType, then up to the message.
|
122
|
+
|
123
|
+
binding_input = at_xpath(operation, ".//wsdl:input/@name")
|
124
|
+
binding_type = at_xpath(operation, "../@type").to_s.split(':').last
|
125
|
+
port_type_input = at_xpath(operation, "../../wsdl:portType[@name='#{binding_type}']/wsdl:operation[@name='#{operation_name}']/wsdl:input")
|
126
|
+
|
127
|
+
port_message_ns_id, port_message_type = port_type_input.attribute("message").to_s.split(':')
|
128
|
+
|
129
|
+
# Kinda hackey maybe? This assumes there is ever only one 'part' element in the message.
|
130
|
+
message_ns_id, message_type = at_xpath(port_type_input, "../../../wsdl:message[@name='#{port_message_type}']/wsdl:part[1]").attribute("element").to_s.split(':')
|
131
|
+
|
132
|
+
# Fall back to message name in portType input if no 'element' attribute in wsdl:message
|
133
|
+
if message_type
|
134
|
+
[message_ns_id, message_type]
|
135
|
+
else
|
136
|
+
[port_message_ns_id, port_message_type]
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
114
140
|
end
|
115
141
|
end
|
data/lib/wasabi/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/support/fixture.rb
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
module Fixture
|
2
2
|
|
3
|
-
def
|
4
|
-
fixtures[
|
3
|
+
def self.[](name)
|
4
|
+
fixtures[name]
|
5
5
|
end
|
6
6
|
|
7
|
-
|
7
|
+
def self.[]=(name, value)
|
8
|
+
fixtures[name] = value
|
9
|
+
end
|
8
10
|
|
9
|
-
def fixtures
|
11
|
+
def self.fixtures
|
10
12
|
@fixtures ||= {}
|
11
13
|
end
|
12
14
|
|
15
|
+
def fixture(file, ext = :wsdl)
|
16
|
+
filename = "#{file}.#{ext}"
|
17
|
+
Fixture[filename] ||= File.read File.expand_path("spec/fixtures/#{filename}")
|
18
|
+
end
|
19
|
+
|
13
20
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Wasabi::Document do
|
4
|
-
context "with: authentication.
|
4
|
+
context "with: authentication.wsdl" do
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:authentication) }
|
7
7
|
|
@@ -15,7 +15,7 @@ describe Wasabi::Document do
|
|
15
15
|
|
16
16
|
its(:operations) do
|
17
17
|
should == {
|
18
|
-
:authenticate => { :input => "authenticate", :action => "authenticate" }
|
18
|
+
:authenticate => { :input => "authenticate", :action => "authenticate", :namespace_identifier => "tns" }
|
19
19
|
}
|
20
20
|
end
|
21
21
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Wasabi::Document do
|
4
|
-
context "with: multiple_namespaces.
|
4
|
+
context "with: multiple_namespaces.wsdl" do
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:multiple_namespaces) }
|
7
7
|
|
@@ -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", :action => "http://example.com/actions.Save" } }
|
17
|
+
should == { :save => { :input => "Save", :action => "http://example.com/actions.Save", :namespace_identifier => "actions" } }
|
18
18
|
end
|
19
19
|
|
20
20
|
its(:type_namespaces) do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Wasabi::Document do
|
4
|
-
context "with: namespaced_actions.
|
4
|
+
context "with: namespaced_actions.wsdl" do
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:namespaced_actions) }
|
7
7
|
|
@@ -15,9 +15,9 @@ describe Wasabi::Document do
|
|
15
15
|
|
16
16
|
its(:operations) do
|
17
17
|
should include(
|
18
|
-
{ :delete_client => { :input => "
|
19
|
-
{ :get_clients => { :input => "GetClients", :action => "http://api.example.com/api/User.GetClients" } },
|
20
|
-
{ :get_api_key => { :input => "GetApiKey", :action => "http://api.example.com/api/User.GetApiKey" } }
|
18
|
+
{ :delete_client => { :input => "Client.Delete", :action => "http://api.example.com/api/Client.Delete", :namespace_identifier => "tns" } },
|
19
|
+
{ :get_clients => { :input => "User.GetClients", :action => "http://api.example.com/api/User.GetClients", :namespace_identifier => "tns" } },
|
20
|
+
{ :get_api_key => { :input => "User.GetApiKey", :action => "http://api.example.com/api/User.GetApiKey", :namespace_identifier => "tns" } }
|
21
21
|
)
|
22
22
|
end
|
23
23
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Wasabi::Document do
|
4
|
-
context "with: no_namespace.
|
4
|
+
context "with: no_namespace.wsdl" do
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:no_namespace) }
|
7
7
|
|
@@ -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", :action => "/api/api/GetUserLoginById" } },
|
19
|
-
{ :get_all_contacts => { :input => "GetAllContacts", :action => "/api/api/GetAllContacts" } },
|
20
|
-
{ :search_user => { :input => "SearchUser", :action => "/api/api/SearchUser" } }
|
18
|
+
{ :get_user_login_by_id => { :input => "GetUserLoginById", :action => "/api/api/GetUserLoginById", :namespace_identifier => "typens" } },
|
19
|
+
{ :get_all_contacts => { :input => "GetAllContacts", :action => "/api/api/GetAllContacts", :namespace_identifier => "typens" } },
|
20
|
+
{ :search_user => { :input => "SearchUser", :action => "/api/api/SearchUser", :namespace_identifier => "typens" } }
|
21
21
|
)
|
22
22
|
end
|
23
23
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wasabi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 2.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 2.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Harrington
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-06-06 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -103,16 +103,16 @@ files:
|
|
103
103
|
- lib/wasabi/parser.rb
|
104
104
|
- lib/wasabi/version.rb
|
105
105
|
- lib/wasabi/xpath_helper.rb
|
106
|
-
- spec/fixtures/authentication.
|
107
|
-
- spec/fixtures/geotrust.
|
108
|
-
- spec/fixtures/lower_camel.
|
109
|
-
- spec/fixtures/multiple_namespaces.
|
110
|
-
- spec/fixtures/multiple_types.
|
111
|
-
- spec/fixtures/namespaced_actions.
|
112
|
-
- spec/fixtures/no_namespace.
|
113
|
-
- spec/fixtures/soap12.
|
114
|
-
- spec/fixtures/symbolic_endpoint.
|
115
|
-
- spec/fixtures/two_bindings.
|
106
|
+
- spec/fixtures/authentication.wsdl
|
107
|
+
- spec/fixtures/geotrust.wsdl
|
108
|
+
- spec/fixtures/lower_camel.wsdl
|
109
|
+
- spec/fixtures/multiple_namespaces.wsdl
|
110
|
+
- spec/fixtures/multiple_types.wsdl
|
111
|
+
- spec/fixtures/namespaced_actions.wsdl
|
112
|
+
- spec/fixtures/no_namespace.wsdl
|
113
|
+
- spec/fixtures/soap12.wsdl
|
114
|
+
- spec/fixtures/symbolic_endpoint.wsdl
|
115
|
+
- spec/fixtures/two_bindings.wsdl
|
116
116
|
- spec/spec_helper.rb
|
117
117
|
- spec/support/fixture.rb
|
118
118
|
- spec/wasabi/core_ext/object_spec.rb
|
@@ -165,16 +165,16 @@ signing_key:
|
|
165
165
|
specification_version: 3
|
166
166
|
summary: A simple WSDL parser
|
167
167
|
test_files:
|
168
|
-
- spec/fixtures/authentication.
|
169
|
-
- spec/fixtures/geotrust.
|
170
|
-
- spec/fixtures/lower_camel.
|
171
|
-
- spec/fixtures/multiple_namespaces.
|
172
|
-
- spec/fixtures/multiple_types.
|
173
|
-
- spec/fixtures/namespaced_actions.
|
174
|
-
- spec/fixtures/no_namespace.
|
175
|
-
- spec/fixtures/soap12.
|
176
|
-
- spec/fixtures/symbolic_endpoint.
|
177
|
-
- spec/fixtures/two_bindings.
|
168
|
+
- spec/fixtures/authentication.wsdl
|
169
|
+
- spec/fixtures/geotrust.wsdl
|
170
|
+
- spec/fixtures/lower_camel.wsdl
|
171
|
+
- spec/fixtures/multiple_namespaces.wsdl
|
172
|
+
- spec/fixtures/multiple_types.wsdl
|
173
|
+
- spec/fixtures/namespaced_actions.wsdl
|
174
|
+
- spec/fixtures/no_namespace.wsdl
|
175
|
+
- spec/fixtures/soap12.wsdl
|
176
|
+
- spec/fixtures/symbolic_endpoint.wsdl
|
177
|
+
- spec/fixtures/two_bindings.wsdl
|
178
178
|
- spec/spec_helper.rb
|
179
179
|
- spec/support/fixture.rb
|
180
180
|
- spec/wasabi/core_ext/object_spec.rb
|