wasabi 3.5.0 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +32 -0
- data/README.md +10 -11
- data/lib/wasabi/core_ext/string.rb +7 -8
- data/lib/wasabi/document.rb +2 -0
- data/lib/wasabi/parser.rb +14 -17
- data/lib/wasabi/resolver.rb +2 -0
- data/lib/wasabi/version.rb +3 -1
- data/lib/wasabi.rb +2 -0
- metadata +18 -135
- data/.gitignore +0 -8
- data/.rspec +0 -1
- data/.travis.yml +0 -7
- data/Gemfile +0 -13
- data/Rakefile +0 -7
- data/spec/fixtures/authentication.wsdl +0 -63
- data/spec/fixtures/economic.wsdl +0 -65660
- data/spec/fixtures/encoded_endpoint.wsdl +0 -52
- data/spec/fixtures/geotrust.wsdl +0 -156
- data/spec/fixtures/import_port_types.wsdl +0 -86
- data/spec/fixtures/inherited.wsdl +0 -46
- data/spec/fixtures/juniper.wsdl +0 -215
- data/spec/fixtures/lower_camel.wsdl +0 -52
- data/spec/fixtures/marketo.wsdl +0 -1630
- data/spec/fixtures/multiple_namespaces.wsdl +0 -61
- data/spec/fixtures/multiple_parts_in_message.wsdl +0 -66
- data/spec/fixtures/multiple_types.wsdl +0 -60
- data/spec/fixtures/namespaced_actions.wsdl +0 -307
- data/spec/fixtures/no_message_parts.wsdl +0 -85
- data/spec/fixtures/no_namespace.wsdl +0 -115
- data/spec/fixtures/savon295.wsdl +0 -52
- data/spec/fixtures/soap12.wsdl +0 -11
- data/spec/fixtures/symbolic_endpoint.wsdl +0 -190
- data/spec/fixtures/tradetracker.wsdl +0 -1330
- data/spec/fixtures/two_bindings.wsdl +0 -24
- data/spec/spec_helper.rb +0 -19
- data/spec/support/adapter.rb +0 -18
- data/spec/support/fixture.rb +0 -40
- data/spec/support/profiling.rb +0 -18
- data/spec/wasabi/core_ext/string_spec.rb +0 -37
- data/spec/wasabi/document/authentication_spec.rb +0 -37
- data/spec/wasabi/document/economic_spec.rb +0 -13
- data/spec/wasabi/document/encoded_endpoint_spec.rb +0 -14
- data/spec/wasabi/document/geotrust_spec.rb +0 -38
- data/spec/wasabi/document/inherited_spec.rb +0 -41
- data/spec/wasabi/document/multiple_namespaces_spec.rb +0 -55
- data/spec/wasabi/document/namespaced_actions_spec.rb +0 -39
- data/spec/wasabi/document/no_namespace_spec.rb +0 -39
- data/spec/wasabi/document/savon295_spec.rb +0 -18
- data/spec/wasabi/document/soap12_spec.rb +0 -14
- data/spec/wasabi/document/two_bindings_spec.rb +0 -29
- data/spec/wasabi/document_spec.rb +0 -58
- data/spec/wasabi/parser/get_servicename_spec.rb +0 -19
- data/spec/wasabi/parser/import_port_types_spec.rb +0 -22
- data/spec/wasabi/parser/juniper_spec.rb +0 -23
- data/spec/wasabi/parser/marketo_spec.rb +0 -17
- data/spec/wasabi/parser/multiple_namespaces_spec.rb +0 -40
- data/spec/wasabi/parser/multiple_parts_in_message_spec.rb +0 -31
- data/spec/wasabi/parser/no_message_parts_spec.rb +0 -32
- data/spec/wasabi/parser/no_namespace_spec.rb +0 -26
- data/spec/wasabi/parser/no_target_namespace_spec.rb +0 -36
- data/spec/wasabi/parser/symbolic_endpoint_spec.rb +0 -24
- data/spec/wasabi/parser/tradetracker_spec.rb +0 -17
- data/spec/wasabi/resolver_spec.rb +0 -55
- data/spec/wasabi/wasabi_spec.rb +0 -12
- data/wasabi.gemspec +0 -28
@@ -1,40 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Wasabi::Parser do
|
4
|
-
context "with: multiple_namespaces.wsdl" do
|
5
|
-
|
6
|
-
subject do
|
7
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
8
|
-
parser.parse
|
9
|
-
parser
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:xml) { fixture(:multiple_namespaces).read }
|
13
|
-
|
14
|
-
it "lists the types" do
|
15
|
-
expect(subject.types.keys.sort).to eq(["Article", "Save"])
|
16
|
-
end
|
17
|
-
|
18
|
-
it "records the namespace for each type" do
|
19
|
-
expect(subject.types["Save"][:namespace]).to eq("http://example.com/actions")
|
20
|
-
end
|
21
|
-
|
22
|
-
it "records the fields under a type" do
|
23
|
-
expect(subject.types["Save"].keys).to match_array(["article", :namespace, :order!])
|
24
|
-
end
|
25
|
-
|
26
|
-
it "records multiple fields when there are more than one" do
|
27
|
-
expect(subject.types["Article"].keys).to match_array(["Title", "Author", :namespace, :order!])
|
28
|
-
end
|
29
|
-
|
30
|
-
it "records the type of a field" do
|
31
|
-
expect(subject.types["Save"]["article"][:type]).to eq("article:Article")
|
32
|
-
expect(subject.namespaces["article"]).to eq("http://example.com/article")
|
33
|
-
end
|
34
|
-
|
35
|
-
it "lists the order of the type elements" do
|
36
|
-
expect(subject.types["Article"][:order!]).to eq(["Author", "Title"])
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Wasabi::Parser do
|
4
|
-
context 'with: multiple_parts_in_message.wsdl' do
|
5
|
-
|
6
|
-
subject do
|
7
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
8
|
-
parser.parse
|
9
|
-
parser
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:xml) { fixture(:multiple_parts_in_message).read }
|
13
|
-
|
14
|
-
context "with a parts attribute in soap:body element" do
|
15
|
-
it 'uses the part specified in parts attribute' do
|
16
|
-
request = subject.operations[:some_operation][:input]
|
17
|
-
|
18
|
-
expect(request).to eq("SomeRequestBody")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "with no parts attribute in soap:body element" do
|
23
|
-
it 'uses the first part element in message' do
|
24
|
-
request = subject.operations[:other_operation][:input]
|
25
|
-
|
26
|
-
expect(request).to eq("SomeRequest")
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Wasabi::Parser do
|
4
|
-
context 'with: no_message_parts.wsdl' do
|
5
|
-
|
6
|
-
subject do
|
7
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
8
|
-
parser.parse
|
9
|
-
parser
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:xml) { fixture(:no_message_parts).read }
|
13
|
-
|
14
|
-
it 'falls back to using the message type in the port element' do
|
15
|
-
# Operation's input has no part element in the message, so using the message type.
|
16
|
-
expect(subject.operations[:save][:input]).to eq('Save')
|
17
|
-
|
18
|
-
# Operation's output has part element in the message, so using part element's type.
|
19
|
-
expect(subject.operations[:save][:output]).to eq('SaveResponse')
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'falls back to using the namespace ID in the port element' do
|
23
|
-
expect(subject.operations[:save][:namespace_identifier]).to eq('actions')
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'gracefully handles port messages without a colon' do
|
27
|
-
expect(subject.operations[:delete][:input]).to eq('Delete')
|
28
|
-
expect(subject.operations[:delete][:output]).to eq('DeleteResponse')
|
29
|
-
expect(subject.operations[:delete][:namespace_identifier]).to be_nil
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Wasabi::Parser do
|
4
|
-
context "with: no_namespace.wsdl" do
|
5
|
-
|
6
|
-
subject do
|
7
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
8
|
-
parser.parse
|
9
|
-
parser
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:xml) { fixture(:no_namespace).read }
|
13
|
-
|
14
|
-
it "lists the types" do
|
15
|
-
expect(subject.types.keys.sort).to eq(["McContact", "McContactArray", "MpUser", "MpUserArray"])
|
16
|
-
end
|
17
|
-
|
18
|
-
it "ignores xsd:all" do
|
19
|
-
keys = subject.types["MpUser"].keys
|
20
|
-
expect(keys.size).to eq(2)
|
21
|
-
|
22
|
-
expect(keys).to include(:namespace)
|
23
|
-
expect(keys).to include(:order!)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Wasabi::Parser do
|
4
|
-
context "with a WSDL defining xs:schema without targetNamespace" do
|
5
|
-
|
6
|
-
subject do
|
7
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
8
|
-
parser.parse
|
9
|
-
parser
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:xml) do
|
13
|
-
%Q{
|
14
|
-
<definitions xmlns='http://schemas.xmlsoap.org/wsdl/'
|
15
|
-
xmlns:xs='http://www.w3.org/2001/XMLSchema'
|
16
|
-
targetNamespace='http://def.example.com'>
|
17
|
-
<types>
|
18
|
-
<xs:schema elementFormDefault='qualified'>
|
19
|
-
<xs:element name='Save'>
|
20
|
-
<xs:complexType></xs:complexType>
|
21
|
-
</xs:element>
|
22
|
-
</xs:schema>
|
23
|
-
</types>
|
24
|
-
</definitions>
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
# Don't know if real WSDL files omit targetNamespace from xs:schema,
|
29
|
-
# but I suppose we should do something reasonable if they do.
|
30
|
-
|
31
|
-
it "defaults to the target namespace from xs:definitions" do
|
32
|
-
expect(subject.types["Save"][:namespace]).to eq("http://def.example.com")
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Wasabi::Parser do
|
4
|
-
context "with: symbolic_endpoint.wsdl" do
|
5
|
-
|
6
|
-
subject do
|
7
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
8
|
-
parser.parse
|
9
|
-
parser
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:xml) { fixture(:symbolic_endpoint).read }
|
13
|
-
|
14
|
-
it "allows symbolic endpoints" do
|
15
|
-
expect(subject.endpoint).to be_nil
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should position base class attributes before subclass attributes in :order! array" do
|
19
|
-
type = subject.types["ROPtsLiesListe"]
|
20
|
-
expect(type[:order!]).to eq(["messages", "returncode", "listenteil"])
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Wasabi::Parser do
|
4
|
-
context 'with: tradetracker.wsdl' do
|
5
|
-
subject do
|
6
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
7
|
-
parser.parse
|
8
|
-
parser
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:xml) { fixture(:tradetracker).read }
|
12
|
-
|
13
|
-
it 'parses the operations' do
|
14
|
-
expect(subject.operations[:get_feeds][:input]).to eq('getFeeds')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Wasabi::Resolver do
|
4
|
-
|
5
|
-
describe "#resolve" do
|
6
|
-
it "resolves remote documents" do
|
7
|
-
expect(HTTPI).to receive(:get) { HTTPI::Response.new(200, {}, "wsdl") }
|
8
|
-
xml = Wasabi::Resolver.new("http://example.com?wsdl").resolve
|
9
|
-
expect(xml).to eq("wsdl")
|
10
|
-
end
|
11
|
-
|
12
|
-
it "resolves remote documents with custom adapter" do
|
13
|
-
prev_logging = HTTPI.instance_variable_get(:@log)
|
14
|
-
HTTPI.log = false # Don't pollute rspec output by request logging
|
15
|
-
xml = Wasabi::Resolver.new("http://example.com?wsdl", nil, :fake_adapter_for_test).resolve
|
16
|
-
expect(xml).to eq("wsdl_by_adapter")
|
17
|
-
expect(FakeAdapterForTest.class_variable_get(:@@requests).size).to eq(1)
|
18
|
-
expect(FakeAdapterForTest.class_variable_get(:@@requests).first.url).to eq(URI.parse("http://example.com?wsdl"))
|
19
|
-
expect(FakeAdapterForTest.class_variable_get(:@@methods)).to eq([:get])
|
20
|
-
HTTPI.log = prev_logging
|
21
|
-
end
|
22
|
-
|
23
|
-
it "resolves local documents" do
|
24
|
-
xml = Wasabi::Resolver.new(fixture(:authentication).path).resolve
|
25
|
-
expect(xml).to eq(fixture(:authentication).read)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "simply returns raw XML" do
|
29
|
-
xml = Wasabi::Resolver.new("<xml/>").resolve
|
30
|
-
expect(xml).to eq("<xml/>")
|
31
|
-
end
|
32
|
-
|
33
|
-
it "raises HTTPError when #load_from_remote gets a response error" do
|
34
|
-
code = 404
|
35
|
-
headers = {
|
36
|
-
"content-type" => "text/html"
|
37
|
-
}
|
38
|
-
body = "<html><head><title>404 Not Found</title></head><body>Oops!</body></html>"
|
39
|
-
failed_response = HTTPI::Response.new(code, headers, body)
|
40
|
-
|
41
|
-
HTTPI.stub(:get => failed_response)
|
42
|
-
|
43
|
-
url = "http://example.com?wsdl"
|
44
|
-
|
45
|
-
expect do
|
46
|
-
Wasabi::Resolver.new(url).resolve
|
47
|
-
end.to raise_error { |ex|
|
48
|
-
expect(ex).to be_a(Wasabi::Resolver::HTTPError)
|
49
|
-
expect(ex.message).to eq("Error: #{code} for url #{url}")
|
50
|
-
expect(ex.response).to eq(failed_response)
|
51
|
-
}
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
data/spec/wasabi/wasabi_spec.rb
DELETED
data/wasabi.gemspec
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "wasabi/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "wasabi"
|
7
|
-
s.version = Wasabi::VERSION
|
8
|
-
s.authors = ["Daniel Harrington"]
|
9
|
-
s.email = ["me@rubiii.com"]
|
10
|
-
s.homepage = "https://github.com/savonrb/#{s.name}"
|
11
|
-
s.summary = "A simple WSDL parser"
|
12
|
-
s.description = s.summary
|
13
|
-
s.required_ruby_version = '>= 1.9.2'
|
14
|
-
|
15
|
-
s.rubyforge_project = s.name
|
16
|
-
s.license = 'MIT'
|
17
|
-
|
18
|
-
s.add_dependency "httpi", "~> 2.0"
|
19
|
-
s.add_dependency "nokogiri", ">= 1.4.2"
|
20
|
-
|
21
|
-
s.add_development_dependency "rake", "~> 0.9"
|
22
|
-
s.add_development_dependency "rspec", "~> 2.14"
|
23
|
-
|
24
|
-
s.files = `git ls-files`.split("\n")
|
25
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
26
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
|
-
s.require_paths = ["lib"]
|
28
|
-
end
|