wasabi 3.6.1 → 3.7.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +7 -8
- data/lib/wasabi/parser.rb +3 -15
- data/lib/wasabi/version.rb +1 -1
- metadata +5 -137
- data/spec/fixtures/authentication.wsdl +0 -63
- data/spec/fixtures/brand.wsdl +0 -624
- 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 -17
- data/spec/support/adapter.rb +0 -20
- data/spec/support/fixture.rb +0 -42
- data/spec/support/profiling.rb +0 -20
- data/spec/wasabi/core_ext/string_spec.rb +0 -39
- data/spec/wasabi/document/authentication_spec.rb +0 -39
- data/spec/wasabi/document/economic_spec.rb +0 -15
- data/spec/wasabi/document/encoded_endpoint_spec.rb +0 -16
- data/spec/wasabi/document/geotrust_spec.rb +0 -40
- data/spec/wasabi/document/inherited_spec.rb +0 -43
- data/spec/wasabi/document/multiple_namespaces_spec.rb +0 -57
- data/spec/wasabi/document/namespaced_actions_spec.rb +0 -41
- data/spec/wasabi/document/no_namespace_spec.rb +0 -41
- data/spec/wasabi/document/savon295_spec.rb +0 -20
- data/spec/wasabi/document/soap12_spec.rb +0 -16
- data/spec/wasabi/document/two_bindings_spec.rb +0 -31
- data/spec/wasabi/document_spec.rb +0 -60
- data/spec/wasabi/parser/get_servicename_spec.rb +0 -21
- data/spec/wasabi/parser/import_port_types_spec.rb +0 -24
- data/spec/wasabi/parser/juniper_spec.rb +0 -25
- data/spec/wasabi/parser/marketo_spec.rb +0 -19
- data/spec/wasabi/parser/multiple_namespaces_spec.rb +0 -42
- data/spec/wasabi/parser/multiple_parts_in_message_spec.rb +0 -33
- data/spec/wasabi/parser/no_message_parts_spec.rb +0 -34
- data/spec/wasabi/parser/no_namespace_spec.rb +0 -28
- data/spec/wasabi/parser/no_target_namespace_spec.rb +0 -38
- data/spec/wasabi/parser/softlayer_spec.rb +0 -20
- data/spec/wasabi/parser/symbolic_endpoint_spec.rb +0 -23
- data/spec/wasabi/parser/tradetracker_spec.rb +0 -19
- data/spec/wasabi/resolver_spec.rb +0 -57
- data/spec/wasabi/wasabi_spec.rb +0 -14
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Wasabi::Parser do
|
6
|
-
context 'with: marketo.wsdl' do
|
7
|
-
subject do
|
8
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
9
|
-
parser.parse
|
10
|
-
parser
|
11
|
-
end
|
12
|
-
|
13
|
-
let(:xml) { fixture(:marketo).read }
|
14
|
-
|
15
|
-
it 'parses the operations' do
|
16
|
-
expect(subject.operations[:get_lead][:input]).to eq('paramsGetLead')
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe Wasabi::Parser do
|
6
|
-
context "with: multiple_namespaces.wsdl" do
|
7
|
-
|
8
|
-
subject do
|
9
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
10
|
-
parser.parse
|
11
|
-
parser
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:xml) { fixture(:multiple_namespaces).read }
|
15
|
-
|
16
|
-
it "lists the types" do
|
17
|
-
expect(subject.types.keys.sort).to eq(["Article", "Save"])
|
18
|
-
end
|
19
|
-
|
20
|
-
it "records the namespace for each type" do
|
21
|
-
expect(subject.types["Save"][:namespace]).to eq("http://example.com/actions")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "records the fields under a type" do
|
25
|
-
expect(subject.types["Save"].keys).to match_array(["article", :namespace, :order!])
|
26
|
-
end
|
27
|
-
|
28
|
-
it "records multiple fields when there are more than one" do
|
29
|
-
expect(subject.types["Article"].keys).to match_array(["Title", "Author", :namespace, :order!])
|
30
|
-
end
|
31
|
-
|
32
|
-
it "records the type of a field" do
|
33
|
-
expect(subject.types["Save"]["article"][:type]).to eq("article:Article")
|
34
|
-
expect(subject.namespaces["article"]).to eq("http://example.com/article")
|
35
|
-
end
|
36
|
-
|
37
|
-
it "lists the order of the type elements" do
|
38
|
-
expect(subject.types["Article"][:order!]).to eq(["Author", "Title"])
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe Wasabi::Parser do
|
6
|
-
context 'with: multiple_parts_in_message.wsdl' do
|
7
|
-
|
8
|
-
subject do
|
9
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
10
|
-
parser.parse
|
11
|
-
parser
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:xml) { fixture(:multiple_parts_in_message).read }
|
15
|
-
|
16
|
-
context "with a parts attribute in soap:body element" do
|
17
|
-
it 'uses the part specified in parts attribute' do
|
18
|
-
request = subject.operations[:some_operation][:input]
|
19
|
-
|
20
|
-
expect(request).to eq("SomeRequestBody")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context "with no parts attribute in soap:body element" do
|
25
|
-
it 'uses the first part element in message' do
|
26
|
-
request = subject.operations[:other_operation][:input]
|
27
|
-
|
28
|
-
expect(request).to eq("SomeRequest")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Wasabi::Parser do
|
6
|
-
context 'with: no_message_parts.wsdl' do
|
7
|
-
|
8
|
-
subject do
|
9
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
10
|
-
parser.parse
|
11
|
-
parser
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:xml) { fixture(:no_message_parts).read }
|
15
|
-
|
16
|
-
it 'falls back to using the message type in the port element' do
|
17
|
-
# Operation's input has no part element in the message, so using the message type.
|
18
|
-
expect(subject.operations[:save][:input]).to eq('Save')
|
19
|
-
|
20
|
-
# Operation's output has part element in the message, so using part element's type.
|
21
|
-
expect(subject.operations[:save][:output]).to eq('SaveResponse')
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'falls back to using the namespace ID in the port element' do
|
25
|
-
expect(subject.operations[:save][:namespace_identifier]).to eq('actions')
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'gracefully handles port messages without a colon' do
|
29
|
-
expect(subject.operations[:delete][:input]).to eq('Delete')
|
30
|
-
expect(subject.operations[:delete][:output]).to eq('DeleteResponse')
|
31
|
-
expect(subject.operations[:delete][:namespace_identifier]).to be_nil
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe Wasabi::Parser do
|
6
|
-
context "with: no_namespace.wsdl" do
|
7
|
-
|
8
|
-
subject do
|
9
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
10
|
-
parser.parse
|
11
|
-
parser
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:xml) { fixture(:no_namespace).read }
|
15
|
-
|
16
|
-
it "lists the types" do
|
17
|
-
expect(subject.types.keys.sort).to eq(["McContact", "McContactArray", "MpUser", "MpUserArray"])
|
18
|
-
end
|
19
|
-
|
20
|
-
it "ignores xsd:all" do
|
21
|
-
keys = subject.types["MpUser"].keys
|
22
|
-
expect(keys.size).to eq(2)
|
23
|
-
|
24
|
-
expect(keys).to include(:namespace)
|
25
|
-
expect(keys).to include(:order!)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe Wasabi::Parser do
|
6
|
-
context "with a WSDL defining xs:schema without targetNamespace" do
|
7
|
-
|
8
|
-
subject do
|
9
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
10
|
-
parser.parse
|
11
|
-
parser
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:xml) do
|
15
|
-
%Q{
|
16
|
-
<definitions xmlns='http://schemas.xmlsoap.org/wsdl/'
|
17
|
-
xmlns:xs='http://www.w3.org/2001/XMLSchema'
|
18
|
-
targetNamespace='http://def.example.com'>
|
19
|
-
<types>
|
20
|
-
<xs:schema elementFormDefault='qualified'>
|
21
|
-
<xs:element name='Save'>
|
22
|
-
<xs:complexType></xs:complexType>
|
23
|
-
</xs:element>
|
24
|
-
</xs:schema>
|
25
|
-
</types>
|
26
|
-
</definitions>
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
# Don't know if real WSDL files omit targetNamespace from xs:schema,
|
31
|
-
# but I suppose we should do something reasonable if they do.
|
32
|
-
|
33
|
-
it "defaults to the target namespace from xs:definitions" do
|
34
|
-
expect(subject.types["Save"][:namespace]).to eq("http://def.example.com")
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Wasabi::Parser do
|
6
|
-
context 'with: brand.wsdl' do
|
7
|
-
subject do
|
8
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
9
|
-
parser.parse
|
10
|
-
parser
|
11
|
-
end
|
12
|
-
|
13
|
-
let(:xml) { fixture(:brand).read }
|
14
|
-
|
15
|
-
it 'parses the operations' do
|
16
|
-
expect(subject.operations[:create_object][:input]).to eq('createObject' => { 'templateObject' => ['tns', 'SoftLayer_Brand'] })
|
17
|
-
expect(subject.operations[:create_customer_account][:input]).to eq('createCustomerAccount' => {'account' => ['tns', 'SoftLayer_Account'], 'bypassDuplicateAccountCheck' => ['xsd', 'boolean']})
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe Wasabi::Parser do
|
6
|
-
context "with: symbolic_endpoint.wsdl" do
|
7
|
-
subject(:parser) { described_class.new Nokogiri::XML(xml) }
|
8
|
-
|
9
|
-
let(:xml) { fixture(:symbolic_endpoint).read }
|
10
|
-
|
11
|
-
before { parser.parse }
|
12
|
-
|
13
|
-
it "allows symbolic endpoints" do
|
14
|
-
expect(parser.endpoint).to be_nil
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should position base class attributes before subclass attributes in :order! array" do
|
18
|
-
type = parser.types["ROPtsLiesListe"]
|
19
|
-
expect(type[:order!]).to eq(["messages", "returncode", "listenteil"])
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Wasabi::Parser do
|
6
|
-
context 'with: tradetracker.wsdl' do
|
7
|
-
subject do
|
8
|
-
parser = Wasabi::Parser.new Nokogiri::XML(xml)
|
9
|
-
parser.parse
|
10
|
-
parser
|
11
|
-
end
|
12
|
-
|
13
|
-
let(:xml) { fixture(:tradetracker).read }
|
14
|
-
|
15
|
-
it 'parses the operations' do
|
16
|
-
expect(subject.operations[:get_feeds][:input]).to eq('getFeeds' => {"affiliateSiteID"=>["xsd", "nonNegativeInteger"], "options"=>["tns", "FeedFilter"]})
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe Wasabi::Resolver do
|
6
|
-
|
7
|
-
describe "#resolve" do
|
8
|
-
it "resolves remote documents" do
|
9
|
-
expect(HTTPI).to receive(:get) { HTTPI::Response.new(200, {}, "wsdl") }
|
10
|
-
xml = Wasabi::Resolver.new("http://example.com?wsdl").resolve
|
11
|
-
expect(xml).to eq("wsdl")
|
12
|
-
end
|
13
|
-
|
14
|
-
it "resolves remote documents with custom adapter" do
|
15
|
-
prev_logging = HTTPI.instance_variable_get(:@log)
|
16
|
-
HTTPI.log = false # Don't pollute rspec output by request logging
|
17
|
-
xml = Wasabi::Resolver.new("http://example.com?wsdl", nil, :fake_adapter_for_test).resolve
|
18
|
-
expect(xml).to eq("wsdl_by_adapter")
|
19
|
-
expect(FakeAdapterForTest.class_variable_get(:@@requests).size).to eq(1)
|
20
|
-
expect(FakeAdapterForTest.class_variable_get(:@@requests).first.url).to eq(URI.parse("http://example.com?wsdl"))
|
21
|
-
expect(FakeAdapterForTest.class_variable_get(:@@methods)).to eq([:get])
|
22
|
-
HTTPI.log = prev_logging
|
23
|
-
end
|
24
|
-
|
25
|
-
it "resolves local documents" do
|
26
|
-
xml = Wasabi::Resolver.new(fixture(:authentication).path).resolve
|
27
|
-
expect(xml).to eq(fixture(:authentication).read)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "simply returns raw XML" do
|
31
|
-
xml = Wasabi::Resolver.new("<xml/>").resolve
|
32
|
-
expect(xml).to eq("<xml/>")
|
33
|
-
end
|
34
|
-
|
35
|
-
it "raises HTTPError when #load_from_remote gets a response error" do
|
36
|
-
code = 404
|
37
|
-
headers = {
|
38
|
-
"content-type" => "text/html"
|
39
|
-
}
|
40
|
-
body = "<html><head><title>404 Not Found</title></head><body>Oops!</body></html>"
|
41
|
-
failed_response = HTTPI::Response.new(code, headers, body)
|
42
|
-
|
43
|
-
expect(HTTPI).to receive(:get) { failed_response }
|
44
|
-
|
45
|
-
url = "http://example.com?wsdl"
|
46
|
-
|
47
|
-
expect do
|
48
|
-
Wasabi::Resolver.new(url).resolve
|
49
|
-
end.to raise_error { |ex|
|
50
|
-
expect(ex).to be_a(Wasabi::Resolver::HTTPError)
|
51
|
-
expect(ex.message).to eq("Error: #{code} for url #{url}")
|
52
|
-
expect(ex.response).to eq(failed_response)
|
53
|
-
}
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
data/spec/wasabi/wasabi_spec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe Wasabi do
|
6
|
-
|
7
|
-
describe ".document" do
|
8
|
-
it "should return a new Wasabi::Document" do
|
9
|
-
document = Wasabi.document fixture(:authentication).read
|
10
|
-
expect(document).to be_a(Wasabi::Document)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|