wasabi 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ require "bundler"
2
+ Bundler.require :default, :development
3
+
4
+ support_files = File.expand_path("spec/support/**/*.rb")
5
+ Dir[support_files].each { |file| require file }
6
+
7
+ RSpec.configure do |config|
8
+ config.include Fixture
9
+ end
@@ -0,0 +1,13 @@
1
+ module Fixture
2
+
3
+ def fixture(file)
4
+ fixtures[file] ||= File.read File.expand_path("spec/fixtures/#{file}.xml")
5
+ end
6
+
7
+ private
8
+
9
+ def fixtures
10
+ @fixtures ||= {}
11
+ end
12
+
13
+ end
@@ -0,0 +1,37 @@
1
+ require "spec_helper"
2
+
3
+ describe String do
4
+
5
+ describe "#snakecase" do
6
+ it "lowercases one word CamelCase" do
7
+ "Merb".snakecase.should == "merb"
8
+ end
9
+
10
+ it "makes one underscore snakecase two word CamelCase" do
11
+ "MerbCore".snakecase.should == "merb_core"
12
+ end
13
+
14
+ it "handles CamelCase with more than 2 words" do
15
+ "SoYouWantContributeToMerbCore".snakecase.should == "so_you_want_contribute_to_merb_core"
16
+ end
17
+
18
+ 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"
22
+ end
23
+
24
+ it "does NOT change one word lowercase" do
25
+ "merb".snakecase.should == "merb"
26
+ end
27
+
28
+ it "leaves snake_case as is" do
29
+ "merb_core".snakecase.should == "merb_core"
30
+ end
31
+
32
+ it "converts period characters to underscores" do
33
+ "User.GetEmail".snakecase.should == "user_get_email"
34
+ end
35
+ end
36
+
37
+ end
@@ -0,0 +1,23 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Document do
4
+ context "with: authentication.xml" do
5
+
6
+ subject { Wasabi::Document.new fixture(:authentication) }
7
+
8
+ its(:namespace) { should == "http://v1_0.ws.auth.order.example.com/" }
9
+
10
+ its(:endpoint) { should == URI("http://example.com/validation/1.0/AuthenticationService") }
11
+
12
+ its(:element_form_default) { should == :unqualified }
13
+
14
+ it { should have(1).operations }
15
+
16
+ its(:operations) do
17
+ should == {
18
+ :authenticate => { :input => "authenticate", :action => "authenticate" }
19
+ }
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Document do
4
+ context "with: geotrust.xml" do
5
+
6
+ subject { Wasabi::Document.new fixture(:geotrust) }
7
+
8
+ its(:namespace) { should == "http://api.geotrust.com/webtrust/query" }
9
+
10
+ its(:endpoint) { should == URI("https://test-api.geotrust.com:443/webtrust/query.jws") }
11
+
12
+ its(:element_form_default) { should == :qualified }
13
+
14
+ it { should have(2).operations }
15
+
16
+ its(:operations) do
17
+ should include(
18
+ { :get_quick_approver_list => { :input => "GetQuickApproverList", :action => "GetQuickApproverList" } },
19
+ { :hello => { :input => "hello", :action => "hello" } }
20
+ )
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Document do
4
+ context "with: namespaced_actions.xml" do
5
+
6
+ subject { Wasabi::Document.new fixture(:namespaced_actions) }
7
+
8
+ its(:namespace) { should == "http://api.example.com/api/" }
9
+
10
+ its(:endpoint) { should == URI("https://api.example.com/api/api.asmx") }
11
+
12
+ its(:element_form_default) { should == :qualified }
13
+
14
+ it { should have(3).operations }
15
+
16
+ its(:operations) do
17
+ should include(
18
+ { :delete_client => { :input => "DeleteClient", :action => "http://api.example.com/api/Client.Delete" } },
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" } }
21
+ )
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Document do
4
+ context "with: no_namespace.xml" do
5
+
6
+ subject { Wasabi::Document.new fixture(:no_namespace) }
7
+
8
+ its(:namespace) { should == "urn:ActionWebService" }
9
+
10
+ its(:endpoint) { should == URI("http://example.com/api/api") }
11
+
12
+ its(:element_form_default) { should == :unqualified }
13
+
14
+ it { should have(3).operations }
15
+
16
+ its(:operations) do
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" } }
21
+ )
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Document do
4
+ context "with: soap12.xml" do
5
+
6
+ subject { Wasabi::Document.new fixture(:soap12) }
7
+
8
+ its(:endpoint) { should == URI("http://blogsite.example.com/endpoint12") }
9
+
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Document do
4
+ context "with: two_bindings.xml" do
5
+
6
+ subject { Wasabi::Document.new fixture(:two_bindings) }
7
+
8
+ its(:element_form_default) { should == :unqualified }
9
+
10
+ it { should have(3).operations }
11
+
12
+ its(:operations) do
13
+ should include(
14
+ { :post => { :input => "Post", :action => "Post" } },
15
+ { :post11only => { :input => "Post11only", :action => "Post11only" } },
16
+ { :post12only => { :input => "Post12only", :action => "Post12only" } }
17
+ )
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi do
4
+
5
+ describe ".document" do
6
+ it "should return a new Wasabi::Document" do
7
+ document = Wasabi.document fixture(:authentication)
8
+ document.should be_a(Wasabi::Document)
9
+ end
10
+ end
11
+
12
+ end
@@ -0,0 +1,27 @@
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/rubiii/#{s.name}"
11
+ s.summary = "A simple WSDL parser"
12
+ s.description = s.summary
13
+
14
+ s.rubyforge_project = s.name
15
+
16
+ s.add_dependency "nokogiri", ">= 1.4.0"
17
+
18
+ s.add_development_dependency "rake", "~> 0.8.7"
19
+ s.add_development_dependency "rspec", "~> 2.5.0"
20
+ s.add_development_dependency "mocha", "~> 0.9.8"
21
+ s.add_development_dependency "autotest"
22
+
23
+ s.files = `git ls-files`.split("\n")
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
+ s.require_paths = ["lib"]
27
+ end
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wasabi
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Daniel Harrington
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-07-03 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: nokogiri
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 1
31
+ - 4
32
+ - 0
33
+ version: 1.4.0
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 49
45
+ segments:
46
+ - 0
47
+ - 8
48
+ - 7
49
+ version: 0.8.7
50
+ type: :development
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: rspec
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 27
61
+ segments:
62
+ - 2
63
+ - 5
64
+ - 0
65
+ version: 2.5.0
66
+ type: :development
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: mocha
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ hash: 43
77
+ segments:
78
+ - 0
79
+ - 9
80
+ - 8
81
+ version: 0.9.8
82
+ type: :development
83
+ version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
85
+ name: autotest
86
+ prerelease: false
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ hash: 3
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ type: :development
97
+ version_requirements: *id005
98
+ description: A simple WSDL parser
99
+ email:
100
+ - me@rubiii.com
101
+ executables: []
102
+
103
+ extensions: []
104
+
105
+ extra_rdoc_files: []
106
+
107
+ files:
108
+ - .gitignore
109
+ - .rspec
110
+ - .travis.yml
111
+ - CHANGELOG.md
112
+ - Gemfile
113
+ - LICENSE
114
+ - README.md
115
+ - Rakefile
116
+ - lib/wasabi.rb
117
+ - lib/wasabi/core_ext/string.rb
118
+ - lib/wasabi/document.rb
119
+ - lib/wasabi/parser.rb
120
+ - lib/wasabi/version.rb
121
+ - spec/fixtures/authentication.xml
122
+ - spec/fixtures/geotrust.xml
123
+ - spec/fixtures/namespaced_actions.xml
124
+ - spec/fixtures/no_namespace.xml
125
+ - spec/fixtures/soap12.xml
126
+ - spec/fixtures/two_bindings.xml
127
+ - spec/spec_helper.rb
128
+ - spec/support/fixture.rb
129
+ - spec/wasabi/core_ext/string_spec.rb
130
+ - spec/wasabi/document/authentication_spec.rb
131
+ - spec/wasabi/document/geotrust_spec.rb
132
+ - spec/wasabi/document/namespaced_actions_spec.rb
133
+ - spec/wasabi/document/no_namespace_spec.rb
134
+ - spec/wasabi/document/soap12_spec.rb
135
+ - spec/wasabi/document/two_bindings_spec.rb
136
+ - spec/wasabi/wasabi_spec.rb
137
+ - wasabi.gemspec
138
+ homepage: https://github.com/rubiii/wasabi
139
+ licenses: []
140
+
141
+ post_install_message:
142
+ rdoc_options: []
143
+
144
+ require_paths:
145
+ - lib
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ none: false
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ hash: 3
152
+ segments:
153
+ - 0
154
+ version: "0"
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ hash: 3
161
+ segments:
162
+ - 0
163
+ version: "0"
164
+ requirements: []
165
+
166
+ rubyforge_project: wasabi
167
+ rubygems_version: 1.8.5
168
+ signing_key:
169
+ specification_version: 3
170
+ summary: A simple WSDL parser
171
+ test_files:
172
+ - spec/fixtures/authentication.xml
173
+ - spec/fixtures/geotrust.xml
174
+ - spec/fixtures/namespaced_actions.xml
175
+ - spec/fixtures/no_namespace.xml
176
+ - spec/fixtures/soap12.xml
177
+ - spec/fixtures/two_bindings.xml
178
+ - spec/spec_helper.rb
179
+ - spec/support/fixture.rb
180
+ - spec/wasabi/core_ext/string_spec.rb
181
+ - spec/wasabi/document/authentication_spec.rb
182
+ - spec/wasabi/document/geotrust_spec.rb
183
+ - spec/wasabi/document/namespaced_actions_spec.rb
184
+ - spec/wasabi/document/no_namespace_spec.rb
185
+ - spec/wasabi/document/soap12_spec.rb
186
+ - spec/wasabi/document/two_bindings_spec.rb
187
+ - spec/wasabi/wasabi_spec.rb