savon 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -1
- data/.yardopts +4 -1
- data/CHANGELOG.md +34 -0
- data/Gemfile +0 -5
- data/README.md +14 -12
- data/Rakefile +2 -6
- data/lib/savon.rb +4 -3
- data/lib/savon/config.rb +103 -0
- data/lib/savon/hooks/group.rb +46 -0
- data/lib/savon/hooks/hook.rb +36 -0
- data/lib/savon/model.rb +103 -0
- data/lib/savon/soap/invalid_response_error.rb +11 -0
- data/lib/savon/soap/request.rb +19 -20
- data/lib/savon/soap/response.rb +7 -0
- data/lib/savon/soap/xml.rb +9 -1
- data/lib/savon/version.rb +1 -1
- data/savon.gemspec +3 -0
- data/spec/savon/model_spec.rb +194 -0
- data/spec/savon/savon_spec.rb +33 -11
- data/spec/savon/soap/request_spec.rb +24 -10
- data/spec/savon/soap/response_spec.rb +15 -0
- data/spec/savon/soap/xml_spec.rb +20 -3
- data/spec/spec_helper.rb +2 -5
- metadata +124 -161
- data/lib/savon/global.rb +0 -109
@@ -121,6 +121,10 @@ describe Savon::SOAP::Response do
|
|
121
121
|
soap_response[:authenticate_response][:return].should ==
|
122
122
|
Fixture.response_hash(:authentication)[:authenticate_response][:return]
|
123
123
|
end
|
124
|
+
|
125
|
+
it "should throw an exception when the response body isn't parsable" do
|
126
|
+
lambda { invalid_soap_response.body }.should raise_error Savon::SOAP::InvalidResponseError
|
127
|
+
end
|
124
128
|
end
|
125
129
|
|
126
130
|
describe "#header" do
|
@@ -128,6 +132,10 @@ describe Savon::SOAP::Response do
|
|
128
132
|
response = soap_response :body => Fixture.response(:header)
|
129
133
|
response.header.should include(:session_number => "ABCD1234")
|
130
134
|
end
|
135
|
+
|
136
|
+
it "should throw an exception when the response header isn't parsable" do
|
137
|
+
lambda { invalid_soap_response.header }.should raise_error Savon::SOAP::InvalidResponseError
|
138
|
+
end
|
131
139
|
end
|
132
140
|
|
133
141
|
%w(body to_hash).each do |method|
|
@@ -221,4 +229,11 @@ describe Savon::SOAP::Response do
|
|
221
229
|
soap_response :code => 404, :body => "Not found"
|
222
230
|
end
|
223
231
|
|
232
|
+
def invalid_soap_response(options={})
|
233
|
+
defaults = { :code => 200, :headers => {}, :body => "I'm not SOAP" }
|
234
|
+
response = defaults.merge options
|
235
|
+
|
236
|
+
Savon::SOAP::Response.new HTTPI::Response.new(response[:code], response[:headers], response[:body])
|
237
|
+
end
|
238
|
+
|
224
239
|
end
|
data/spec/savon/soap/xml_spec.rb
CHANGED
@@ -124,6 +124,12 @@ describe Savon::SOAP::XML do
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
+
describe "#encoding" do
|
128
|
+
it "defaults to UTF-8" do
|
129
|
+
xml.encoding.should == "UTF-8"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
127
133
|
describe "#xml" do
|
128
134
|
it "lets you specify a completely custom XML String" do
|
129
135
|
xml.xml = "<custom>xml</custom>"
|
@@ -143,9 +149,9 @@ describe Savon::SOAP::XML do
|
|
143
149
|
xml.to_xml.should == '<?xml version="1.0" encoding="UTF-8" aaa="bbb"?><using>Builder</using>'
|
144
150
|
end
|
145
151
|
|
146
|
-
it "
|
147
|
-
xml.xml(:xml, :encoding => "
|
148
|
-
xml.to_xml.should == '<?xml version="1.0" encoding="
|
152
|
+
it "allows to change the encoding" do
|
153
|
+
xml.xml(:xml, :encoding => "US-ASCII") { |xml| xml.using("Builder") }
|
154
|
+
xml.to_xml.should == '<?xml version="1.0" encoding="US-ASCII"?><using>Builder</using>'
|
149
155
|
end
|
150
156
|
end
|
151
157
|
|
@@ -190,6 +196,17 @@ describe Savon::SOAP::XML do
|
|
190
196
|
end
|
191
197
|
end
|
192
198
|
|
199
|
+
context "with a custom encoding" do
|
200
|
+
after do
|
201
|
+
xml.encoding = nil
|
202
|
+
end
|
203
|
+
|
204
|
+
it "should change the default encoding" do
|
205
|
+
xml.encoding = "US-ASCII"
|
206
|
+
xml.to_xml.should match(/^<\?xml version="1.0" encoding="US-ASCII"\?>/)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
193
210
|
context "with a SOAP header" do
|
194
211
|
it "should contain the given header" do
|
195
212
|
xml.header = {
|
data/spec/spec_helper.rb
CHANGED
@@ -5,11 +5,8 @@ RSpec.configure do |config|
|
|
5
5
|
config.mock_with :mocha
|
6
6
|
end
|
7
7
|
|
8
|
-
# Disable logging
|
9
|
-
Savon.
|
10
|
-
config.log = false
|
11
|
-
config.deprecate = false
|
12
|
-
end
|
8
|
+
# Disable logging for specs.
|
9
|
+
Savon.log = false
|
13
10
|
|
14
11
|
require "support/endpoint"
|
15
12
|
require "support/fixture"
|
metadata
CHANGED
@@ -1,203 +1,165 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: savon
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.8
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 9
|
9
|
-
- 7
|
10
|
-
version: 0.9.7
|
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
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: builder
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2153571860 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 15
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 1
|
32
|
-
- 2
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 2.1.2
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: nori
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: *2153571860
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: nori
|
27
|
+
requirement: &2153571220 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
29
|
+
requirements:
|
42
30
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 1
|
47
|
-
- 0
|
48
|
-
version: "1.0"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.0'
|
49
33
|
type: :runtime
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: httpi
|
53
34
|
prerelease: false
|
54
|
-
|
35
|
+
version_requirements: *2153571220
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: httpi
|
38
|
+
requirement: &2153570580 !ruby/object:Gem::Requirement
|
55
39
|
none: false
|
56
|
-
requirements:
|
40
|
+
requirements:
|
57
41
|
- - ~>
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
- 9
|
63
|
-
version: "0.9"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0.9'
|
64
44
|
type: :runtime
|
65
|
-
version_requirements: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: wasabi
|
68
45
|
prerelease: false
|
69
|
-
|
46
|
+
version_requirements: *2153570580
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: wasabi
|
49
|
+
requirement: &2153570060 !ruby/object:Gem::Requirement
|
70
50
|
none: false
|
71
|
-
requirements:
|
51
|
+
requirements:
|
72
52
|
- - ~>
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
segments:
|
76
|
-
- 2
|
77
|
-
- 0
|
78
|
-
version: "2.0"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
79
55
|
type: :runtime
|
80
|
-
version_requirements: *id004
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: akami
|
83
56
|
prerelease: false
|
84
|
-
|
57
|
+
version_requirements: *2153570060
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: akami
|
60
|
+
requirement: &2153569500 !ruby/object:Gem::Requirement
|
85
61
|
none: false
|
86
|
-
requirements:
|
62
|
+
requirements:
|
87
63
|
- - ~>
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
|
90
|
-
segments:
|
91
|
-
- 1
|
92
|
-
- 0
|
93
|
-
version: "1.0"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '1.0'
|
94
66
|
type: :runtime
|
95
|
-
version_requirements: *id005
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
|
-
name: gyoku
|
98
67
|
prerelease: false
|
99
|
-
|
68
|
+
version_requirements: *2153569500
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: gyoku
|
71
|
+
requirement: &2153569020 !ruby/object:Gem::Requirement
|
100
72
|
none: false
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
hash: 15
|
105
|
-
segments:
|
106
|
-
- 0
|
107
|
-
- 4
|
108
|
-
- 0
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
109
76
|
version: 0.4.0
|
110
77
|
type: :runtime
|
111
|
-
version_requirements: *id006
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: nokogiri
|
114
78
|
prerelease: false
|
115
|
-
|
79
|
+
version_requirements: *2153569020
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: nokogiri
|
82
|
+
requirement: &2153568540 !ruby/object:Gem::Requirement
|
116
83
|
none: false
|
117
|
-
requirements:
|
118
|
-
- -
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
hash: 7
|
121
|
-
segments:
|
122
|
-
- 1
|
123
|
-
- 4
|
124
|
-
- 0
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
125
87
|
version: 1.4.0
|
126
88
|
type: :runtime
|
127
|
-
version_requirements: *id007
|
128
|
-
- !ruby/object:Gem::Dependency
|
129
|
-
name: rake
|
130
89
|
prerelease: false
|
131
|
-
|
90
|
+
version_requirements: *2153568540
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rake
|
93
|
+
requirement: &2153568060 !ruby/object:Gem::Requirement
|
132
94
|
none: false
|
133
|
-
requirements:
|
95
|
+
requirements:
|
134
96
|
- - ~>
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
hash: 49
|
137
|
-
segments:
|
138
|
-
- 0
|
139
|
-
- 8
|
140
|
-
- 7
|
97
|
+
- !ruby/object:Gem::Version
|
141
98
|
version: 0.8.7
|
142
99
|
type: :development
|
143
|
-
version_requirements: *id008
|
144
|
-
- !ruby/object:Gem::Dependency
|
145
|
-
name: rspec
|
146
100
|
prerelease: false
|
147
|
-
|
101
|
+
version_requirements: *2153568060
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: rspec
|
104
|
+
requirement: &2153567600 !ruby/object:Gem::Requirement
|
148
105
|
none: false
|
149
|
-
requirements:
|
106
|
+
requirements:
|
150
107
|
- - ~>
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
hash: 27
|
153
|
-
segments:
|
154
|
-
- 2
|
155
|
-
- 5
|
156
|
-
- 0
|
108
|
+
- !ruby/object:Gem::Version
|
157
109
|
version: 2.5.0
|
158
110
|
type: :development
|
159
|
-
version_requirements: *id009
|
160
|
-
- !ruby/object:Gem::Dependency
|
161
|
-
name: mocha
|
162
111
|
prerelease: false
|
163
|
-
|
112
|
+
version_requirements: *2153567600
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: mocha
|
115
|
+
requirement: &2153583300 !ruby/object:Gem::Requirement
|
164
116
|
none: false
|
165
|
-
requirements:
|
117
|
+
requirements:
|
166
118
|
- - ~>
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
hash: 43
|
169
|
-
segments:
|
170
|
-
- 0
|
171
|
-
- 9
|
172
|
-
- 8
|
119
|
+
- !ruby/object:Gem::Version
|
173
120
|
version: 0.9.8
|
174
121
|
type: :development
|
175
|
-
version_requirements: *id010
|
176
|
-
- !ruby/object:Gem::Dependency
|
177
|
-
name: timecop
|
178
122
|
prerelease: false
|
179
|
-
|
123
|
+
version_requirements: *2153583300
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: timecop
|
126
|
+
requirement: &2153582600 !ruby/object:Gem::Requirement
|
180
127
|
none: false
|
181
|
-
requirements:
|
128
|
+
requirements:
|
182
129
|
- - ~>
|
183
|
-
- !ruby/object:Gem::Version
|
184
|
-
hash: 25
|
185
|
-
segments:
|
186
|
-
- 0
|
187
|
-
- 3
|
188
|
-
- 5
|
130
|
+
- !ruby/object:Gem::Version
|
189
131
|
version: 0.3.5
|
190
132
|
type: :development
|
191
|
-
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *2153582600
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: autotest
|
137
|
+
requirement: &2153582140 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *2153582140
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: ZenTest
|
148
|
+
requirement: &2153581320 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - =
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: 4.5.0
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: *2153581320
|
192
157
|
description: Ruby's heavy metal SOAP client
|
193
158
|
email: me@rubiii.com
|
194
159
|
executables: []
|
195
|
-
|
196
160
|
extensions: []
|
197
|
-
|
198
161
|
extra_rdoc_files: []
|
199
|
-
|
200
|
-
files:
|
162
|
+
files:
|
201
163
|
- .gitignore
|
202
164
|
- .rspec
|
203
165
|
- .travis.yml
|
@@ -209,13 +171,17 @@ files:
|
|
209
171
|
- Rakefile
|
210
172
|
- lib/savon.rb
|
211
173
|
- lib/savon/client.rb
|
174
|
+
- lib/savon/config.rb
|
212
175
|
- lib/savon/core_ext/object.rb
|
213
176
|
- lib/savon/core_ext/string.rb
|
214
177
|
- lib/savon/error.rb
|
215
|
-
- lib/savon/
|
178
|
+
- lib/savon/hooks/group.rb
|
179
|
+
- lib/savon/hooks/hook.rb
|
216
180
|
- lib/savon/http/error.rb
|
181
|
+
- lib/savon/model.rb
|
217
182
|
- lib/savon/soap.rb
|
218
183
|
- lib/savon/soap/fault.rb
|
184
|
+
- lib/savon/soap/invalid_response_error.rb
|
219
185
|
- lib/savon/soap/request.rb
|
220
186
|
- lib/savon/soap/response.rb
|
221
187
|
- lib/savon/soap/xml.rb
|
@@ -240,6 +206,7 @@ files:
|
|
240
206
|
- spec/savon/core_ext/object_spec.rb
|
241
207
|
- spec/savon/core_ext/string_spec.rb
|
242
208
|
- spec/savon/http/error_spec.rb
|
209
|
+
- spec/savon/model_spec.rb
|
243
210
|
- spec/savon/savon_spec.rb
|
244
211
|
- spec/savon/soap/fault_spec.rb
|
245
212
|
- spec/savon/soap/request_spec.rb
|
@@ -252,36 +219,32 @@ files:
|
|
252
219
|
- spec/support/fixture.rb
|
253
220
|
homepage: http://savonrb.com
|
254
221
|
licenses: []
|
255
|
-
|
256
222
|
post_install_message:
|
257
223
|
rdoc_options: []
|
258
|
-
|
259
|
-
require_paths:
|
224
|
+
require_paths:
|
260
225
|
- lib
|
261
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
226
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
262
227
|
none: false
|
263
|
-
requirements:
|
264
|
-
- -
|
265
|
-
- !ruby/object:Gem::Version
|
266
|
-
|
267
|
-
segments:
|
228
|
+
requirements:
|
229
|
+
- - ! '>='
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
version: '0'
|
232
|
+
segments:
|
268
233
|
- 0
|
269
|
-
|
270
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
|
+
hash: 391962510590924120
|
235
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
236
|
none: false
|
272
|
-
requirements:
|
273
|
-
- -
|
274
|
-
- !ruby/object:Gem::Version
|
275
|
-
|
276
|
-
segments:
|
237
|
+
requirements:
|
238
|
+
- - ! '>='
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
version: '0'
|
241
|
+
segments:
|
277
242
|
- 0
|
278
|
-
|
243
|
+
hash: 391962510590924120
|
279
244
|
requirements: []
|
280
|
-
|
281
245
|
rubyforge_project: savon
|
282
|
-
rubygems_version: 1.8.
|
246
|
+
rubygems_version: 1.8.10
|
283
247
|
signing_key:
|
284
248
|
specification_version: 3
|
285
249
|
summary: Heavy metal Ruby SOAP client
|
286
250
|
test_files: []
|
287
|
-
|