savon 2.5.0 → 2.5.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 +2 -5
- data/CHANGELOG.md +3 -0
- data/Gemfile +1 -0
- data/lib/savon/builder.rb +17 -5
- data/lib/savon/header.rb +14 -1
- data/lib/savon/model.rb +4 -0
- data/lib/savon/operation.rb +3 -0
- data/lib/savon/options.rb +6 -0
- data/lib/savon/version.rb +1 -1
- data/savon.gemspec +1 -0
- data/spec/savon/model_spec.rb +28 -0
- data/spec/savon/options_spec.rb +2 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 203ea0a3b371b474e308510c481c6e47f91b3139
|
4
|
+
data.tar.gz: 65db092bfb28fdf4865f1749596cbc0c88d00136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aff0b2e3c5a7fa75ce5871cc5af0d86c5e7da239f98636458ec963ddb91bbcb8fa9808b59adee5df9c06427ae202fe3ca8e0c8674fcfdfd6fa09351cb788601
|
7
|
+
data.tar.gz: ea8d384e0ea58276ddb33fcfd499d0876f12cc46dec42ebb59598f09f5ff83244d0e35d1e60162cdb11620b3b1aa9230608614b32e897e13742cf31d6b0787e3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# 2.5.0 (2014-05-03)
|
2
2
|
|
3
|
+
* Feature: [#573](https://github.com/savonrb/savon/pull/573) Add an `all_operations` method to `Savon::Model` that automatically adds all available operations to the model.
|
4
|
+
|
3
5
|
* Feature: [#566](https://github.com/savonrb/savon/pull/566) Allow specifying HTTPI adapter per client.
|
4
6
|
|
5
7
|
```ruby
|
6
8
|
curb_client = Savon.client(wsdl: "http://example.com/service.wsdl", adapter: :curb)
|
9
|
+
|
7
10
|
http_client = Savon.client(wsdl: "http://example.com/service.wsdl", adapter: :httpclient)
|
8
11
|
```
|
9
12
|
|
data/Gemfile
CHANGED
data/lib/savon/builder.rb
CHANGED
@@ -17,6 +17,8 @@ module Savon
|
|
17
17
|
2 => "http://www.w3.org/2003/05/soap-envelope"
|
18
18
|
}
|
19
19
|
|
20
|
+
WSA_NAMESPACE = "http://www.w3.org/2005/08/addressing"
|
21
|
+
|
20
22
|
def initialize(operation_name, wsdl, globals, locals)
|
21
23
|
@operation_name = operation_name
|
22
24
|
|
@@ -32,15 +34,25 @@ module Savon
|
|
32
34
|
Nokogiri.XML(to_s).to_xml(:indent => 2)
|
33
35
|
end
|
34
36
|
|
35
|
-
def
|
36
|
-
return @locals[:xml] if @locals.include? :xml
|
37
|
-
|
37
|
+
def build_document
|
38
38
|
tag(builder, :Envelope, namespaces_with_globals) do |xml|
|
39
|
-
tag(xml, :Header) { xml << header.to_s } unless header.empty?
|
40
|
-
tag(xml, :Body)
|
39
|
+
tag(xml, :Header, header_attributes) { xml << header.to_s } unless header.empty?
|
40
|
+
tag(xml, :Body, body_attributes) { xml.tag!(*namespaced_message_tag) { xml << message.to_s } }
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
+
def header_attributes
|
45
|
+
{ 'xmlns:wsa' => WSA_NAMESPACE } if @globals[:use_wsa_headers]
|
46
|
+
end
|
47
|
+
|
48
|
+
def body_attributes
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_s
|
52
|
+
return @locals[:xml] if @locals.include? :xml
|
53
|
+
build_document
|
54
|
+
end
|
55
|
+
|
44
56
|
private
|
45
57
|
|
46
58
|
def convert_type_definitions_to_hash
|
data/lib/savon/header.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "akami"
|
2
2
|
require "gyoku"
|
3
|
+
require "uuid"
|
3
4
|
|
4
5
|
module Savon
|
5
6
|
class Header
|
@@ -13,6 +14,9 @@ module Savon
|
|
13
14
|
@global_header = globals[:soap_header]
|
14
15
|
@local_header = locals[:soap_header]
|
15
16
|
|
17
|
+
@globals = globals
|
18
|
+
@locals = locals
|
19
|
+
|
16
20
|
@header = build
|
17
21
|
end
|
18
22
|
|
@@ -30,7 +34,7 @@ module Savon
|
|
30
34
|
private
|
31
35
|
|
32
36
|
def build
|
33
|
-
build_header + build_wsse_header
|
37
|
+
build_header + build_wsa_header + build_wsse_header
|
34
38
|
end
|
35
39
|
|
36
40
|
def build_header
|
@@ -51,6 +55,15 @@ module Savon
|
|
51
55
|
wsse_header.respond_to?(:to_xml) ? wsse_header.to_xml : ""
|
52
56
|
end
|
53
57
|
|
58
|
+
def build_wsa_header
|
59
|
+
return '' unless @globals[:use_wsa_headers]
|
60
|
+
convert_to_xml({
|
61
|
+
'wsa:Action' => @locals[:soap_action],
|
62
|
+
'wsa:To' => @globals[:endpoint],
|
63
|
+
'wsa:MessageID' => "urn:uuid:#{UUID.new.generate}"
|
64
|
+
})
|
65
|
+
end
|
66
|
+
|
54
67
|
def convert_to_xml(hash_or_string)
|
55
68
|
if hash_or_string.kind_of? Hash
|
56
69
|
Gyoku.xml(hash_or_string, gyoku_options)
|
data/lib/savon/model.rb
CHANGED
data/lib/savon/operation.rb
CHANGED
data/lib/savon/options.rb
CHANGED
@@ -57,6 +57,7 @@ module Savon
|
|
57
57
|
:convert_attributes_to => lambda { |k,v| [k,v] },
|
58
58
|
:multipart => false,
|
59
59
|
:adapter => nil,
|
60
|
+
:use_wsa_headers => false,
|
60
61
|
}
|
61
62
|
|
62
63
|
options = defaults.merge(options)
|
@@ -271,6 +272,11 @@ module Savon
|
|
271
272
|
def adapter(adapter)
|
272
273
|
@options[:adapter] = adapter
|
273
274
|
end
|
275
|
+
|
276
|
+
# Enable inclusion of WS-Addressing headers.
|
277
|
+
def use_wsa_headers(use)
|
278
|
+
@options[:use_wsa_headers] = use
|
279
|
+
end
|
274
280
|
end
|
275
281
|
|
276
282
|
class LocalOptions < Options
|
data/lib/savon/version.rb
CHANGED
data/savon.gemspec
CHANGED
data/spec/savon/model_spec.rb
CHANGED
@@ -151,4 +151,32 @@ describe Savon::Model do
|
|
151
151
|
supermodel.authenticate(:message => { :username => "luke", :password => "secret" })
|
152
152
|
end
|
153
153
|
|
154
|
+
describe ".all_operations" do
|
155
|
+
it "should call operations with all available client operations" do
|
156
|
+
model = Class.new {
|
157
|
+
extend Savon::Model
|
158
|
+
|
159
|
+
client :wsdl => Fixture.wsdl(:taxcloud)
|
160
|
+
all_operations
|
161
|
+
}
|
162
|
+
|
163
|
+
[:verify_address,
|
164
|
+
:lookup_for_date,
|
165
|
+
:lookup,
|
166
|
+
:authorized,
|
167
|
+
:authorized_with_capture,
|
168
|
+
:captured,
|
169
|
+
:returned,
|
170
|
+
:get_tic_groups,
|
171
|
+
:get_ti_cs,
|
172
|
+
:get_ti_cs_by_group,
|
173
|
+
:add_exempt_certificate,
|
174
|
+
:delete_exempt_certificate,
|
175
|
+
:get_exempt_certificates].each do |method|
|
176
|
+
expect(model).to respond_to(method)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
end
|
181
|
+
|
154
182
|
end
|
data/spec/savon/options_spec.rb
CHANGED
@@ -86,7 +86,8 @@ describe "Options" do
|
|
86
86
|
expect { client.call(:authenticate) }.to raise_error { |error|
|
87
87
|
host_unreachable = error.kind_of? Errno::EHOSTUNREACH
|
88
88
|
net_unreachable = error.kind_of? Errno::ENETUNREACH
|
89
|
-
|
89
|
+
socket_err = error.kind_of? SocketError
|
90
|
+
if host_unreachable || net_unreachable || socket_err
|
90
91
|
warn "Warning: looks like your network may be down?!\n" +
|
91
92
|
"-> skipping spec at #{__FILE__}:#{__LINE__}"
|
92
93
|
else
|
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.5.
|
4
|
+
version: 2.5.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: 2014-05-
|
11
|
+
date: 2014-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nori
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.1.0
|
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
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: builder
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|