wasabi 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +4 -0
- data/lib/wasabi/parser.rb +67 -18
- data/lib/wasabi/version.rb +1 -1
- data/spec/fixtures/savon562.wsdl +13882 -0
- data/spec/wasabi/core_ext/string_spec.rb +9 -9
- data/spec/wasabi/document/authentication_spec.rb +19 -5
- data/spec/wasabi/document/encoded_endpoint_spec.rb +4 -1
- data/spec/wasabi/document/geotrust_spec.rb +19 -5
- data/spec/wasabi/document/inherited_spec.rb +10 -7
- data/spec/wasabi/document/multiple_namespaces_spec.rb +27 -7
- data/spec/wasabi/document/namespaced_actions_spec.rb +19 -5
- data/spec/wasabi/document/no_namespace_spec.rb +19 -5
- data/spec/wasabi/document/savon295_spec.rb +4 -1
- data/spec/wasabi/document/soap12_spec.rb +4 -1
- data/spec/wasabi/document/two_bindings_spec.rb +11 -3
- data/spec/wasabi/document_spec.rb +6 -6
- data/spec/wasabi/parser/get_servicename_spec.rb +1 -1
- data/spec/wasabi/parser/import_port_types_spec.rb +2 -2
- data/spec/wasabi/parser/juniper_spec.rb +3 -3
- data/spec/wasabi/parser/marketo_spec.rb +1 -1
- data/spec/wasabi/parser/message_element_spec.rb +17 -0
- data/spec/wasabi/parser/multiple_namespaces_spec.rb +7 -7
- data/spec/wasabi/parser/multiple_parts_in_message_spec.rb +8 -4
- data/spec/wasabi/parser/no_message_parts_spec.rb +6 -6
- data/spec/wasabi/parser/no_namespace_spec.rb +4 -4
- data/spec/wasabi/parser/no_target_namespace_spec.rb +1 -1
- data/spec/wasabi/parser/symbolic_endpoint_spec.rb +2 -2
- data/spec/wasabi/parser/tradetracker_spec.rb +1 -1
- data/spec/wasabi/resolver_spec.rb +10 -10
- data/spec/wasabi/wasabi_spec.rb +1 -1
- data/wasabi.gemspec +1 -2
- metadata +22 -32
@@ -4,33 +4,33 @@ describe String do
|
|
4
4
|
|
5
5
|
describe "#snakecase" do
|
6
6
|
it "lowercases one word CamelCase" do
|
7
|
-
"Merb".snakecase.
|
7
|
+
expect("Merb".snakecase).to eq("merb")
|
8
8
|
end
|
9
9
|
|
10
10
|
it "makes one underscore snakecase two word CamelCase" do
|
11
|
-
"MerbCore".snakecase.
|
11
|
+
expect("MerbCore".snakecase).to eq("merb_core")
|
12
12
|
end
|
13
13
|
|
14
14
|
it "handles CamelCase with more than 2 words" do
|
15
|
-
"SoYouWantContributeToMerbCore".snakecase.
|
15
|
+
expect("SoYouWantContributeToMerbCore".snakecase).to eq("so_you_want_contribute_to_merb_core")
|
16
16
|
end
|
17
17
|
|
18
18
|
it "handles CamelCase with more than 2 capital letter in a row" do
|
19
|
-
"CNN".snakecase.
|
20
|
-
"CNNNews".snakecase.
|
21
|
-
"HeadlineCNNNews".snakecase.
|
19
|
+
expect("CNN".snakecase).to eq("cnn")
|
20
|
+
expect("CNNNews".snakecase).to eq("cnn_news")
|
21
|
+
expect("HeadlineCNNNews".snakecase).to eq("headline_cnn_news")
|
22
22
|
end
|
23
23
|
|
24
24
|
it "does NOT change one word lowercase" do
|
25
|
-
"merb".snakecase.
|
25
|
+
expect("merb".snakecase).to eq("merb")
|
26
26
|
end
|
27
27
|
|
28
28
|
it "leaves snake_case as is" do
|
29
|
-
"merb_core".snakecase.
|
29
|
+
expect("merb_core".snakecase).to eq("merb_core")
|
30
30
|
end
|
31
31
|
|
32
32
|
it "converts period characters to underscores" do
|
33
|
-
"User.GetEmail".snakecase.
|
33
|
+
expect("User.GetEmail".snakecase).to eq("user_get_email")
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -5,19 +5,33 @@ describe Wasabi::Document do
|
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:authentication).read }
|
7
7
|
|
8
|
-
|
8
|
+
describe '#namespace' do
|
9
|
+
subject { super().namespace }
|
10
|
+
it { should == "http://v1_0.ws.auth.order.example.com/" }
|
11
|
+
end
|
9
12
|
|
10
|
-
|
13
|
+
describe '#endpoint' do
|
14
|
+
subject { super().endpoint }
|
15
|
+
it { should == URI("http://example.com/validation/1.0/AuthenticationService") }
|
16
|
+
end
|
11
17
|
|
12
|
-
|
18
|
+
describe '#element_form_default' do
|
19
|
+
subject { super().element_form_default }
|
20
|
+
it { should == :unqualified }
|
21
|
+
end
|
13
22
|
|
14
|
-
it
|
23
|
+
it 'has 1 operation' do
|
24
|
+
expect(subject.operations.size).to eq(1)
|
25
|
+
end
|
15
26
|
|
16
|
-
|
27
|
+
describe '#operations' do
|
28
|
+
subject { super().operations }
|
29
|
+
it do
|
17
30
|
should == {
|
18
31
|
:authenticate => { :input => "authenticate", :output => "authenticateResponse", :action => "authenticate", :namespace_identifier => "tns" }
|
19
32
|
}
|
20
33
|
end
|
34
|
+
end
|
21
35
|
|
22
36
|
end
|
23
37
|
end
|
@@ -5,7 +5,10 @@ describe Wasabi::Document do
|
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:encoded_endpoint).read }
|
7
7
|
|
8
|
-
|
8
|
+
describe '#endpoint' do
|
9
|
+
subject { super().endpoint }
|
10
|
+
it { should == URI("http://localhost/soapservice/execute?path=/base/includes/Test+Soap/Return+Rows") }
|
11
|
+
end
|
9
12
|
|
10
13
|
end
|
11
14
|
end
|
@@ -5,20 +5,34 @@ describe Wasabi::Document do
|
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:geotrust).read }
|
7
7
|
|
8
|
-
|
8
|
+
describe '#namespace' do
|
9
|
+
subject { super().namespace }
|
10
|
+
it { should == "http://api.geotrust.com/webtrust/query" }
|
11
|
+
end
|
9
12
|
|
10
|
-
|
13
|
+
describe '#endpoint' do
|
14
|
+
subject { super().endpoint }
|
15
|
+
it { should == URI("https://test-api.geotrust.com:443/webtrust/query.jws") }
|
16
|
+
end
|
11
17
|
|
12
|
-
|
18
|
+
describe '#element_form_default' do
|
19
|
+
subject { super().element_form_default }
|
20
|
+
it { should == :qualified }
|
21
|
+
end
|
13
22
|
|
14
|
-
it
|
23
|
+
it 'has 2 operations' do
|
24
|
+
expect(subject.operations.size).to eq(2)
|
25
|
+
end
|
15
26
|
|
16
|
-
|
27
|
+
describe '#operations' do
|
28
|
+
subject { super().operations }
|
29
|
+
it do
|
17
30
|
should include(
|
18
31
|
{ :get_quick_approver_list => { :input => "GetQuickApproverList", :action => "GetQuickApproverList", :parameters=>{:Request=>{:name=>"Request", :type=>"GetQuickApproverListInput"}}}},
|
19
32
|
{ :hello => { :input => "hello", :action => "hello", :parameters=>{:Input=>{:name=>"Input", :type=>"string"}} } }
|
20
33
|
)
|
21
34
|
end
|
35
|
+
end
|
22
36
|
|
23
37
|
end
|
24
38
|
end
|
@@ -5,33 +5,36 @@ describe Wasabi::Document do
|
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:inherited).read }
|
7
7
|
|
8
|
-
|
8
|
+
describe '#type_definitions' do
|
9
|
+
subject { super().type_definitions }
|
10
|
+
it do
|
9
11
|
should include([["Account", "Id"], "ID"])
|
10
12
|
should include([["Account", "ProcessId"], "ID"])
|
11
13
|
should include([["Account", "CreatedDate"], "dateTime"])
|
12
14
|
should include([["Account", "Description"], "string"])
|
13
15
|
should include([["Account", "fieldsToNull"], "string"])
|
14
16
|
end
|
17
|
+
end
|
15
18
|
|
16
19
|
it "should position base class attributes before subclass attributes in :order! array" do
|
17
20
|
account = subject.parser.types["Account"]
|
18
|
-
account[:order!].
|
21
|
+
expect(account[:order!]).to eq(["fieldsToNull", "Id", "Description", "ProcessId", "CreatedDate"])
|
19
22
|
end
|
20
23
|
|
21
24
|
it "should have each type's hash remember it's base type in :base_type element" do
|
22
25
|
account = subject.parser.types["Account"]
|
23
|
-
account[:base_type].
|
26
|
+
expect(account[:base_type]).to eq("baseObject")
|
24
27
|
|
25
28
|
base_object = subject.parser.types["baseObject"]
|
26
|
-
base_object.
|
29
|
+
expect(base_object).not_to have_key(:base_type)
|
27
30
|
end
|
28
31
|
|
29
32
|
it "should have element's hash contain all these attributes (:nillable, :minOccurs, :maxOccurs) in addition to :type" do
|
30
33
|
base_object = subject.parser.types["baseObject"]
|
31
34
|
fields_to_null = base_object["fieldsToNull"]
|
32
|
-
fields_to_null[:nillable].
|
33
|
-
fields_to_null[:minOccurs].
|
34
|
-
fields_to_null[:maxOccurs].
|
35
|
+
expect(fields_to_null[:nillable]).to eq("true")
|
36
|
+
expect(fields_to_null[:minOccurs]).to eq("0")
|
37
|
+
expect(fields_to_null[:maxOccurs]).to eq("unbounded")
|
35
38
|
end
|
36
39
|
end
|
37
40
|
end
|
@@ -5,19 +5,35 @@ describe Wasabi::Document do
|
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:multiple_namespaces).read }
|
7
7
|
|
8
|
-
|
8
|
+
describe '#namespace' do
|
9
|
+
subject { super().namespace }
|
10
|
+
it { should == "http://example.com/actions" }
|
11
|
+
end
|
9
12
|
|
10
|
-
|
13
|
+
describe '#endpoint' do
|
14
|
+
subject { super().endpoint }
|
15
|
+
it { should == URI("http://example.com:1234/soap") }
|
16
|
+
end
|
11
17
|
|
12
|
-
|
18
|
+
describe '#element_form_default' do
|
19
|
+
subject { super().element_form_default }
|
20
|
+
it { should == :qualified }
|
21
|
+
end
|
13
22
|
|
14
|
-
it
|
23
|
+
it 'has 1 operation' do
|
24
|
+
expect(subject.operations.size).to eq(1)
|
25
|
+
end
|
15
26
|
|
16
|
-
|
27
|
+
describe '#operations' do
|
28
|
+
subject { super().operations }
|
29
|
+
it do
|
17
30
|
should == { :save => { :input => "Save", :output=>"SaveResponse", :action => "http://example.com/actions.Save", :namespace_identifier => "actions", :parameters => { :article => { :name => "article", :type => "Article" } } } }
|
18
31
|
end
|
32
|
+
end
|
19
33
|
|
20
|
-
|
34
|
+
describe '#type_namespaces' do
|
35
|
+
subject { super().type_namespaces }
|
36
|
+
it do
|
21
37
|
should =~ [
|
22
38
|
[["Save"], "http://example.com/actions"],
|
23
39
|
[["Save", "article"], "http://example.com/actions"],
|
@@ -26,10 +42,14 @@ describe Wasabi::Document do
|
|
26
42
|
[["Article", "Title"], "http://example.com/article"]
|
27
43
|
]
|
28
44
|
end
|
45
|
+
end
|
29
46
|
|
30
|
-
|
47
|
+
describe '#type_definitions' do
|
48
|
+
subject { super().type_definitions }
|
49
|
+
it do
|
31
50
|
should =~ [ [["Save", "article"], "Article"] ]
|
32
51
|
end
|
52
|
+
end
|
33
53
|
|
34
54
|
end
|
35
55
|
end
|
@@ -5,21 +5,35 @@ describe Wasabi::Document do
|
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:namespaced_actions).read }
|
7
7
|
|
8
|
-
|
8
|
+
describe '#namespace' do
|
9
|
+
subject { super().namespace }
|
10
|
+
it { should == "http://api.example.com/api/" }
|
11
|
+
end
|
9
12
|
|
10
|
-
|
13
|
+
describe '#endpoint' do
|
14
|
+
subject { super().endpoint }
|
15
|
+
it { should == URI("https://api.example.com/api/api.asmx") }
|
16
|
+
end
|
11
17
|
|
12
|
-
|
18
|
+
describe '#element_form_default' do
|
19
|
+
subject { super().element_form_default }
|
20
|
+
it { should == :qualified }
|
21
|
+
end
|
13
22
|
|
14
|
-
it
|
23
|
+
it 'has 3 operations' do
|
24
|
+
expect(subject.operations.size).to eq(3)
|
25
|
+
end
|
15
26
|
|
16
|
-
|
27
|
+
describe '#operations' do
|
28
|
+
subject { super().operations }
|
29
|
+
it do
|
17
30
|
should include(
|
18
31
|
{ :delete_client => { :input => "Client.Delete", :output => "Client.DeleteResponse", :action => "http://api.example.com/api/Client.Delete", :namespace_identifier => "tns" } },
|
19
32
|
{ :get_clients => { :input => "User.GetClients", :output => "User.GetClientsResponse", :action => "http://api.example.com/api/User.GetClients", :namespace_identifier => "tns" } },
|
20
33
|
{ :get_api_key => { :input => "User.GetApiKey", :output => "User.GetApiKeyResponse", :action => "http://api.example.com/api/User.GetApiKey", :namespace_identifier => "tns" } }
|
21
34
|
)
|
22
35
|
end
|
36
|
+
end
|
23
37
|
|
24
38
|
end
|
25
39
|
end
|
@@ -5,21 +5,35 @@ describe Wasabi::Document do
|
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:no_namespace).read }
|
7
7
|
|
8
|
-
|
8
|
+
describe '#namespace' do
|
9
|
+
subject { super().namespace }
|
10
|
+
it { should == "urn:ActionWebService" }
|
11
|
+
end
|
9
12
|
|
10
|
-
|
13
|
+
describe '#endpoint' do
|
14
|
+
subject { super().endpoint }
|
15
|
+
it { should == URI("http://example.com/api/api") }
|
16
|
+
end
|
11
17
|
|
12
|
-
|
18
|
+
describe '#element_form_default' do
|
19
|
+
subject { super().element_form_default }
|
20
|
+
it { should == :unqualified }
|
21
|
+
end
|
13
22
|
|
14
|
-
it
|
23
|
+
it 'has 3 operations' do
|
24
|
+
expect(subject.operations.size).to eq(3)
|
25
|
+
end
|
15
26
|
|
16
|
-
|
27
|
+
describe '#operations' do
|
28
|
+
subject { super().operations }
|
29
|
+
it do
|
17
30
|
should include(
|
18
31
|
{ :get_user_login_by_id => { :input => "GetUserLoginById", :output => "GetUserLoginById", :action => "/api/api/GetUserLoginById", :namespace_identifier => "typens" } },
|
19
32
|
{ :get_all_contacts => { :input => "GetAllContacts", :output =>"GetAllContacts", :action => "/api/api/GetAllContacts", :namespace_identifier => "typens" } },
|
20
33
|
{ :search_user => { :input => "SearchUser", :output =>"SearchUser", :action => "/api/api/SearchUser", :namespace_identifier => nil } }
|
21
34
|
)
|
22
35
|
end
|
36
|
+
end
|
23
37
|
|
24
38
|
end
|
25
39
|
end
|
@@ -5,11 +5,14 @@ describe Wasabi::Document do
|
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:savon295).read }
|
7
7
|
|
8
|
-
|
8
|
+
describe '#operations' do
|
9
|
+
subject { super().operations }
|
10
|
+
it do
|
9
11
|
should include(
|
10
12
|
{ :sendsms => { :input => "sendsms", :output => "sendsms", :action => "sendsms", :namespace_identifier => "tns" } }
|
11
13
|
)
|
12
14
|
end
|
15
|
+
end
|
13
16
|
|
14
17
|
end
|
15
18
|
end
|
@@ -5,7 +5,10 @@ describe Wasabi::Document do
|
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:soap12).read }
|
7
7
|
|
8
|
-
|
8
|
+
describe '#endpoint' do
|
9
|
+
subject { super().endpoint }
|
10
|
+
it { should == URI("http://blogsite.example.com/endpoint12") }
|
11
|
+
end
|
9
12
|
|
10
13
|
end
|
11
14
|
end
|
@@ -5,17 +5,25 @@ describe Wasabi::Document do
|
|
5
5
|
|
6
6
|
subject { Wasabi::Document.new fixture(:two_bindings).read }
|
7
7
|
|
8
|
-
|
8
|
+
describe '#element_form_default' do
|
9
|
+
subject { super().element_form_default }
|
10
|
+
it { should == :unqualified }
|
11
|
+
end
|
9
12
|
|
10
|
-
it
|
13
|
+
it 'has 3 operations' do
|
14
|
+
expect(subject.operations.size).to eq(3)
|
15
|
+
end
|
11
16
|
|
12
|
-
|
17
|
+
describe '#operations' do
|
18
|
+
subject { super().operations }
|
19
|
+
it do
|
13
20
|
should include(
|
14
21
|
{ :post => { :input => "Post", :action => "Post" } },
|
15
22
|
{ :post11only => { :input => "Post11only", :action => "Post11only" } },
|
16
23
|
{ :post12only => { :input => "Post12only", :action => "Post12only" } }
|
17
24
|
)
|
18
25
|
end
|
26
|
+
end
|
19
27
|
|
20
28
|
end
|
21
29
|
end
|
@@ -5,20 +5,20 @@ describe Wasabi::Document do
|
|
5
5
|
subject { Wasabi::Document.new fixture(:authentication).read }
|
6
6
|
|
7
7
|
it "accepts a URL" do
|
8
|
-
HTTPI.
|
8
|
+
expect(HTTPI).to receive(:get) { HTTPI::Response.new(200, {}, "wsdl") }
|
9
9
|
|
10
10
|
document = Wasabi::Document.new("http://example.com?wsdl")
|
11
|
-
document.xml.
|
11
|
+
expect(document.xml).to eq("wsdl")
|
12
12
|
end
|
13
13
|
|
14
14
|
it "accepts a path" do
|
15
15
|
document = Wasabi::Document.new fixture(:authentication).path
|
16
|
-
document.xml.
|
16
|
+
expect(document.xml).to eq(fixture(:authentication).read)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "accepts raw XML" do
|
20
20
|
document = Wasabi::Document.new fixture(:authentication).read
|
21
|
-
document.xml.
|
21
|
+
expect(document.xml).to eq(fixture(:authentication).read)
|
22
22
|
end
|
23
23
|
|
24
24
|
describe ".validate_element_form_default!" do
|
@@ -39,13 +39,13 @@ describe Wasabi::Document do
|
|
39
39
|
|
40
40
|
describe "#element_form_default" do
|
41
41
|
it "defaults to :unqualified" do
|
42
|
-
subject.element_form_default.
|
42
|
+
expect(subject.element_form_default).to eq(:unqualified)
|
43
43
|
end
|
44
44
|
|
45
45
|
[:unqualified, :qualified].each do |value|
|
46
46
|
it "accepts :#{value}" do
|
47
47
|
subject.element_form_default = value
|
48
|
-
subject.element_form_default.
|
48
|
+
expect(subject.element_form_default).to eq(value)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -14,8 +14,8 @@ describe Wasabi::Parser do
|
|
14
14
|
it "does blow up when portTypes are imported" do
|
15
15
|
get_customer = subject.operations[:get_customer]
|
16
16
|
|
17
|
-
get_customer[:input].
|
18
|
-
get_customer[:namespace_identifier].
|
17
|
+
expect(get_customer[:input]).to eq("GetCustomer")
|
18
|
+
expect(get_customer[:namespace_identifier]).to be_nil
|
19
19
|
end
|
20
20
|
|
21
21
|
end
|
@@ -14,9 +14,9 @@ describe Wasabi::Parser do
|
|
14
14
|
it 'does not blow up when an extension base element is defined in an import' do
|
15
15
|
request = subject.operations[:get_system_info_request]
|
16
16
|
|
17
|
-
request[:input].
|
18
|
-
request[:action].
|
19
|
-
request[:namespace_identifier].
|
17
|
+
expect(request[:input]).to eq('GetSystemInfoRequest')
|
18
|
+
expect(request[:action]).to eq('urn:#GetSystemInfoRequest')
|
19
|
+
expect(request[:namespace_identifier]).to eq('impl')
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|