savon 2.13.1 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -1
  3. data/lib/savon/builder.rb +4 -3
  4. data/lib/savon/model.rb +3 -3
  5. data/lib/savon/options.rb +1 -1
  6. data/lib/savon/response.rb +3 -3
  7. data/lib/savon/string_utils.rb +17 -0
  8. data/lib/savon/version.rb +1 -1
  9. data/lib/savon.rb +1 -0
  10. metadata +35 -81
  11. data/.gitignore +0 -16
  12. data/.yardopts +0 -6
  13. data/CONTRIBUTING.md +0 -42
  14. data/Gemfile +0 -8
  15. data/RELEASING.md +0 -10
  16. data/lib/savon/core_ext/string.rb +0 -30
  17. data/savon.gemspec +0 -47
  18. data/spec/fixtures/gzip/message.gz +0 -0
  19. data/spec/fixtures/response/another_soap_fault.xml +0 -14
  20. data/spec/fixtures/response/authentication.xml +0 -14
  21. data/spec/fixtures/response/empty_soap_fault.xml +0 -13
  22. data/spec/fixtures/response/f5.xml +0 -39
  23. data/spec/fixtures/response/header.xml +0 -13
  24. data/spec/fixtures/response/list.xml +0 -18
  25. data/spec/fixtures/response/multi_ref.xml +0 -39
  26. data/spec/fixtures/response/no_body.xml +0 -1
  27. data/spec/fixtures/response/soap_fault.xml +0 -8
  28. data/spec/fixtures/response/soap_fault12.xml +0 -18
  29. data/spec/fixtures/response/soap_fault_funky.xml +0 -8
  30. data/spec/fixtures/response/taxcloud.xml +0 -1
  31. data/spec/fixtures/ssl/client_cert.pem +0 -16
  32. data/spec/fixtures/ssl/client_encrypted_key.pem +0 -30
  33. data/spec/fixtures/ssl/client_encrypted_key_cert.pem +0 -24
  34. data/spec/fixtures/ssl/client_key.pem +0 -15
  35. data/spec/fixtures/wsdl/authentication.xml +0 -63
  36. data/spec/fixtures/wsdl/betfair.xml +0 -2981
  37. data/spec/fixtures/wsdl/brand.xml +0 -624
  38. data/spec/fixtures/wsdl/edialog.xml +0 -15416
  39. data/spec/fixtures/wsdl/elements_in_types.xml +0 -43
  40. data/spec/fixtures/wsdl/interhome.xml +0 -2137
  41. data/spec/fixtures/wsdl/lower_camel.xml +0 -52
  42. data/spec/fixtures/wsdl/multiple_namespaces.xml +0 -92
  43. data/spec/fixtures/wsdl/multiple_types.xml +0 -60
  44. data/spec/fixtures/wsdl/no_message_tag.xml +0 -1267
  45. data/spec/fixtures/wsdl/taxcloud.xml +0 -934
  46. data/spec/fixtures/wsdl/team_software.xml +0 -1
  47. data/spec/fixtures/wsdl/vies.xml +0 -176
  48. data/spec/fixtures/wsdl/wasmuth.xml +0 -153
  49. data/spec/integration/support/application.rb +0 -114
  50. data/spec/integration/support/server.rb +0 -85
  51. data/spec/integration/zipcode_example_spec.rb +0 -39
  52. data/spec/savon/builder_spec.rb +0 -138
  53. data/spec/savon/client_spec.rb +0 -272
  54. data/spec/savon/core_ext/string_spec.rb +0 -38
  55. data/spec/savon/features/message_tag_spec.rb +0 -62
  56. data/spec/savon/http_error_spec.rb +0 -57
  57. data/spec/savon/log_message_spec.rb +0 -51
  58. data/spec/savon/message_spec.rb +0 -61
  59. data/spec/savon/mock_spec.rb +0 -175
  60. data/spec/savon/model_spec.rb +0 -183
  61. data/spec/savon/multipart_request_spec.rb +0 -46
  62. data/spec/savon/observers_spec.rb +0 -93
  63. data/spec/savon/operation_spec.rb +0 -207
  64. data/spec/savon/options_spec.rb +0 -1154
  65. data/spec/savon/qualified_message_spec.rb +0 -102
  66. data/spec/savon/request_logger_spec.rb +0 -38
  67. data/spec/savon/request_spec.rb +0 -581
  68. data/spec/savon/response_spec.rb +0 -276
  69. data/spec/savon/soap_fault_spec.rb +0 -147
  70. data/spec/savon/softlayer_spec.rb +0 -42
  71. data/spec/spec_helper.rb +0 -31
  72. data/spec/support/adapters.rb +0 -49
  73. data/spec/support/endpoint.rb +0 -26
  74. data/spec/support/fixture.rb +0 -40
  75. data/spec/support/integration.rb +0 -10
  76. data/spec/support/stdout.rb +0 -26
@@ -1,581 +0,0 @@
1
- # frozen_string_literal: true
2
- require "spec_helper"
3
- require "integration/support/server"
4
-
5
- RSpec.describe Savon::WSDLRequest do
6
-
7
- let(:globals) { Savon::GlobalOptions.new }
8
- let(:http_request) { HTTPI::Request.new }
9
- let(:ciphers) { OpenSSL::Cipher.ciphers }
10
-
11
- def new_wsdl_request
12
- Savon::WSDLRequest.new(globals, http_request)
13
- end
14
-
15
- describe "#build" do
16
- it "returns an HTTPI::Request" do
17
- wsdl_request = Savon::WSDLRequest.new(globals)
18
- expect(wsdl_request.build).to be_an(HTTPI::Request)
19
- end
20
-
21
- describe "headers" do
22
- it "are set when specified" do
23
- globals.headers("Proxy-Authorization" => "Basic auth")
24
- configured_http_request = new_wsdl_request.build
25
-
26
- expect(configured_http_request.headers["Proxy-Authorization"]).to eq("Basic auth")
27
- end
28
-
29
- it "are not set otherwise" do
30
- configured_http_request = new_wsdl_request.build
31
- expect(configured_http_request.headers).to_not include("Proxy-Authorization")
32
- end
33
- end
34
-
35
- describe "proxy" do
36
- it "is set when specified" do
37
- globals.proxy("http://proxy.example.com")
38
- http_request.expects(:proxy=).with("http://proxy.example.com")
39
-
40
- new_wsdl_request.build
41
- end
42
-
43
- it "is not set otherwise" do
44
- http_request.expects(:proxy=).never
45
- new_wsdl_request.build
46
- end
47
- end
48
-
49
- describe "open timeout" do
50
- it "is set when specified" do
51
- globals.open_timeout(22)
52
- http_request.expects(:open_timeout=).with(22)
53
-
54
- new_wsdl_request.build
55
- end
56
-
57
- it "is not set otherwise" do
58
- http_request.expects(:open_timeout=).never
59
- new_wsdl_request.build
60
- end
61
- end
62
-
63
- describe "read timeout" do
64
- it "is set when specified" do
65
- globals.read_timeout(33)
66
- http_request.expects(:read_timeout=).with(33)
67
-
68
- new_wsdl_request.build
69
- end
70
-
71
- it "is not set otherwise" do
72
- http_request.expects(:read_timeout=).never
73
- new_wsdl_request.build
74
- end
75
- end
76
-
77
- describe "write timeout" do
78
- it "is set when specified" do
79
- globals.write_timeout(44)
80
- http_request.expects(:write_timeout=).with(44)
81
-
82
- new_wsdl_request.build
83
- end
84
-
85
- it "is not set otherwise" do
86
- http_request.expects(:read_timeout=).never
87
- new_wsdl_request.build
88
- end
89
- end
90
-
91
- describe "ssl version" do
92
- it "is set when specified" do
93
- globals.ssl_version(:TLSv1)
94
- http_request.auth.ssl.expects(:ssl_version=).with(:TLSv1)
95
-
96
- new_wsdl_request.build
97
- end
98
-
99
- it "is not set otherwise" do
100
- http_request.auth.ssl.expects(:ssl_version=).never
101
- new_wsdl_request.build
102
- end
103
- end
104
-
105
- describe "ssl min_version" do
106
- it "is set when specified" do
107
- globals.ssl_min_version(:TLS1_2)
108
- http_request.auth.ssl.expects(:min_version=).with(:TLS1_2)
109
-
110
- new_wsdl_request.build
111
- end
112
-
113
- it "is not set otherwise" do
114
- http_request.auth.ssl.expects(:min_version=).never
115
- new_wsdl_request.build
116
- end
117
- end
118
-
119
- describe "ssl max_version" do
120
- it "is set when specified" do
121
- globals.ssl_max_version(:TLS1_2)
122
- http_request.auth.ssl.expects(:max_version=).with(:TLS1_2)
123
-
124
- new_wsdl_request.build
125
- end
126
-
127
- it "is not set otherwise" do
128
- http_request.auth.ssl.expects(:max_version=).never
129
- new_wsdl_request.build
130
- end
131
- end
132
-
133
- describe "ssl verify mode" do
134
- it "is set when specified" do
135
- globals.ssl_verify_mode(:peer)
136
- http_request.auth.ssl.expects(:verify_mode=).with(:peer)
137
-
138
- new_wsdl_request.build
139
- end
140
-
141
- it "is not set otherwise" do
142
- http_request.auth.ssl.expects(:verify_mode=).never
143
- new_wsdl_request.build
144
- end
145
- end
146
-
147
- describe "ssl ciphers" do
148
- it "is set when specified" do
149
- globals.ssl_ciphers(ciphers)
150
- http_request.auth.ssl.expects(:ciphers=).with(ciphers)
151
-
152
- new_wsdl_request.build
153
- end
154
-
155
- it "is not set otherwise" do
156
- http_request.auth.ssl.expects(:ciphers=).never
157
- new_wsdl_request.build
158
- end
159
- end
160
-
161
- describe "ssl cert key file" do
162
- it "is set when specified" do
163
- cert_key = File.expand_path("../../fixtures/ssl/client_key.pem", __FILE__)
164
- globals.ssl_cert_key_file(cert_key)
165
- http_request.auth.ssl.expects(:cert_key_file=).with(cert_key)
166
-
167
- new_wsdl_request.build
168
- end
169
-
170
- it "is not set otherwise" do
171
- http_request.auth.ssl.expects(:cert_key_file=).never
172
- new_wsdl_request.build
173
- end
174
- end
175
-
176
- describe "ssl cert key password" do
177
- it "is set when specified" do
178
- the_pass = "secure-password!42"
179
- globals.ssl_cert_key_password(the_pass)
180
- http_request.auth.ssl.expects(:cert_key_password=).with(the_pass)
181
-
182
- new_wsdl_request.build
183
- end
184
-
185
- it "is not set otherwise" do
186
- http_request.auth.ssl.expects(:cert_key_password=).never
187
- new_wsdl_request.build
188
- end
189
- end
190
-
191
- describe "ssl encrypted cert key file" do
192
- describe "set with an invalid decrypting password" do
193
- it "fails when attempting to use the SSL private key" do
194
- skip("JRuby: find out why this does not raise an error!") if RUBY_PLATFORM == 'java'
195
- pass = "wrong-password"
196
- key = File.expand_path("../../fixtures/ssl/client_encrypted_key.pem", __FILE__)
197
- cert = File.expand_path("../../fixtures/ssl/client_encrypted_key_cert.pem", __FILE__)
198
-
199
- globals.ssl_cert_file(cert)
200
- globals.ssl_cert_key_password(pass)
201
- globals.ssl_cert_key_file(key)
202
-
203
- new_wsdl_request.build
204
-
205
- expect { http_request.auth.ssl.cert_key }.to raise_error OpenSSL::PKey::PKeyError
206
- end
207
- end
208
-
209
- describe "set with a valid decrypting password" do
210
- it "handles SSL private keys properly" do
211
- pass = "secure-password!42"
212
- key = File.expand_path("../../fixtures/ssl/client_encrypted_key.pem", __FILE__)
213
- cert = File.expand_path("../../fixtures/ssl/client_encrypted_key_cert.pem", __FILE__)
214
-
215
- globals.ssl_cert_file(cert)
216
- globals.ssl_cert_key_password(pass)
217
- globals.ssl_cert_key_file(key)
218
-
219
- new_wsdl_request.build
220
-
221
- expect(http_request.auth.ssl.cert_key.to_s).to match(/BEGIN RSA PRIVATE KEY/)
222
- end
223
- end
224
- end
225
-
226
- describe "ssl cert file" do
227
- it "is set when specified" do
228
- cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
229
- globals.ssl_cert_file(cert)
230
- http_request.auth.ssl.expects(:cert_file=).with(cert)
231
-
232
- new_wsdl_request.build
233
- end
234
-
235
- it "is not set otherwise" do
236
- http_request.auth.ssl.expects(:cert_file=).never
237
- new_wsdl_request.build
238
- end
239
- end
240
-
241
- describe "ssl ca cert file" do
242
- it "is set when specified" do
243
- ca_cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
244
- globals.ssl_ca_cert_file(ca_cert)
245
- http_request.auth.ssl.expects(:ca_cert_file=).with(ca_cert)
246
-
247
- new_wsdl_request.build
248
- end
249
-
250
- it "is not set otherwise" do
251
- http_request.auth.ssl.expects(:ca_cert_file=).never
252
- new_wsdl_request.build
253
- end
254
- end
255
-
256
- describe "basic auth" do
257
- it "is set when specified" do
258
- globals.basic_auth("luke", "secret")
259
- http_request.auth.expects(:basic).with("luke", "secret")
260
-
261
- new_wsdl_request.build
262
- end
263
-
264
- it "is not set otherwise" do
265
- http_request.auth.expects(:basic).never
266
- new_wsdl_request.build
267
- end
268
- end
269
-
270
- describe "digest auth" do
271
- it "is set when specified" do
272
- globals.digest_auth("lea", "top-secret")
273
- http_request.auth.expects(:digest).with("lea", "top-secret")
274
-
275
- new_wsdl_request.build
276
- end
277
-
278
- it "is not set otherwise" do
279
- http_request.auth.expects(:digest).never
280
- new_wsdl_request.build
281
- end
282
- end
283
-
284
- describe "ntlm auth" do
285
- it "is set when specified" do
286
- globals.ntlm("han", "super-secret")
287
- http_request.auth.expects(:ntlm).with("han", "super-secret")
288
-
289
- new_wsdl_request.build
290
- end
291
-
292
- it "is not set otherwise" do
293
- http_request.auth.expects(:ntlm).never
294
- new_wsdl_request.build
295
- end
296
- end
297
- end
298
-
299
- end
300
-
301
- RSpec.describe Savon::SOAPRequest do
302
-
303
- let(:globals) { Savon::GlobalOptions.new }
304
- let(:http_request) { HTTPI::Request.new }
305
- let(:ciphers) { OpenSSL::Cipher.ciphers }
306
-
307
- def new_soap_request
308
- Savon::SOAPRequest.new(globals, http_request)
309
- end
310
-
311
- describe "#build" do
312
- it "returns an HTTPI::Request" do
313
- soap_request = Savon::SOAPRequest.new(globals)
314
- expect(soap_request.build).to be_an(HTTPI::Request)
315
- end
316
-
317
- describe "proxy" do
318
- it "is set when specified" do
319
- globals.proxy("http://proxy.example.com")
320
- http_request.expects(:proxy=).with("http://proxy.example.com")
321
-
322
- new_soap_request.build
323
- end
324
-
325
- it "is not set otherwise" do
326
- http_request.expects(:proxy=).never
327
- new_soap_request.build
328
- end
329
- end
330
-
331
- describe "cookies" do
332
- it "sets the given cookies" do
333
- cookies = [HTTPI::Cookie.new("some-cookie=choc-chip; Path=/; HttpOnly")]
334
-
335
- http_request.expects(:set_cookies).with(cookies)
336
- new_soap_request.build(:cookies => cookies)
337
- end
338
-
339
- it "does not set the cookies if there are none" do
340
- http_request.expects(:set_cookies).never
341
- new_soap_request.build
342
- end
343
- end
344
-
345
- describe "open timeout" do
346
- it "is set when specified" do
347
- globals.open_timeout(22)
348
- http_request.expects(:open_timeout=).with(22)
349
-
350
- new_soap_request.build
351
- end
352
-
353
- it "is not set otherwise" do
354
- http_request.expects(:open_timeout=).never
355
- new_soap_request.build
356
- end
357
- end
358
-
359
- describe "read timeout" do
360
- it "is set when specified" do
361
- globals.read_timeout(33)
362
- http_request.expects(:read_timeout=).with(33)
363
-
364
- new_soap_request.build
365
- end
366
-
367
- it "is not set otherwise" do
368
- http_request.expects(:read_timeout=).never
369
- new_soap_request.build
370
- end
371
- end
372
-
373
- describe "headers" do
374
- it "are set when specified" do
375
- globals.headers("X-Token" => "secret")
376
- configured_http_request = new_soap_request.build
377
-
378
- expect(configured_http_request.headers["X-Token"]).to eq("secret")
379
- end
380
-
381
- it "are not set otherwise" do
382
- configured_http_request = new_soap_request.build
383
- expect(configured_http_request.headers).to_not include("X-Token")
384
- end
385
- end
386
-
387
- describe "SOAPAction header" do
388
- it "is set and wrapped in parenthesis" do
389
- configured_http_request = new_soap_request.build(:soap_action => "findUser")
390
- soap_action = configured_http_request.headers["SOAPAction"]
391
-
392
- expect(soap_action).to eq(%("findUser"))
393
- end
394
-
395
- it "is not set when it's explicitely set to nil" do
396
- configured_http_request = new_soap_request.build(:soap_action => nil)
397
- expect(configured_http_request.headers).to_not include("SOAPAction")
398
- end
399
-
400
- it "is not set when there is already a SOAPAction value" do
401
- globals.headers("SOAPAction" => %("authenticate"))
402
- configured_http_request = new_soap_request.build(:soap_action => "findUser")
403
- soap_action = configured_http_request.headers["SOAPAction"]
404
-
405
- expect(soap_action).to eq(%("authenticate"))
406
- end
407
- end
408
-
409
- describe "Content-Type header" do
410
- it "defaults to SOAP 1.1 and UTF-8" do
411
- configured_http_request = new_soap_request.build
412
- content_type = configured_http_request.headers["Content-Type"]
413
-
414
- expect(content_type).to eq("text/xml;charset=UTF-8")
415
- end
416
-
417
- it "can be changed to SOAP 1.2 and any other encoding" do
418
- globals.soap_version(2)
419
- globals.encoding("ISO-8859-1")
420
-
421
- configured_http_request = new_soap_request.build
422
- content_type = configured_http_request.headers["Content-Type"]
423
-
424
- expect(content_type).to eq("application/soap+xml;charset=ISO-8859-1")
425
- end
426
-
427
- it "is not set when there is already a Content-Type value" do
428
- globals.headers("Content-Type" => "application/awesomeness;charset=UTF-3000")
429
- configured_http_request = new_soap_request.build(:soap_action => "findUser")
430
- content_type = configured_http_request.headers["Content-Type"]
431
-
432
- expect(content_type).to eq("application/awesomeness;charset=UTF-3000")
433
- end
434
- end
435
-
436
- describe "ssl version" do
437
- it "is set when specified" do
438
- globals.ssl_version(:TLSv1)
439
- http_request.auth.ssl.expects(:ssl_version=).with(:TLSv1)
440
-
441
- new_soap_request.build
442
- end
443
-
444
- it "is not set otherwise" do
445
- http_request.auth.ssl.expects(:ssl_version=).never
446
- new_soap_request.build
447
- end
448
- end
449
-
450
- describe "ssl verify mode" do
451
- it "is set when specified" do
452
- globals.ssl_verify_mode(:peer)
453
- http_request.auth.ssl.expects(:verify_mode=).with(:peer)
454
-
455
- new_soap_request.build
456
- end
457
-
458
- it "is not set otherwise" do
459
- http_request.auth.ssl.expects(:verify_mode=).never
460
- new_soap_request.build
461
- end
462
- end
463
-
464
- describe "ssl ciphers" do
465
- it "is set when specified" do
466
- globals.ssl_ciphers(ciphers)
467
- http_request.auth.ssl.expects(:ciphers=).with(ciphers)
468
-
469
- new_soap_request.build
470
- end
471
-
472
- it "is not set otherwise" do
473
- http_request.auth.ssl.expects(:ciphers=).never
474
- new_soap_request.build
475
- end
476
- end
477
-
478
- describe "ssl cert key file" do
479
- it "is set when specified" do
480
- cert_key = File.expand_path("../../fixtures/ssl/client_key.pem", __FILE__)
481
- globals.ssl_cert_key_file(cert_key)
482
- http_request.auth.ssl.expects(:cert_key_file=).with(cert_key)
483
-
484
- new_soap_request.build
485
- end
486
-
487
- it "is not set otherwise" do
488
- http_request.auth.ssl.expects(:cert_key_file=).never
489
- new_soap_request.build
490
- end
491
- end
492
-
493
- describe "ssl cert key password" do
494
- it "is set when specified" do
495
- the_pass = "secure-password!42"
496
- globals.ssl_cert_key_password(the_pass)
497
- http_request.auth.ssl.expects(:cert_key_password=).with(the_pass)
498
-
499
- new_soap_request.build
500
- end
501
-
502
- it "is not set otherwise" do
503
- http_request.auth.ssl.expects(:cert_key_password=).never
504
- new_soap_request.build
505
- end
506
- end
507
-
508
- describe "ssl cert file" do
509
- it "is set when specified" do
510
- cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
511
- globals.ssl_cert_file(cert)
512
- http_request.auth.ssl.expects(:cert_file=).with(cert)
513
-
514
- new_soap_request.build
515
- end
516
-
517
- it "is not set otherwise" do
518
- http_request.auth.ssl.expects(:cert_file=).never
519
- new_soap_request.build
520
- end
521
- end
522
-
523
- describe "ssl ca cert file" do
524
- it "is set when specified" do
525
- ca_cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
526
- globals.ssl_ca_cert_file(ca_cert)
527
- http_request.auth.ssl.expects(:ca_cert_file=).with(ca_cert)
528
-
529
- new_soap_request.build
530
- end
531
-
532
- it "is not set otherwise" do
533
- http_request.auth.ssl.expects(:ca_cert_file=).never
534
- new_soap_request.build
535
- end
536
- end
537
-
538
- describe "basic auth" do
539
- it "is set when specified" do
540
- globals.basic_auth("luke", "secret")
541
- http_request.auth.expects(:basic).with("luke", "secret")
542
-
543
- new_soap_request.build
544
- end
545
-
546
- it "is not set otherwise" do
547
- http_request.auth.expects(:basic).never
548
- new_soap_request.build
549
- end
550
- end
551
-
552
- describe "digest auth" do
553
- it "is set when specified" do
554
- globals.digest_auth("lea", "top-secret")
555
- http_request.auth.expects(:digest).with("lea", "top-secret")
556
-
557
- new_soap_request.build
558
- end
559
-
560
- it "is not set otherwise" do
561
- http_request.auth.expects(:digest).never
562
- new_soap_request.build
563
- end
564
- end
565
-
566
- describe "ntlm auth" do
567
- it "is set when specified" do
568
- globals.ntlm("han", "super-secret")
569
- http_request.auth.expects(:ntlm).with("han", "super-secret")
570
-
571
- new_soap_request.build
572
- end
573
-
574
- it "is not set otherwise" do
575
- http_request.auth.expects(:ntlm).never
576
- new_soap_request.build
577
- end
578
- end
579
- end
580
-
581
- end