wasabi 2.5.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ ## 3.0.0 (2012-12-17)
2
+
3
+ * Updated to HTTPI 2.0 to play nicely with Savon 2.0.
4
+
1
5
  ## 2.5.1 (2012-08-22)
2
6
 
3
7
  * Fix: [#14](https://github.com/rubiii/wasabi/issues/14) fixes an issue where
data/Rakefile CHANGED
@@ -3,11 +3,7 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new
5
5
 
6
- # http://stackoverflow.com/q/5771758/279024
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
@@ -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).xml
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>.
@@ -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 = request
17
+ @request = request || HTTPI::Request.new
15
18
  end
16
19
 
17
- def xml
18
- raise ArgumentError, "Wasabi is missing a document to resolve" unless @document
20
+ attr_reader :document, :request
21
+
22
+ def resolve
23
+ raise ArgumentError, "Unable to resolve: #{document.inspect}" unless document
19
24
 
20
- case @document
21
- when /^http[s]?:/ then from_remote
22
- when /^</ then @document
23
- else from_fs
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 from_remote
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
- def request
36
- @request ||= HTTPI::Request.new
37
- @request.url = @document
38
- @request
38
+ raise HTTPError, response if response.error?
39
+ response.body
39
40
  end
40
41
 
41
- def from_fs
42
- File.read(@document)
42
+ def load_from_disc
43
+ File.read(document)
43
44
  end
44
45
 
45
46
  end
@@ -1,5 +1,5 @@
1
1
  module Wasabi
2
2
 
3
- VERSION = "2.5.1"
3
+ VERSION = "3.0.0"
4
4
 
5
5
  end
@@ -2,20 +2,20 @@ require "spec_helper"
2
2
 
3
3
  describe Wasabi::Resolver do
4
4
 
5
- describe "#xml" do
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").xml
8
+ xml = Wasabi::Resolver.new("http://example.com?wsdl").resolve
9
9
  xml.should == "wsdl"
10
10
  end
11
11
 
12
- it "resolves remote documents" do
13
- xml = Wasabi::Resolver.new(fixture(:authentication).path).xml
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/>").xml
18
+ xml = Wasabi::Resolver.new("<xml/>").resolve
19
19
  xml.should == "<xml/>"
20
20
  end
21
21
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.rubyforge_project = s.name
15
15
 
16
- s.add_dependency "httpi", "~> 1.0"
16
+ s.add_dependency "httpi", "~> 2.0"
17
17
  s.add_dependency "nokogiri", ">= 1.4.0"
18
18
 
19
19
  s.add_development_dependency "rake", "~> 0.9"
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
- hash: 25
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
- date: 2012-08-22 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- prerelease: false
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
- hash: 15
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
- requirement: &id002 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
39
25
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 7
44
- segments:
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
- - !ruby/object:Gem::Dependency
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
- type: :development
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
- hash: 25
60
- segments:
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
- - !ruby/object:Gem::Dependency
67
- prerelease: false
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
- requirement: &id004 !ruby/object:Gem::Requirement
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
- hash: 23
75
- segments:
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
- hash: 3
156
- segments:
144
+ requirements:
145
+ - - ! '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ segments:
157
149
  - 0
158
- version: "0"
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
- hash: 3
165
- segments:
153
+ requirements:
154
+ - - ! '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ segments:
166
158
  - 0
167
- version: "0"
159
+ hash: 2903585129880410612
168
160
  requirements: []
169
-
170
161
  rubyforge_project: wasabi
171
- rubygems_version: 1.8.10
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