wasabi 3.2.3 → 3.6.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.
Files changed (50) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +29 -0
  3. data/README.md +4 -4
  4. data/lib/wasabi.rb +2 -0
  5. data/lib/wasabi/core_ext/string.rb +7 -8
  6. data/lib/wasabi/document.rb +6 -3
  7. data/lib/wasabi/parser.rb +42 -21
  8. data/lib/wasabi/resolver.rb +7 -4
  9. data/lib/wasabi/version.rb +3 -1
  10. data/spec/fixtures/brand.wsdl +624 -0
  11. data/spec/fixtures/multiple_parts_in_message.wsdl +66 -0
  12. data/spec/fixtures/no_message_parts.wsdl +82 -56
  13. data/spec/spec_helper.rb +2 -0
  14. data/spec/support/adapter.rb +20 -0
  15. data/spec/support/fixture.rb +2 -0
  16. data/spec/support/profiling.rb +2 -0
  17. data/spec/wasabi/core_ext/string_spec.rb +13 -11
  18. data/spec/wasabi/document/authentication_spec.rb +21 -5
  19. data/spec/wasabi/document/economic_spec.rb +2 -0
  20. data/spec/wasabi/document/encoded_endpoint_spec.rb +6 -1
  21. data/spec/wasabi/document/geotrust_spec.rb +25 -9
  22. data/spec/wasabi/document/inherited_spec.rb +12 -7
  23. data/spec/wasabi/document/multiple_namespaces_spec.rb +38 -16
  24. data/spec/wasabi/document/namespaced_actions_spec.rb +21 -5
  25. data/spec/wasabi/document/no_namespace_spec.rb +24 -8
  26. data/spec/wasabi/document/savon295_spec.rb +7 -2
  27. data/spec/wasabi/document/soap12_spec.rb +6 -1
  28. data/spec/wasabi/document/two_bindings_spec.rb +13 -3
  29. data/spec/wasabi/document_spec.rb +8 -6
  30. data/spec/wasabi/parser/get_servicename_spec.rb +3 -1
  31. data/spec/wasabi/parser/import_port_types_spec.rb +4 -2
  32. data/spec/wasabi/parser/juniper_spec.rb +5 -3
  33. data/spec/wasabi/parser/marketo_spec.rb +3 -1
  34. data/spec/wasabi/parser/multiple_namespaces_spec.rb +9 -7
  35. data/spec/wasabi/parser/multiple_parts_in_message_spec.rb +33 -0
  36. data/spec/wasabi/parser/no_message_parts_spec.rb +11 -3
  37. data/spec/wasabi/parser/no_namespace_spec.rb +6 -4
  38. data/spec/wasabi/parser/no_target_namespace_spec.rb +3 -1
  39. data/spec/wasabi/parser/softlayer_spec.rb +20 -0
  40. data/spec/wasabi/parser/symbolic_endpoint_spec.rb +8 -9
  41. data/spec/wasabi/parser/tradetracker_spec.rb +3 -1
  42. data/spec/wasabi/resolver_spec.rb +28 -11
  43. data/spec/wasabi/wasabi_spec.rb +3 -1
  44. metadata +73 -70
  45. data/.gitignore +0 -8
  46. data/.rspec +0 -1
  47. data/.travis.yml +0 -6
  48. data/Gemfile +0 -13
  49. data/Rakefile +0 -7
  50. data/wasabi.gemspec +0 -28
@@ -0,0 +1,66 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <definitions
3
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
4
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
5
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
6
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
7
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
8
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9
+ xmlns:s="http://www.w3.org/2001/XMLSchema"
10
+ xmlns:actions="http://example.com/actions"
11
+ targetNamespace="http://example.com/topLevelNamespace">
12
+ <types>
13
+ <s:schema elementFormDefault="qualified" targetNamespace="http://example.com/actions">
14
+ <s:element name="SomeRequest">
15
+ <s:complexType>
16
+ <s:sequence>
17
+ <s:element name="status" type="s:string"/>
18
+ </s:sequence>
19
+ </s:complexType>
20
+ </s:element>
21
+ </s:schema>
22
+ </types>
23
+ <message name="SomeInput">
24
+ <part name="parameters" element="actions:SomeRequest"/>
25
+ <part name="requestBody" element="actions:SomeRequestBody"/>
26
+ </message>
27
+ <message name="SomeOutput">
28
+ <part name="parameters" element="actions:SomeResponse"/>
29
+ </message>
30
+ <portType name="ExamplePortType">
31
+ <operation name="SomeOperation">
32
+ <input message="actions:SomeInput"/>
33
+ <output message="actions:SomeOutput"/>
34
+ </operation>
35
+ <operation name="OtherOperation">
36
+ <input message="actions:SomeInput"/>
37
+ <output message="actions:SomeOutput"/>
38
+ </operation>
39
+ </portType>
40
+ <binding name="ExampleBinding" type="actions:ExamplePortType">
41
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
42
+ <operation name="SomeOperation">
43
+ <soap:operation soapAction="http://example.com/actions.SomeOperation" style="document"/>
44
+ <input>
45
+ <soap:body parts="requestBody" use="literal"/>
46
+ </input>
47
+ <output>
48
+ <soap:body use="literal"/>
49
+ </output>
50
+ </operation>
51
+ <operation name="OtherOperation">
52
+ <soap:operation soapAction="http://example.com/actions.SomeOperation" style="document"/>
53
+ <input>
54
+ <soap:body use="literal"/>
55
+ </input>
56
+ <output>
57
+ <soap:body use="literal"/>
58
+ </output>
59
+ </operation>
60
+ </binding>
61
+ <service name="ExampleService">
62
+ <port name="ExamplePort" binding="actions:ExampleBinding">
63
+ <soap:address location="http://localhost/soapservice/execute?path=%2Fbase%2Fincludes%2FTest+Soap%2FReturn+Rows"/>
64
+ </port>
65
+ </service>
66
+ </definitions>
@@ -1,59 +1,85 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <definitions
3
- xmlns="http://schemas.xmlsoap.org/wsdl/"
4
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
5
- xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
6
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
7
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
8
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9
- xmlns:s="http://www.w3.org/2001/XMLSchema"
10
- xmlns:article="http://example.com/article"
11
- xmlns:actions="http://example.com/actions"
12
- targetNamespace="http://example.com/actions">
13
- <types>
14
- <s:schema elementFormDefault="qualified" targetNamespace="http://example.com/actions">
15
- <s:element name="Save">
16
- <s:complexType>
17
- <s:sequence>
18
- <s:element name="article" type="article:Article"/>
19
- </s:sequence>
20
- </s:complexType>
21
- </s:element>
22
- </s:schema>
23
- <s:schema elementFormDefault="qualified" targetNamespace="http://example.com/article">
24
- <s:complexType name="Article">
25
- <s:sequence>
26
- <s:element minOccurs="0" name="Author" type="s:string"/>
27
- <s:element minOccurs="0" name="Title" type="s:string"/>
28
- </s:sequence>
29
- </s:complexType>
30
- </s:schema>
31
- </types>
32
- <message name="SaveSoapIn"/>
33
- <message name="SaveSoapOut">
34
- <part name="parameters" element="actions:SaveResponse"/>
35
- </message>
36
- <portType name="ArticleSoap">
37
- <operation name="Save">
38
- <input message="actions:SaveSoapIn"/>
39
- <output message="actions:SaveSoapOut"/>
40
- </operation>
41
- </portType>
42
- <binding name="ArticleSoap" type="actions:ArticleSoap">
43
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
44
- <operation name="Save">
45
- <soap:operation soapAction="http://example.com/actions.Save" style="document"/>
46
- <input>
47
- <soap:body use="literal"/>
48
- </input>
49
- <output>
50
- <soap:body use="literal"/>
51
- </output>
52
- </operation>
53
- </binding>
54
- <service name="StudyMDL">
55
- <port name="StudyMDLSoap" binding="actions:StudyMDLSoap">
56
- <soap:address location="http://example.com:1234/soap"/>
57
- </port>
58
- </service>
3
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
4
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
5
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
6
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
7
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
8
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9
+ xmlns:s="http://www.w3.org/2001/XMLSchema"
10
+ xmlns:article="http://example.com/article"
11
+ xmlns:actions="http://example.com/actions"
12
+ targetNamespace="http://example.com/actions">
13
+ <types>
14
+ <s:schema elementFormDefault="qualified" targetNamespace="http://example.com/actions">
15
+ <s:element name="Save">
16
+ <s:complexType>
17
+ <s:sequence>
18
+ <s:element name="article" type="article:Article"/>
19
+ </s:sequence>
20
+ </s:complexType>
21
+ </s:element>
22
+ <s:element name="Delete">
23
+ <s:complexType>
24
+ <s:sequence>
25
+ <s:element name="article" type="article:Article"/>
26
+ </s:sequence>
27
+ </s:complexType>
28
+ </s:element>
29
+
30
+ </s:schema>
31
+ <s:schema elementFormDefault="qualified" targetNamespace="http://example.com/article">
32
+ <s:complexType name="Article">
33
+ <s:sequence>
34
+ <s:element minOccurs="0" name="Author" type="s:string"/>
35
+ <s:element minOccurs="0" name="Title" type="s:string"/>
36
+ </s:sequence>
37
+ </s:complexType>
38
+ </s:schema>
39
+ </types>
40
+ <message name="SaveSoapIn"/>
41
+ <message name="SaveSoapOut">
42
+ <part name="parameters" element="actions:SaveResponse"/>
43
+ </message>
44
+ <message name="DeleteSoapIn"/>
45
+ <message name="DeleteSoapOut">
46
+ <part name="parameters" element="DeleteResponse"/>
47
+ </message>
48
+
49
+ <portType name="ArticleSoap">
50
+ <operation name="Save">
51
+ <input message="actions:SaveSoapIn"/>
52
+ <output message="actions:SaveSoapOut"/>
53
+ </operation>
54
+ <operation name="Delete">
55
+ <input message="DeleteSoapIn"/>
56
+ <output message="DeleteSoapOut"/>
57
+ </operation>
58
+ </portType>
59
+ <binding name="ArticleSoap" type="actions:ArticleSoap">
60
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
61
+ <operation name="Save">
62
+ <soap:operation soapAction="http://example.com/actions.Save" style="document"/>
63
+ <input>
64
+ <soap:body use="literal"/>
65
+ </input>
66
+ <output>
67
+ <soap:body use="literal"/>
68
+ </output>
69
+ </operation>
70
+ <operation name="Delete">
71
+ <soap:operation soapAction="http://example.com/actions.Delete" style="document"/>
72
+ <input>
73
+ <soap:body use="literal"/>
74
+ </input>
75
+ <output>
76
+ <soap:body use="literal"/>
77
+ </output>
78
+ </operation>
79
+ </binding>
80
+ <service name="StudyMDL">
81
+ <port name="StudyMDLSoap" binding="actions:StudyMDLSoap">
82
+ <soap:address location="http://example.com:1234/soap"/>
83
+ </port>
84
+ </service>
59
85
  </definitions>
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler"
2
4
  Bundler.require :default, :development
3
5
 
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ class FakeAdapterForTest < HTTPI::Adapter::Base
4
+
5
+ register :fake_adapter_for_test
6
+
7
+ def initialize(request)
8
+ @@requests ||= []
9
+ @@requests.push request
10
+ @request = request
11
+ end
12
+
13
+ attr_reader :client
14
+
15
+ def request(method)
16
+ @@methods ||= []
17
+ @@methods.push method
18
+ HTTPI::Response.new(200, {}, 'wsdl_by_adapter')
19
+ end
20
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SpecSupport
2
4
 
3
5
  class Fixture
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SpecSupport
2
4
 
3
5
  def benchmark(&block)
@@ -1,36 +1,38 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
- describe String do
5
+ describe Wasabi::CoreExt::String do
4
6
 
5
- describe "#snakecase" do
7
+ describe ".snakecase" do
6
8
  it "lowercases one word CamelCase" do
7
- "Merb".snakecase.should == "merb"
9
+ expect(Wasabi::CoreExt::String.snakecase("Merb")).to eq("merb")
8
10
  end
9
11
 
10
12
  it "makes one underscore snakecase two word CamelCase" do
11
- "MerbCore".snakecase.should == "merb_core"
13
+ expect(Wasabi::CoreExt::String.snakecase("MerbCore")).to eq("merb_core")
12
14
  end
13
15
 
14
16
  it "handles CamelCase with more than 2 words" do
15
- "SoYouWantContributeToMerbCore".snakecase.should == "so_you_want_contribute_to_merb_core"
17
+ expect(Wasabi::CoreExt::String.snakecase("SoYouWantContributeToMerbCore")).to eq("so_you_want_contribute_to_merb_core")
16
18
  end
17
19
 
18
20
  it "handles CamelCase with more than 2 capital letter in a row" do
19
- "CNN".snakecase.should == "cnn"
20
- "CNNNews".snakecase.should == "cnn_news"
21
- "HeadlineCNNNews".snakecase.should == "headline_cnn_news"
21
+ expect(Wasabi::CoreExt::String.snakecase("CNN")).to eq("cnn")
22
+ expect(Wasabi::CoreExt::String.snakecase("CNNNews")).to eq("cnn_news")
23
+ expect(Wasabi::CoreExt::String.snakecase("HeadlineCNNNews")).to eq("headline_cnn_news")
22
24
  end
23
25
 
24
26
  it "does NOT change one word lowercase" do
25
- "merb".snakecase.should == "merb"
27
+ expect(Wasabi::CoreExt::String.snakecase("merb")).to eq("merb")
26
28
  end
27
29
 
28
30
  it "leaves snake_case as is" do
29
- "merb_core".snakecase.should == "merb_core"
31
+ expect(Wasabi::CoreExt::String.snakecase("merb_core")).to eq("merb_core")
30
32
  end
31
33
 
32
34
  it "converts period characters to underscores" do
33
- "User.GetEmail".snakecase.should == "user_get_email"
35
+ expect(Wasabi::CoreExt::String.snakecase("User.GetEmail")).to eq("user_get_email")
34
36
  end
35
37
  end
36
38
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
5
  describe Wasabi::Document do
@@ -5,19 +7,33 @@ describe Wasabi::Document do
5
7
 
6
8
  subject { Wasabi::Document.new fixture(:authentication).read }
7
9
 
8
- its(:namespace) { should == "http://v1_0.ws.auth.order.example.com/" }
10
+ describe '#namespace' do
11
+ subject { super().namespace }
12
+ it { should == "http://v1_0.ws.auth.order.example.com/" }
13
+ end
9
14
 
10
- its(:endpoint) { should == URI("http://example.com/validation/1.0/AuthenticationService") }
15
+ describe '#endpoint' do
16
+ subject { super().endpoint }
17
+ it { should == URI("http://example.com/validation/1.0/AuthenticationService") }
18
+ end
11
19
 
12
- its(:element_form_default) { should == :unqualified }
20
+ describe '#element_form_default' do
21
+ subject { super().element_form_default }
22
+ it { should == :unqualified }
23
+ end
13
24
 
14
- it { should have(1).operations }
25
+ it 'has 1 operation' do
26
+ expect(subject.operations.size).to eq(1)
27
+ end
15
28
 
16
- its(:operations) do
29
+ describe '#operations' do
30
+ subject { super().operations }
31
+ it do
17
32
  should == {
18
33
  :authenticate => { :input => "authenticate", :output => "authenticateResponse", :action => "authenticate", :namespace_identifier => "tns" }
19
34
  }
20
35
  end
36
+ end
21
37
 
22
38
  end
23
39
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Wasabi::Document do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
5
  describe Wasabi::Document do
@@ -5,7 +7,10 @@ describe Wasabi::Document do
5
7
 
6
8
  subject { Wasabi::Document.new fixture(:encoded_endpoint).read }
7
9
 
8
- its(:endpoint) { should == URI("http://localhost/soapservice/execute?path=/base/includes/Test+Soap/Return+Rows") }
10
+ describe '#endpoint' do
11
+ subject { super().endpoint }
12
+ it { is_expected.to eq URI("http://localhost/soapservice/execute?path=/base/includes/Test+Soap/Return+Rows") }
13
+ end
9
14
 
10
15
  end
11
16
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
5
  describe Wasabi::Document do
@@ -5,19 +7,33 @@ describe Wasabi::Document do
5
7
 
6
8
  subject { Wasabi::Document.new fixture(:geotrust).read }
7
9
 
8
- its(:namespace) { should == "http://api.geotrust.com/webtrust/query" }
10
+ describe '#namespace' do
11
+ subject { super().namespace }
12
+ it { should == "http://api.geotrust.com/webtrust/query" }
13
+ end
9
14
 
10
- its(:endpoint) { should == URI("https://test-api.geotrust.com:443/webtrust/query.jws") }
15
+ describe '#endpoint' do
16
+ subject { super().endpoint }
17
+ it { should == URI("https://test-api.geotrust.com:443/webtrust/query.jws") }
18
+ end
11
19
 
12
- its(:element_form_default) { should == :qualified }
20
+ describe '#element_form_default' do
21
+ subject { super().element_form_default }
22
+ it { should == :qualified }
23
+ end
13
24
 
14
- it { should have(2).operations }
25
+ it 'has 2 operations' do
26
+ expect(subject.operations.size).to eq(2)
27
+ end
15
28
 
16
- its(:operations) do
17
- should include(
18
- { :get_quick_approver_list => { :input => "GetQuickApproverList", :action => "GetQuickApproverList", :parameters=>{:Request=>{:name=>"Request", :type=>"GetQuickApproverListInput"}}}},
19
- { :hello => { :input => "hello", :action => "hello", :parameters=>{:Input=>{:name=>"Input", :type=>"string"}} } }
20
- )
29
+ describe '#operations' do
30
+ subject { super().operations }
31
+ it do
32
+ should include(
33
+ { :get_quick_approver_list => { :input => "GetQuickApproverList", :action => "GetQuickApproverList", :parameters=>{:Request=>{:name=>"Request", :type=>"GetQuickApproverListInput"}}}},
34
+ { :hello => { :input => "hello", :action => "hello", :parameters=>{:Input=>{:name=>"Input", :type=>"string"}} } }
35
+ )
36
+ end
21
37
  end
22
38
 
23
39
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
5
  describe Wasabi::Document do
@@ -5,33 +7,36 @@ describe Wasabi::Document do
5
7
 
6
8
  subject { Wasabi::Document.new fixture(:inherited).read }
7
9
 
8
- its(:type_definitions) do
10
+ describe '#type_definitions' do
11
+ subject { super().type_definitions }
12
+ it do
9
13
  should include([["Account", "Id"], "ID"])
10
14
  should include([["Account", "ProcessId"], "ID"])
11
15
  should include([["Account", "CreatedDate"], "dateTime"])
12
16
  should include([["Account", "Description"], "string"])
13
17
  should include([["Account", "fieldsToNull"], "string"])
14
18
  end
19
+ end
15
20
 
16
21
  it "should position base class attributes before subclass attributes in :order! array" do
17
22
  account = subject.parser.types["Account"]
18
- account[:order!].should == ["fieldsToNull", "Id", "Description", "ProcessId", "CreatedDate"]
23
+ expect(account[:order!]).to eq(["fieldsToNull", "Id", "Description", "ProcessId", "CreatedDate"])
19
24
  end
20
25
 
21
26
  it "should have each type's hash remember it's base type in :base_type element" do
22
27
  account = subject.parser.types["Account"]
23
- account[:base_type].should == "baseObject"
28
+ expect(account[:base_type]).to eq("baseObject")
24
29
 
25
30
  base_object = subject.parser.types["baseObject"]
26
- base_object.should_not have_key(:base_type)
31
+ expect(base_object).not_to have_key(:base_type)
27
32
  end
28
33
 
29
34
  it "should have element's hash contain all these attributes (:nillable, :minOccurs, :maxOccurs) in addition to :type" do
30
35
  base_object = subject.parser.types["baseObject"]
31
36
  fields_to_null = base_object["fieldsToNull"]
32
- fields_to_null[:nillable].should == "true"
33
- fields_to_null[:minOccurs].should == "0"
34
- fields_to_null[:maxOccurs].should == "unbounded"
37
+ expect(fields_to_null[:nillable]).to eq("true")
38
+ expect(fields_to_null[:minOccurs]).to eq("0")
39
+ expect(fields_to_null[:maxOccurs]).to eq("unbounded")
35
40
  end
36
41
  end
37
42
  end