savon 2.12.1 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/CHANGELOG.md +87 -73
  4. data/CONTRIBUTING.md +15 -19
  5. data/Gemfile +2 -7
  6. data/README.md +14 -16
  7. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
  8. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
  9. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
  10. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
  11. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
  12. data/coverage/assets/0.12.3/application.css +1 -0
  13. data/coverage/assets/0.12.3/application.js +7 -0
  14. data/coverage/assets/0.12.3/colorbox/border.png +0 -0
  15. data/coverage/assets/0.12.3/colorbox/controls.png +0 -0
  16. data/coverage/assets/0.12.3/colorbox/loading.gif +0 -0
  17. data/coverage/assets/0.12.3/colorbox/loading_background.png +0 -0
  18. data/coverage/assets/0.12.3/favicon_green.png +0 -0
  19. data/coverage/assets/0.12.3/favicon_red.png +0 -0
  20. data/coverage/assets/0.12.3/favicon_yellow.png +0 -0
  21. data/coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  22. data/coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  23. data/coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  24. data/coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  25. data/coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  26. data/coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  27. data/coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  28. data/coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  29. data/coverage/assets/0.12.3/images/ui-icons_222222_256x240.png +0 -0
  30. data/coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png +0 -0
  31. data/coverage/assets/0.12.3/images/ui-icons_454545_256x240.png +0 -0
  32. data/coverage/assets/0.12.3/images/ui-icons_888888_256x240.png +0 -0
  33. data/coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png +0 -0
  34. data/coverage/assets/0.12.3/loading.gif +0 -0
  35. data/coverage/assets/0.12.3/magnify.png +0 -0
  36. data/coverage/index.html +21518 -0
  37. data/lib/savon/block_interface.rb +1 -0
  38. data/lib/savon/builder.rb +95 -29
  39. data/lib/savon/client.rb +1 -0
  40. data/lib/savon/core_ext/string.rb +1 -0
  41. data/lib/savon/header.rb +2 -6
  42. data/lib/savon/http_error.rb +4 -4
  43. data/lib/savon/log_message.rb +1 -0
  44. data/lib/savon/message.rb +1 -0
  45. data/lib/savon/mock/expectation.rb +1 -0
  46. data/lib/savon/mock/spec_helper.rb +1 -0
  47. data/lib/savon/mock.rb +1 -0
  48. data/lib/savon/model.rb +1 -0
  49. data/lib/savon/operation.rb +20 -18
  50. data/lib/savon/options.rb +56 -0
  51. data/lib/savon/qualified_message.rb +3 -2
  52. data/lib/savon/request.rb +5 -0
  53. data/lib/savon/request_logger.rb +8 -2
  54. data/lib/savon/response.rb +48 -1
  55. data/lib/savon/soap_fault.rb +1 -0
  56. data/lib/savon/version.rb +2 -1
  57. data/lib/savon.rb +1 -0
  58. data/savon.gemspec +9 -8
  59. data/spec/integration/support/application.rb +33 -1
  60. data/spec/integration/support/server.rb +1 -0
  61. data/spec/integration/zipcode_example_spec.rb +5 -8
  62. data/spec/savon/builder_spec.rb +2 -1
  63. data/spec/savon/client_spec.rb +5 -4
  64. data/spec/savon/core_ext/string_spec.rb +2 -1
  65. data/spec/savon/features/message_tag_spec.rb +2 -1
  66. data/spec/savon/http_error_spec.rb +9 -1
  67. data/spec/savon/log_message_spec.rb +2 -1
  68. data/spec/savon/message_spec.rb +2 -11
  69. data/spec/savon/mock_spec.rb +2 -1
  70. data/spec/savon/model_spec.rb +2 -1
  71. data/spec/savon/multipart_request_spec.rb +46 -0
  72. data/spec/savon/observers_spec.rb +2 -1
  73. data/spec/savon/operation_spec.rb +20 -43
  74. data/spec/savon/options_spec.rb +40 -1
  75. data/spec/savon/qualified_message_spec.rb +2 -1
  76. data/spec/savon/request_logger_spec.rb +2 -1
  77. data/spec/savon/request_spec.rb +47 -6
  78. data/spec/savon/response_spec.rb +2 -1
  79. data/spec/savon/soap_fault_spec.rb +2 -1
  80. data/spec/savon/softlayer_spec.rb +3 -2
  81. data/spec/spec_helper.rb +5 -4
  82. data/spec/support/adapters.rb +1 -0
  83. data/spec/support/endpoint.rb +1 -0
  84. data/spec/support/fixture.rb +1 -0
  85. data/spec/support/integration.rb +1 -0
  86. data/spec/support/stdout.rb +1 -0
  87. metadata +81 -30
  88. data/.travis.yml +0 -26
  89. data/donate.png +0 -0
  90. data/spec/integration/centra_spec.rb +0 -67
  91. data/spec/integration/email_example_spec.rb +0 -32
  92. data/spec/integration/random_quote_spec.rb +0 -23
  93. data/spec/integration/ratp_example_spec.rb +0 -28
  94. data/spec/integration/stockquote_example_spec.rb +0 -34
  95. data/spec/integration/temperature_example_spec.rb +0 -46
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module SpecSupport
2
3
 
3
4
  def mock_stdout
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: savon
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.1
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Harrington
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-05 00:00:00.000000000 Z
11
+ date: 2022-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nori
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: httpi
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.3'
33
+ version: 2.4.5
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.3'
40
+ version: 2.4.5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: wasabi
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.8.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: mail
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.5'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.5'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rack
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -126,44 +140,58 @@ dependencies:
126
140
  name: puma
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - "~>"
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: '3.0'
145
+ version: 4.3.8
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - "~>"
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 4.3.8
153
+ - !ruby/object:Gem::Dependency
154
+ name: byebug
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
137
165
  - !ruby/object:Gem::Version
138
- version: '3.0'
166
+ version: '0'
139
167
  - !ruby/object:Gem::Dependency
140
168
  name: rake
141
169
  requirement: !ruby/object:Gem::Requirement
142
170
  requirements:
143
- - - "~>"
171
+ - - ">="
144
172
  - !ruby/object:Gem::Version
145
- version: '10.1'
173
+ version: 12.3.3
146
174
  type: :development
147
175
  prerelease: false
148
176
  version_requirements: !ruby/object:Gem::Requirement
149
177
  requirements:
150
- - - "~>"
178
+ - - ">="
151
179
  - !ruby/object:Gem::Version
152
- version: '10.1'
180
+ version: 12.3.3
153
181
  - !ruby/object:Gem::Dependency
154
182
  name: rspec
155
183
  requirement: !ruby/object:Gem::Requirement
156
184
  requirements:
157
185
  - - "~>"
158
186
  - !ruby/object:Gem::Version
159
- version: '2.14'
187
+ version: '3.9'
160
188
  type: :development
161
189
  prerelease: false
162
190
  version_requirements: !ruby/object:Gem::Requirement
163
191
  requirements:
164
192
  - - "~>"
165
193
  - !ruby/object:Gem::Version
166
- version: '2.14'
194
+ version: '3.9'
167
195
  - !ruby/object:Gem::Dependency
168
196
  name: mocha
169
197
  requirement: !ruby/object:Gem::Requirement
@@ -182,16 +210,16 @@ dependencies:
182
210
  name: json
183
211
  requirement: !ruby/object:Gem::Requirement
184
212
  requirements:
185
- - - "~>"
213
+ - - ">="
186
214
  - !ruby/object:Gem::Version
187
- version: '1.7'
215
+ version: 2.3.0
188
216
  type: :development
189
217
  prerelease: false
190
218
  version_requirements: !ruby/object:Gem::Requirement
191
219
  requirements:
192
- - - "~>"
220
+ - - ">="
193
221
  - !ruby/object:Gem::Version
194
- version: '1.7'
222
+ version: 2.3.0
195
223
  description: Heavy metal SOAP client
196
224
  email: me@rubiii.com
197
225
  executables: []
@@ -199,7 +227,6 @@ extensions: []
199
227
  extra_rdoc_files: []
200
228
  files:
201
229
  - ".gitignore"
202
- - ".travis.yml"
203
230
  - ".yardopts"
204
231
  - CHANGELOG.md
205
232
  - CONTRIBUTING.md
@@ -207,7 +234,36 @@ files:
207
234
  - LICENSE
208
235
  - README.md
209
236
  - Rakefile
210
- - donate.png
237
+ - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png
238
+ - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png
239
+ - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png
240
+ - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png
241
+ - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png
242
+ - coverage/assets/0.12.3/application.css
243
+ - coverage/assets/0.12.3/application.js
244
+ - coverage/assets/0.12.3/colorbox/border.png
245
+ - coverage/assets/0.12.3/colorbox/controls.png
246
+ - coverage/assets/0.12.3/colorbox/loading.gif
247
+ - coverage/assets/0.12.3/colorbox/loading_background.png
248
+ - coverage/assets/0.12.3/favicon_green.png
249
+ - coverage/assets/0.12.3/favicon_red.png
250
+ - coverage/assets/0.12.3/favicon_yellow.png
251
+ - coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png
252
+ - coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png
253
+ - coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png
254
+ - coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png
255
+ - coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png
256
+ - coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png
257
+ - coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png
258
+ - coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png
259
+ - coverage/assets/0.12.3/images/ui-icons_222222_256x240.png
260
+ - coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png
261
+ - coverage/assets/0.12.3/images/ui-icons_454545_256x240.png
262
+ - coverage/assets/0.12.3/images/ui-icons_888888_256x240.png
263
+ - coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png
264
+ - coverage/assets/0.12.3/loading.gif
265
+ - coverage/assets/0.12.3/magnify.png
266
+ - coverage/index.html
211
267
  - lib/savon.rb
212
268
  - lib/savon/block_interface.rb
213
269
  - lib/savon/builder.rb
@@ -261,14 +317,8 @@ files:
261
317
  - spec/fixtures/wsdl/team_software.xml
262
318
  - spec/fixtures/wsdl/vies.xml
263
319
  - spec/fixtures/wsdl/wasmuth.xml
264
- - spec/integration/centra_spec.rb
265
- - spec/integration/email_example_spec.rb
266
- - spec/integration/random_quote_spec.rb
267
- - spec/integration/ratp_example_spec.rb
268
- - spec/integration/stockquote_example_spec.rb
269
320
  - spec/integration/support/application.rb
270
321
  - spec/integration/support/server.rb
271
- - spec/integration/temperature_example_spec.rb
272
322
  - spec/integration/zipcode_example_spec.rb
273
323
  - spec/savon/builder_spec.rb
274
324
  - spec/savon/client_spec.rb
@@ -279,6 +329,7 @@ files:
279
329
  - spec/savon/message_spec.rb
280
330
  - spec/savon/mock_spec.rb
281
331
  - spec/savon/model_spec.rb
332
+ - spec/savon/multipart_request_spec.rb
282
333
  - spec/savon/observers_spec.rb
283
334
  - spec/savon/operation_spec.rb
284
335
  - spec/savon/options_spec.rb
@@ -306,14 +357,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
306
357
  requirements:
307
358
  - - ">="
308
359
  - !ruby/object:Gem::Version
309
- version: 1.9.2
360
+ version: 2.5.0
310
361
  required_rubygems_version: !ruby/object:Gem::Requirement
311
362
  requirements:
312
363
  - - ">="
313
364
  - !ruby/object:Gem::Version
314
365
  version: '0'
315
366
  requirements: []
316
- rubygems_version: 3.0.1
367
+ rubygems_version: 3.2.9
317
368
  signing_key:
318
369
  specification_version: 4
319
370
  summary: Heavy metal SOAP client
data/.travis.yml DELETED
@@ -1,26 +0,0 @@
1
- # https://github.com/travis-ci/travis-ci/wiki/.travis.yml-options
2
- language: "ruby"
3
-
4
- script: "bundle exec rake --trace"
5
-
6
- rvm:
7
- - "2.5"
8
- - "2.6"
9
- - "2.7"
10
-
11
- matrix:
12
- include:
13
- - name: "JRuby 9.2"
14
- rvm: jruby-9.2.12.0
15
- jdk: openjdk11
16
- env: JAVA_OPTS="--add-opens java.base/java.security.cert=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED"
17
- - name: Rubinius
18
- rvm: rbx-4
19
- dist: trusty
20
- allow_failures:
21
- - name: Rubinius
22
- - name: "JRuby 9.2"
23
- fast_finish: true
24
-
25
- notifications:
26
- irc: "irc.freenode.org#savon"
data/donate.png DELETED
Binary file
@@ -1,67 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module LogInterceptor
4
- @@intercepted_request = ""
5
- def self.debug(message = nil)
6
- message ||= yield if block_given?
7
-
8
- # save only the first XMLly message
9
- if message.include? "xml version"
10
- @@intercepted_request = message if @@intercepted_request == ""
11
- end
12
- end
13
-
14
- def self.info(message = nil)
15
- end
16
-
17
- def self.get_intercepted_request
18
- @@intercepted_request
19
- end
20
-
21
- def self.reset_intercepted_request
22
- @@intercepted_request = ""
23
- end
24
- end
25
-
26
- describe 'Correct translation of attributes to XML' do
27
- it "new :@attr syntax: correctly maps a Ruby Hash to XML attributes" do
28
- LogInterceptor.reset_intercepted_request
29
-
30
- client = Savon.client(
31
- :wsdl => "http://mt205.sabameeting.com/CWS/CWS.asmx?WSDL",
32
- :log => true,
33
- :logger => LogInterceptor
34
- )
35
-
36
- response = nil
37
- begin
38
- response = call_and_fail_gracefully(client, :add_new_user, :message => { :user => { :@userID => "test" } })
39
- rescue
40
- end
41
-
42
- xml_doc = Nokogiri::XML(LogInterceptor.get_intercepted_request)
43
- xml_doc.remove_namespaces!
44
-
45
- attributes_element_not_present = xml_doc.xpath("//AddNewUser/attributes").blank?
46
- expect(attributes_element_not_present).to eq true
47
- end
48
-
49
- it "old :attributes! syntax: correctly maps a Ruby Hash to XML attributes" do
50
- LogInterceptor.reset_intercepted_request
51
-
52
- client = Savon.client(
53
- :wsdl => "http://mt205.sabameeting.com/CWS/CWS.asmx?WSDL",
54
- :log => true,
55
- :logger => LogInterceptor
56
- )
57
-
58
- response = nil
59
- response = call_and_fail_gracefully(client, :add_new_user, :message => { :user => {}, :attributes! => { :user => { :userID => "test" } } })
60
-
61
- xml_doc = Nokogiri::XML(LogInterceptor.get_intercepted_request)
62
- xml_doc.remove_namespaces!
63
-
64
- attributes_element_not_present = xml_doc.xpath("//AddNewUser/attributes").blank?
65
- expect(attributes_element_not_present).to eq true
66
- end
67
- end
@@ -1,32 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Email example" do
4
-
5
- it "passes Strings as they are" do
6
- client = Savon.client(
7
- # The WSDL document provided by the service.
8
- :wsdl => "http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx?wsdl",
9
-
10
- # Lower timeouts so these specs don't take forever when the service is not available.
11
- :open_timeout => 10,
12
- :read_timeout => 10,
13
-
14
- # Disable logging for cleaner spec output.
15
- :log => false
16
- )
17
-
18
- response = call_and_fail_gracefully(client, :verify_email, :message => { :email => "soap@example.com", "LicenseKey" => "?" })
19
-
20
- response_text = response.body[:verify_email_response][:verify_email_result][:response_text]
21
-
22
- if response_text == "Current license key only allows so many checks"
23
- # Fallback to not fail the specs when the service's API limit is reached,
24
- # but to mark the spec as pending instead.
25
- pending "API limit exceeded"
26
- else
27
- # The expected result. We unfortunately don't have a license key for this service.
28
- expect(response_text).to eq("Email Domain Not Found")
29
- end
30
- end
31
-
32
- end
@@ -1,23 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'rpc/encoded binding test' do
4
-
5
- it 'should should work with WSDLs that have rpc/encoded SOAP binding' do
6
- client = Savon.client(
7
- :wsdl => "http://www.boyzoid.com/comp/randomQuote.cfc?wsdl",
8
- :open_timeout => 10,
9
- :read_timeout => 10,
10
- :log => false
11
- )
12
-
13
- begin
14
- client.call(:get_quote)
15
- rescue Savon::SOAPFault => e
16
- $stderr.puts e.to_hash.inspect
17
- f_c = e.to_hash[:fault][:faultstring]
18
- expect(f_c).not_to eq('No such operation \'getQuoteRequest\'')
19
- expect(f_c).to eq('lucee.runtime.exp.DatabaseException: ')
20
- pending e
21
- end
22
- end
23
- end
@@ -1,28 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "RATP example" do
4
-
5
- it "retrieves information about a specific station" do
6
- client = Savon.client do
7
- # The WSDL document provided by the service.
8
- wsdl "http://www.ratp.fr/wsiv/services/Wsiv?wsdl"
9
-
10
- # Lower timeouts so these specs don't take forever when the service is not available.
11
- open_timeout 10
12
- read_timeout 10
13
-
14
- # Disable logging for cleaner spec output.
15
- log false
16
- end
17
-
18
- # XXX: the service seems to rely on the order of arguments.
19
- # try to fix this with the new wsdl parser.
20
- response = call_and_fail_gracefully(client, :get_stations) do
21
- message(:station => { :id => 1975 }, :limit => 1)
22
- end
23
-
24
- station_name = response.body[:get_stations_response][:return][:stations][:name]
25
- expect(station_name).to eq("Cite")
26
- end
27
-
28
- end
@@ -1,34 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Stockquote example" do
4
-
5
- it "returns the result in a CDATA tag" do
6
- client = Savon.client(
7
- # The WSDL document provided by the service.
8
- :wsdl => "http://www.webservicex.net/stockquote.asmx?WSDL",
9
-
10
- # Lower timeouts so these specs don't take forever when the service is not available.
11
- :open_timeout => 10,
12
- :read_timeout => 10,
13
-
14
- # Disable logging for cleaner spec output.
15
- :log => false
16
- )
17
-
18
- response = call_and_fail_gracefully(client, :get_quote, :message => { :symbol => "AAPL" })
19
-
20
- cdata = response.body[:get_quote_response][:get_quote_result]
21
-
22
- if cdata == "exception"
23
- # Fallback to not fail the specs when the service's API limit is reached,
24
- # but to mark the spec as pending instead.
25
- pending "Exception on API"
26
- end
27
-
28
- nori_options = { :convert_tags_to => lambda { |tag| tag.snakecase.to_sym } }
29
- result = Nori.new(nori_options).parse(cdata)
30
-
31
- expect(result[:stock_quotes][:stock][:symbol]).to eq("AAPL")
32
- end
33
-
34
- end
@@ -1,46 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Temperature example" do
4
-
5
- it "converts 30 degrees celsius to 86 degrees fahrenheit" do
6
- client = Savon.client do
7
- # The WSDL document provided by the service.
8
- wsdl "http://www.webservicex.net/ConvertTemperature.asmx?WSDL"
9
-
10
- # Needed because (up until now), Savon doesn't match XS types to Hash keys,
11
- # but defaults to convert Hash message Symbols (like :from_unit) to lowerCamelCase.
12
- # The service expects these to be CamelCase instead. Look at Savon's log output
13
- # and compare it with an example request generated by soapUI.
14
- convert_request_keys_to :camelcase
15
-
16
- # Lower timeouts so these specs don't take forever when the service is not available.
17
- open_timeout 10
18
- read_timeout 10
19
-
20
- # Disable logging for cleaner spec output.
21
- log false
22
- end
23
-
24
- response = call_and_fail_gracefully(client, :convert_temp) do
25
- # For the corrent values to pass for :from_unit and :to_unit, I searched the WSDL for
26
- # the "FromUnit" type which is a "TemperatureUnit" enumeration that looks like this:
27
- #
28
- # <s:simpleType name="TemperatureUnit">
29
- # <s:restriction base="s:string">
30
- # <s:enumeration value="degreeCelsius"/>
31
- # <s:enumeration value="degreeFahrenheit"/>
32
- # <s:enumeration value="degreeRankine"/>
33
- # <s:enumeration value="degreeReaumur"/>
34
- # <s:enumeration value="kelvin"/>
35
- # </s:restriction>
36
- # </s:simpleType>
37
- #
38
- # Support for XS schema types needs to be improved.
39
- message(:temperature => 30, :from_unit => "degreeCelsius", :to_unit => "degreeFahrenheit")
40
- end
41
-
42
- fahrenheit = response.body[:convert_temp_response][:convert_temp_result]
43
- expect(fahrenheit).to eq("86")
44
- end
45
-
46
- end