savon 2.11.1 → 2.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -3
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -6
- data/README.md +5 -5
- data/lib/savon/builder.rb +32 -6
- data/lib/savon/client.rb +1 -2
- data/lib/savon/log_message.rb +1 -1
- data/lib/savon/operation.rb +2 -1
- data/lib/savon/options.rb +28 -18
- data/lib/savon/qualified_message.rb +29 -28
- data/lib/savon/request.rb +4 -3
- data/lib/savon/response.rb +6 -5
- data/lib/savon/soap_fault.rb +1 -1
- data/lib/savon/version.rb +1 -1
- data/spec/fixtures/wsdl/brand.xml +624 -0
- data/spec/integration/random_quote_spec.rb +1 -1
- data/spec/integration/stockquote_example_spec.rb +6 -0
- data/spec/savon/log_message_spec.rb +7 -1
- data/spec/savon/options_spec.rb +11 -0
- data/spec/savon/qualified_message_spec.rb +53 -5
- data/spec/savon/soap_fault_spec.rb +5 -0
- data/spec/savon/softlayer_spec.rb +27 -0
- metadata +5 -3
@@ -16,7 +16,7 @@ describe 'rpc/encoded binding test' do
|
|
16
16
|
$stderr.puts e.to_hash.inspect
|
17
17
|
f_c = e.to_hash[:fault][:faultstring]
|
18
18
|
expect(f_c).not_to eq('No such operation \'getQuoteRequest\'')
|
19
|
-
expect(f_c).to eq('
|
19
|
+
expect(f_c).to eq('lucee.runtime.exp.DatabaseException: ')
|
20
20
|
pending e
|
21
21
|
end
|
22
22
|
end
|
@@ -19,6 +19,12 @@ describe "Stockquote example" do
|
|
19
19
|
|
20
20
|
cdata = response.body[:get_quote_response][:get_quote_result]
|
21
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
|
+
|
22
28
|
nori_options = { :convert_tags_to => lambda { |tag| tag.snakecase.to_sym } }
|
23
29
|
result = Nori.new(nori_options).parse(cdata)
|
24
30
|
|
@@ -21,9 +21,15 @@ describe Savon::LogMessage do
|
|
21
21
|
expect(message).to include("\n <body>")
|
22
22
|
end
|
23
23
|
|
24
|
-
it "filters tags in a given message" do
|
24
|
+
it "filters tags in a given message without pretty printing" do
|
25
25
|
message = log_message("<root><password>secret</password></root>", [:password], false).to_s
|
26
26
|
expect(message).to include("<password>***FILTERED***</password>")
|
27
|
+
expect(message).to_not include("\n <password>***FILTERED***</password>") # no pretty printing
|
28
|
+
end
|
29
|
+
|
30
|
+
it "filters tags in a given message with pretty printing" do
|
31
|
+
message = log_message("<root><password>secret</password></root>", [:password], true).to_s
|
32
|
+
expect(message).to include("\n <password>***FILTERED***</password>")
|
27
33
|
end
|
28
34
|
|
29
35
|
it "properly applies Proc filter" do
|
data/spec/savon/options_spec.rb
CHANGED
@@ -1046,6 +1046,17 @@ describe "Options" do
|
|
1046
1046
|
end
|
1047
1047
|
end
|
1048
1048
|
|
1049
|
+
context "request :headers" do
|
1050
|
+
it "sets headers" do
|
1051
|
+
client = new_client(:endpoint => @server.url(:inspect_request))
|
1052
|
+
|
1053
|
+
response = client.call(:authenticate, :headers => { "X-Token" => "secret" })
|
1054
|
+
x_token = inspect_request(response).x_token
|
1055
|
+
|
1056
|
+
expect(x_token).to eq("secret")
|
1057
|
+
end
|
1058
|
+
end
|
1059
|
+
|
1049
1060
|
def new_client(globals = {}, &block)
|
1050
1061
|
globals = { :wsdl => Fixture.wsdl(:authentication), :log => false }.merge(globals)
|
1051
1062
|
Savon.client(globals, &block)
|
@@ -4,15 +4,63 @@ module Savon
|
|
4
4
|
describe QualifiedMessage, "#to_hash" do
|
5
5
|
|
6
6
|
context "if a key ends with !" do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
types = {}
|
7
|
+
let(:used_namespaces) { {} }
|
8
|
+
let(:key_converter) { :camelcase }
|
9
|
+
let(:types) { {} }
|
11
10
|
|
11
|
+
it "restores the ! in a key" do
|
12
12
|
message = described_class.new(types, used_namespaces, key_converter)
|
13
13
|
resulting_hash = message.to_hash({:Metal! => "<Nice/>"}, ["Rock"])
|
14
14
|
|
15
|
-
expect(resulting_hash).to eq({
|
15
|
+
expect(resulting_hash).to eq({ :Metal! => "<Nice/>" })
|
16
|
+
end
|
17
|
+
|
18
|
+
it "properly handles special keys when namespaces are present" do
|
19
|
+
used_namespaces = {
|
20
|
+
%w(tns Foo) => 'ns',
|
21
|
+
%w(tns Foo Bar) => 'ns'
|
22
|
+
}
|
23
|
+
|
24
|
+
hash = {
|
25
|
+
:foo => {
|
26
|
+
:bar => {
|
27
|
+
:zing => 'pow'
|
28
|
+
},
|
29
|
+
:cash => {
|
30
|
+
:@attr1 => 'val1',
|
31
|
+
:content! => 'Chunky Bacon'
|
32
|
+
},
|
33
|
+
:attributes! => {
|
34
|
+
:bar => { :attr2 => 'val2' },
|
35
|
+
},
|
36
|
+
:"self_closing/" => '',
|
37
|
+
:order! => [:cash, :bar, :"self_closing/"]
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
good_result = {
|
42
|
+
"ns:Foo" => {
|
43
|
+
'ns:Bar' => { :zing => "pow" },
|
44
|
+
:cash => {
|
45
|
+
:@attr1 => "val1",
|
46
|
+
:content! => "Chunky Bacon"
|
47
|
+
},
|
48
|
+
:attributes! => {
|
49
|
+
'ns:Bar' => { :attr2 => 'val2' }
|
50
|
+
},
|
51
|
+
:"self_closing/" => '',
|
52
|
+
:order! => [:cash, 'ns:Bar', :"self_closing/"]
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
good_xml = %(<ns:Foo><Cash attr1="val1">Chunky Bacon</Cash><ns:Bar attr2="val2"><Zing>pow</Zing></ns:Bar><SelfClosing/></ns:Foo>)
|
57
|
+
|
58
|
+
message = described_class.new(types, used_namespaces, key_converter)
|
59
|
+
resulting_hash = message.to_hash(hash, ['tns'])
|
60
|
+
xml = Gyoku.xml(resulting_hash, key_converter: key_converter)
|
61
|
+
|
62
|
+
expect(resulting_hash).to eq good_result
|
63
|
+
expect(xml).to eq good_xml
|
16
64
|
end
|
17
65
|
end
|
18
66
|
|
@@ -7,6 +7,7 @@ describe Savon::SOAPFault do
|
|
7
7
|
let(:soap_fault_nc) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault)), nori_no_convert }
|
8
8
|
let(:soap_fault_nc2) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault12)), nori_no_convert }
|
9
9
|
let(:another_soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:another_soap_fault)), nori }
|
10
|
+
let(:soap_fault_no_body) { Savon::SOAPFault.new new_response(:body => {}), nori }
|
10
11
|
let(:no_fault) { Savon::SOAPFault.new new_response, nori }
|
11
12
|
|
12
13
|
let(:nori) { Nori.new(:strip_namespaces => true, :convert_tags_to => lambda { |tag| tag.snakecase.to_sym }) }
|
@@ -119,6 +120,10 @@ describe Savon::SOAPFault do
|
|
119
120
|
|
120
121
|
expect(soap_fault_nc2.to_hash).to eq(expected)
|
121
122
|
end
|
123
|
+
|
124
|
+
it "returns empty hash" do
|
125
|
+
expect(soap_fault_no_body.to_hash).to eq({})
|
126
|
+
end
|
122
127
|
end
|
123
128
|
|
124
129
|
def new_response(options = {})
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Savon::Builder do
|
4
|
+
|
5
|
+
subject(:builder) { Savon::Builder.new(:create_object, wsdl, globals, locals) }
|
6
|
+
|
7
|
+
let(:globals) { Savon::GlobalOptions.new }
|
8
|
+
# let(:locals) { Savon::LocalOptions.new }
|
9
|
+
let(:wsdl) { Wasabi::Document.new Fixture.wsdl(:brand) }
|
10
|
+
let(:no_wsdl) { Wasabi::Document.new }
|
11
|
+
|
12
|
+
describe "#to_s" do
|
13
|
+
it "defaults to include the default envelope namespace of :env" do
|
14
|
+
message = {
|
15
|
+
:message=>{
|
16
|
+
:template_object=>{
|
17
|
+
:longName=>"Zertico LLC Reseller"
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
locals = Savon::LocalOptions.new(message)
|
23
|
+
builder = Savon::Builder.new(:create_object, wsdl, globals, locals)
|
24
|
+
expect(builder.to_s).to eq('<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://api.service.softlayer.com/soap/v3/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><tns:createObject><templateObject><longName>Zertico LLC Reseller</longName></templateObject></tns:createObject></env:Body></env:Envelope>')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
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.11.
|
4
|
+
version: 2.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Harrington
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nori
|
@@ -247,6 +247,7 @@ files:
|
|
247
247
|
- spec/fixtures/ssl/client_key.pem
|
248
248
|
- spec/fixtures/wsdl/authentication.xml
|
249
249
|
- spec/fixtures/wsdl/betfair.xml
|
250
|
+
- spec/fixtures/wsdl/brand.xml
|
250
251
|
- spec/fixtures/wsdl/edialog.xml
|
251
252
|
- spec/fixtures/wsdl/interhome.xml
|
252
253
|
- spec/fixtures/wsdl/lower_camel.xml
|
@@ -283,6 +284,7 @@ files:
|
|
283
284
|
- spec/savon/request_spec.rb
|
284
285
|
- spec/savon/response_spec.rb
|
285
286
|
- spec/savon/soap_fault_spec.rb
|
287
|
+
- spec/savon/softlayer_spec.rb
|
286
288
|
- spec/spec_helper.rb
|
287
289
|
- spec/support/adapters.rb
|
288
290
|
- spec/support/endpoint.rb
|
@@ -309,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
309
311
|
version: '0'
|
310
312
|
requirements: []
|
311
313
|
rubyforge_project: savon
|
312
|
-
rubygems_version: 2.
|
314
|
+
rubygems_version: 2.6.12
|
313
315
|
signing_key:
|
314
316
|
specification_version: 4
|
315
317
|
summary: Heavy metal SOAP client
|