wasabi 2.5.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/Rakefile +1 -5
- data/lib/wasabi/document.rb +1 -1
- data/lib/wasabi/resolver.rb +18 -17
- data/lib/wasabi/version.rb +1 -1
- data/spec/wasabi/resolver_spec.rb +5 -5
- data/wasabi.gemspec +1 -1
- metadata +77 -86
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
@@ -3,11 +3,7 @@ require "rspec/core/rake_task"
|
|
3
3
|
|
4
4
|
RSpec::Core::RakeTask.new
|
5
5
|
|
6
|
-
|
7
|
-
task :require_ruby_18 do
|
8
|
-
raise "This must be run on Ruby 1.8" unless RUBY_VERSION =~ /^1\.8/
|
9
|
-
end
|
10
|
-
task :release => [:require_ruby_18]
|
6
|
+
task :release
|
11
7
|
|
12
8
|
task :default => :spec
|
13
9
|
task :test => :spec
|
data/lib/wasabi/document.rb
CHANGED
@@ -110,7 +110,7 @@ module Wasabi
|
|
110
110
|
# Returns the raw WSDL document.
|
111
111
|
# Can be used as a hook to extend the library.
|
112
112
|
def xml
|
113
|
-
@xml ||= Resolver.new(document, request).
|
113
|
+
@xml ||= Resolver.new(document, request).resolve
|
114
114
|
end
|
115
115
|
|
116
116
|
# Parses the WSDL document and returns the <tt>Wasabi::Parser</tt>.
|
data/lib/wasabi/resolver.rb
CHANGED
@@ -9,37 +9,38 @@ module Wasabi
|
|
9
9
|
|
10
10
|
class HTTPError < StandardError; end
|
11
11
|
|
12
|
+
URL = /^http[s]?:/
|
13
|
+
XML = /^</
|
14
|
+
|
12
15
|
def initialize(document, request = nil)
|
13
16
|
@document = document
|
14
|
-
@request
|
17
|
+
@request = request || HTTPI::Request.new
|
15
18
|
end
|
16
19
|
|
17
|
-
|
18
|
-
|
20
|
+
attr_reader :document, :request
|
21
|
+
|
22
|
+
def resolve
|
23
|
+
raise ArgumentError, "Unable to resolve: #{document.inspect}" unless document
|
19
24
|
|
20
|
-
case
|
21
|
-
when
|
22
|
-
when
|
23
|
-
else
|
25
|
+
case document
|
26
|
+
when URL then load_from_remote
|
27
|
+
when XML then document
|
28
|
+
else load_from_disc
|
24
29
|
end
|
25
30
|
end
|
26
31
|
|
27
32
|
private
|
28
33
|
|
29
|
-
def
|
34
|
+
def load_from_remote
|
35
|
+
request.url = document
|
30
36
|
response = HTTPI.get(request)
|
31
|
-
raise HTTPError.new(response) if response.error?
|
32
|
-
response.body
|
33
|
-
end
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
@request.url = @document
|
38
|
-
@request
|
38
|
+
raise HTTPError, response if response.error?
|
39
|
+
response.body
|
39
40
|
end
|
40
41
|
|
41
|
-
def
|
42
|
-
File.read(
|
42
|
+
def load_from_disc
|
43
|
+
File.read(document)
|
43
44
|
end
|
44
45
|
|
45
46
|
end
|
data/lib/wasabi/version.rb
CHANGED
@@ -2,20 +2,20 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Wasabi::Resolver do
|
4
4
|
|
5
|
-
describe "#
|
5
|
+
describe "#resolve" do
|
6
6
|
it "resolves remote documents" do
|
7
7
|
HTTPI.should_receive(:get) { HTTPI::Response.new(200, {}, "wsdl") }
|
8
|
-
xml = Wasabi::Resolver.new("http://example.com?wsdl").
|
8
|
+
xml = Wasabi::Resolver.new("http://example.com?wsdl").resolve
|
9
9
|
xml.should == "wsdl"
|
10
10
|
end
|
11
11
|
|
12
|
-
it "resolves
|
13
|
-
xml = Wasabi::Resolver.new(fixture(:authentication).path).
|
12
|
+
it "resolves local documents" do
|
13
|
+
xml = Wasabi::Resolver.new(fixture(:authentication).path).resolve
|
14
14
|
xml.should == fixture(:authentication).read
|
15
15
|
end
|
16
16
|
|
17
17
|
it "simply returns raw XML" do
|
18
|
-
xml = Wasabi::Resolver.new("<xml/>").
|
18
|
+
xml = Wasabi::Resolver.new("<xml/>").resolve
|
19
19
|
xml.should == "<xml/>"
|
20
20
|
end
|
21
21
|
end
|
data/wasabi.gemspec
CHANGED
metadata
CHANGED
@@ -1,93 +1,87 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: wasabi
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 5
|
9
|
-
- 1
|
10
|
-
version: 2.5.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Daniel Harrington
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
type: :runtime
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
12
|
+
date: 2012-12-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: httpi
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
version: "1.0"
|
33
|
-
version_requirements: *id001
|
34
|
-
name: httpi
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
prerelease: false
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.0'
|
37
22
|
type: :runtime
|
38
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
25
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
- 1
|
46
|
-
- 4
|
47
|
-
- 0
|
48
|
-
version: 1.4.0
|
49
|
-
version_requirements: *id002
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
50
31
|
name: nokogiri
|
51
|
-
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.4.0
|
38
|
+
type: :runtime
|
52
39
|
prerelease: false
|
53
|
-
|
54
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
55
41
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
|
61
|
-
- 0
|
62
|
-
- 9
|
63
|
-
version: "0.9"
|
64
|
-
version_requirements: *id003
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.4.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
65
47
|
name: rake
|
66
|
-
|
67
|
-
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.9'
|
68
54
|
type: :development
|
69
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
70
57
|
none: false
|
71
|
-
requirements:
|
58
|
+
requirements:
|
72
59
|
- - ~>
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
|
76
|
-
- 2
|
77
|
-
- 10
|
78
|
-
version: "2.10"
|
79
|
-
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.9'
|
62
|
+
- !ruby/object:Gem::Dependency
|
80
63
|
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.10'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.10'
|
81
78
|
description: A simple WSDL parser
|
82
|
-
email:
|
79
|
+
email:
|
83
80
|
- me@rubiii.com
|
84
81
|
executables: []
|
85
|
-
|
86
82
|
extensions: []
|
87
|
-
|
88
83
|
extra_rdoc_files: []
|
89
|
-
|
90
|
-
files:
|
84
|
+
files:
|
91
85
|
- .gitignore
|
92
86
|
- .rspec
|
93
87
|
- .travis.yml
|
@@ -141,38 +135,35 @@ files:
|
|
141
135
|
- wasabi.gemspec
|
142
136
|
homepage: https://github.com/rubiii/wasabi
|
143
137
|
licenses: []
|
144
|
-
|
145
138
|
post_install_message:
|
146
139
|
rdoc_options: []
|
147
|
-
|
148
|
-
require_paths:
|
140
|
+
require_paths:
|
149
141
|
- lib
|
150
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
143
|
none: false
|
152
|
-
requirements:
|
153
|
-
- -
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
|
156
|
-
segments:
|
144
|
+
requirements:
|
145
|
+
- - ! '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
segments:
|
157
149
|
- 0
|
158
|
-
|
159
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
+
hash: 2903585129880410612
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
152
|
none: false
|
161
|
-
requirements:
|
162
|
-
- -
|
163
|
-
- !ruby/object:Gem::Version
|
164
|
-
|
165
|
-
segments:
|
153
|
+
requirements:
|
154
|
+
- - ! '>='
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
segments:
|
166
158
|
- 0
|
167
|
-
|
159
|
+
hash: 2903585129880410612
|
168
160
|
requirements: []
|
169
|
-
|
170
161
|
rubyforge_project: wasabi
|
171
|
-
rubygems_version: 1.8.
|
162
|
+
rubygems_version: 1.8.24
|
172
163
|
signing_key:
|
173
164
|
specification_version: 3
|
174
165
|
summary: A simple WSDL parser
|
175
|
-
test_files:
|
166
|
+
test_files:
|
176
167
|
- spec/fixtures/authentication.wsdl
|
177
168
|
- spec/fixtures/geotrust.wsdl
|
178
169
|
- spec/fixtures/import_port_types.wsdl
|