savon 2.11.0 → 2.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -1
- data/lib/savon/header.rb +2 -2
- data/lib/savon/mock/expectation.rb +11 -2
- data/lib/savon/operation.rb +7 -1
- data/lib/savon/options.rb +7 -1
- data/lib/savon/version.rb +1 -1
- data/savon.gemspec +0 -1
- data/spec/savon/builder_spec.rb +13 -4
- data/spec/savon/mock_spec.rb +11 -0
- data/spec/savon/options_spec.rb +10 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 504295cfd93728423a78f8523e082e978008dfe4
|
4
|
+
data.tar.gz: 65168159c3236ec262c6c14fc5f177cdf110bccf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efa583a756b8257abf5af2191b4b1eabd4477d4d3486e51bbc468ed9b911c04226416ad87028c7428e1bb0d47374ab8b0ad3488750e6cfc677c50c739a3fde8e
|
7
|
+
data.tar.gz: d4f6ac8cbd182f6fb6c3f3c8982ef1834fb852b91102b92286d7215e3ac71a040926d554330dfcf46151ef5862c542400918f35c8ec58edb049044865814d269
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/lib/savon/header.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "akami"
|
2
2
|
require "gyoku"
|
3
|
-
require "
|
3
|
+
require "securerandom"
|
4
4
|
|
5
5
|
module Savon
|
6
6
|
class Header
|
@@ -61,7 +61,7 @@ module Savon
|
|
61
61
|
convert_to_xml({
|
62
62
|
'wsa:Action' => @locals[:soap_action],
|
63
63
|
'wsa:To' => @globals[:endpoint],
|
64
|
-
'wsa:MessageID' => "urn:uuid:#{
|
64
|
+
'wsa:MessageID' => "urn:uuid:#{SecureRandom.uuid}",
|
65
65
|
attributes!: {
|
66
66
|
'wsa:MessageID' => {
|
67
67
|
"xmlns:wsa" => "http://schemas.xmlsoap.org/ws/2004/08/addressing"
|
@@ -55,7 +55,7 @@ module Savon
|
|
55
55
|
|
56
56
|
def verify_message!
|
57
57
|
return if @expected[:message].eql? :any
|
58
|
-
unless @expected[:message]
|
58
|
+
unless equals_except_any(@expected[:message], @actual[:message])
|
59
59
|
expected_message = " with this message: #{@expected[:message].inspect}" if @expected[:message]
|
60
60
|
expected_message ||= " with no message."
|
61
61
|
|
@@ -63,9 +63,18 @@ module Savon
|
|
63
63
|
actual_message ||= " with no message."
|
64
64
|
|
65
65
|
raise ExpectationError, "Expected a request to the #{@expected[:operation_name].inspect} operation\n#{expected_message}\n" \
|
66
|
-
|
66
|
+
"Received a request to the #{@actual[:operation_name].inspect} operation\n#{actual_message}"
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
def equals_except_any(msg_expected, msg_real)
|
71
|
+
return true if msg_expected === msg_real
|
72
|
+
return false if (msg_expected.nil? || msg_real.nil?) # If both are nil has returned true
|
73
|
+
msg_expected.each do |key, expected_value|
|
74
|
+
next if (expected_value == :any && msg_real.include?(key))
|
75
|
+
return false if expected_value != msg_real[key]
|
76
|
+
end
|
77
|
+
return true
|
78
|
+
end
|
70
79
|
end
|
71
80
|
end
|
data/lib/savon/operation.rb
CHANGED
@@ -126,7 +126,13 @@ module Savon
|
|
126
126
|
end
|
127
127
|
|
128
128
|
def endpoint
|
129
|
-
@globals[:endpoint] || @wsdl.endpoint
|
129
|
+
@globals[:endpoint] || @wsdl.endpoint.tap do |url|
|
130
|
+
if @globals[:host]
|
131
|
+
host_url = URI.parse(@globals[:host])
|
132
|
+
url.host = host_url.host
|
133
|
+
url.port = host_url.port
|
134
|
+
end
|
135
|
+
end
|
130
136
|
end
|
131
137
|
|
132
138
|
def raise_expected_httpi_response!
|
data/lib/savon/options.rb
CHANGED
@@ -89,7 +89,8 @@ module Savon
|
|
89
89
|
:use_wsa_headers => false,
|
90
90
|
:no_message_tag => false,
|
91
91
|
:follow_redirects => false,
|
92
|
-
:unwrap => false
|
92
|
+
:unwrap => false,
|
93
|
+
:host => nil
|
93
94
|
}
|
94
95
|
|
95
96
|
options = defaults.merge(options)
|
@@ -108,6 +109,11 @@ module Savon
|
|
108
109
|
@options[:wsdl] = wsdl_address
|
109
110
|
end
|
110
111
|
|
112
|
+
# set different host for actions in WSDL
|
113
|
+
def host(host)
|
114
|
+
@options[:host] = host
|
115
|
+
end
|
116
|
+
|
111
117
|
# SOAP endpoint.
|
112
118
|
def endpoint(endpoint)
|
113
119
|
@options[:endpoint] = endpoint
|
data/lib/savon/version.rb
CHANGED
data/savon.gemspec
CHANGED
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency "wasabi", "~> 3.4"
|
23
23
|
s.add_dependency "akami", "~> 1.2"
|
24
24
|
s.add_dependency "gyoku", "~> 1.2"
|
25
|
-
s.add_dependency "uuid", "~> 2.3.7"
|
26
25
|
s.add_dependency "builder", ">= 2.1.2"
|
27
26
|
s.add_dependency "nokogiri", ">= 1.4.0"
|
28
27
|
|
data/spec/savon/builder_spec.rb
CHANGED
@@ -83,10 +83,19 @@ describe Savon::Builder do
|
|
83
83
|
end
|
84
84
|
|
85
85
|
describe "#wsse_signature" do
|
86
|
-
|
87
|
-
|
88
|
-
let(:
|
89
|
-
let(:
|
86
|
+
fixture_dir = File.join(File.dirname(__FILE__), '..', 'fixtures', 'ssl')
|
87
|
+
|
88
|
+
let(:cert) { File.join(fixture_dir, 'client_cert.pem') }
|
89
|
+
let(:private_key) { File.join(fixture_dir, 'client_key.pem') }
|
90
|
+
let(:signature) do
|
91
|
+
Akami::WSSE::Signature.new(
|
92
|
+
Akami::WSSE::Certs.new(
|
93
|
+
:cert_file => cert,
|
94
|
+
:private_key_file => private_key
|
95
|
+
)
|
96
|
+
)
|
97
|
+
end
|
98
|
+
let(:globals) { Savon::GlobalOptions.new(wsse_signature: signature) }
|
90
99
|
|
91
100
|
subject(:signed_message_nn) {Nokogiri::XML(builder.to_s).remove_namespaces!}
|
92
101
|
subject(:signed_message) {Nokogiri::XML(builder.to_s)}
|
data/spec/savon/mock_spec.rb
CHANGED
@@ -23,6 +23,17 @@ describe "Savon's mock interface" do
|
|
23
23
|
expect(response.http.body).to eq("<fixture/>")
|
24
24
|
end
|
25
25
|
|
26
|
+
it "can verify a request with any parameters and return a fixture response" do
|
27
|
+
message = { :username => "luke", :password => :any }
|
28
|
+
savon.expects(:authenticate).with(:message => message).returns("<fixture/>")
|
29
|
+
|
30
|
+
response = new_client.call(:authenticate) do
|
31
|
+
message(:username => "luke", :password => "secret")
|
32
|
+
end
|
33
|
+
|
34
|
+
expect(response.http.body).to eq("<fixture/>")
|
35
|
+
end
|
36
|
+
|
26
37
|
it "accepts a Hash to specify the response code, headers and body" do
|
27
38
|
soap_fault = Fixture.response(:soap_fault)
|
28
39
|
response = { :code => 500, :headers => { "X-Result" => "invalid" }, :body => soap_fault }
|
data/spec/savon/options_spec.rb
CHANGED
@@ -114,6 +114,15 @@ describe "Options" do
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
+
context "global :host" do
|
118
|
+
it "overrides the WSDL endpoint host" do
|
119
|
+
client = new_client(:wsdl => Fixture.wsdl(:no_message_tag), host: "https://example.com:8080")
|
120
|
+
|
121
|
+
request = client.build_request(:update_orders)
|
122
|
+
expect(request.url.to_s).to eq "https://example.com:8080/webserviceexternal/contracts.asmx"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
117
126
|
context "global :headers" do
|
118
127
|
it "sets the HTTP headers for the next request" do
|
119
128
|
client = new_client(:endpoint => @server.url(:inspect_request), :headers => { "X-Token" => "secret" })
|
@@ -578,7 +587,7 @@ describe "Options" do
|
|
578
587
|
expect(request).to include("<wsse:Username>#{username}</wsse:Username>")
|
579
588
|
|
580
589
|
# the nonce node
|
581
|
-
expect(request).to match(/<wsse:Nonce.*>.+\n
|
590
|
+
expect(request).to match(/<wsse:Nonce.*>.+\n?<\/wsse:Nonce>/)
|
582
591
|
|
583
592
|
# the created node with a timestamp
|
584
593
|
expect(request).to match(/<wsu:Created>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.*<\/wsu:Created>/)
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Harrington
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nori
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.2'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: uuid
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 2.3.7
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 2.3.7
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: builder
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -323,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
323
309
|
version: '0'
|
324
310
|
requirements: []
|
325
311
|
rubyforge_project: savon
|
326
|
-
rubygems_version: 2.
|
312
|
+
rubygems_version: 2.4.6
|
327
313
|
signing_key:
|
328
314
|
specification_version: 4
|
329
315
|
summary: Heavy metal SOAP client
|