soap-object 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.gitignore +20 -20
- data/.rspec +1 -1
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/ChangeLog +50 -50
- data/Gemfile +11 -11
- data/Guardfile +17 -17
- data/LICENSE.txt +21 -21
- data/README.md +42 -42
- data/Rakefile +21 -21
- data/cucumber.yml +6 -6
- data/features/basic_functionality.feature +40 -40
- data/features/step_definitions/basic_functionality_steps.rb +89 -89
- data/features/support/env.rb +5 -5
- data/features/wsdl/uszip.asmx.wsdl.xml +394 -394
- data/lib/soap-object.rb +132 -128
- data/lib/soap-object/class_methods.rb +131 -125
- data/lib/soap-object/factory.rb +22 -22
- data/lib/soap-object/version.rb +5 -5
- data/soap-object.gemspec +24 -24
- data/spec/lib/factory_spec.rb +35 -0
- data/spec/lib/soap_object_spec.rb +145 -143
- data/spec/spec_helper.rb +6 -6
- metadata +6 -3
data/lib/soap-object/factory.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
|
2
|
-
module SoapObject
|
3
|
-
module Factory
|
4
|
-
|
5
|
-
def using(cls, &block)
|
6
|
-
@the_service = find_service(cls)
|
7
|
-
block.call @the_service if block
|
8
|
-
@the_service
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def find_service(cls)
|
14
|
-
services[cls] = cls.new unless services[cls]
|
15
|
-
services[cls]
|
16
|
-
end
|
17
|
-
|
18
|
-
def services
|
19
|
-
@services ||= {}
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
1
|
+
|
2
|
+
module SoapObject
|
3
|
+
module Factory
|
4
|
+
|
5
|
+
def using(cls, &block)
|
6
|
+
@the_service = find_service(cls)
|
7
|
+
block.call @the_service if block
|
8
|
+
@the_service
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def find_service(cls)
|
14
|
+
services[cls] = cls.new unless services[cls]
|
15
|
+
services[cls]
|
16
|
+
end
|
17
|
+
|
18
|
+
def services
|
19
|
+
@services ||= {}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/soap-object/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
module Soap
|
2
|
-
module Object
|
3
|
-
VERSION = "0.6.
|
4
|
-
end
|
5
|
-
end
|
1
|
+
module Soap
|
2
|
+
module Object
|
3
|
+
VERSION = "0.6.4"
|
4
|
+
end
|
5
|
+
end
|
data/soap-object.gemspec
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'soap-object/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "soap-object"
|
8
|
-
gem.version = Soap::Object::VERSION
|
9
|
-
gem.authors = ["Jeffrey S. Morgan", "Doug Morgan"]
|
10
|
-
gem.email = ["jeff.morgan@leandog.com", "douglas.morgan3405@gmail.com"]
|
11
|
-
gem.description = %q{Wrapper around SOAP service calls to make it easy to test}
|
12
|
-
gem.summary = %q{Wrapper around SOAP service calls to make it easy to test}
|
13
|
-
gem.homepage = "http://github.com/cheezy/soap-object"
|
14
|
-
|
15
|
-
gem.files = `git ls-files`.split($/)
|
16
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
-
gem.require_paths = ["lib"]
|
19
|
-
|
20
|
-
gem.add_dependency 'savon', '>= 2.2.0'
|
21
|
-
|
22
|
-
gem.add_development_dependency 'rspec', '>= 2.12.0'
|
23
|
-
gem.add_development_dependency 'cucumber', '>= 1.2.0'
|
24
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'soap-object/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "soap-object"
|
8
|
+
gem.version = Soap::Object::VERSION
|
9
|
+
gem.authors = ["Jeffrey S. Morgan", "Doug Morgan"]
|
10
|
+
gem.email = ["jeff.morgan@leandog.com", "douglas.morgan3405@gmail.com"]
|
11
|
+
gem.description = %q{Wrapper around SOAP service calls to make it easy to test}
|
12
|
+
gem.summary = %q{Wrapper around SOAP service calls to make it easy to test}
|
13
|
+
gem.homepage = "http://github.com/cheezy/soap-object"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency 'savon', '>= 2.2.0'
|
21
|
+
|
22
|
+
gem.add_development_dependency 'rspec', '>= 2.12.0'
|
23
|
+
gem.add_development_dependency 'cucumber', '>= 1.2.0'
|
24
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class TestSoapObject
|
4
|
+
include SoapObject
|
5
|
+
|
6
|
+
wsdl 'http://blah.com'
|
7
|
+
end
|
8
|
+
|
9
|
+
class TestWorld
|
10
|
+
include SoapObject::Factory
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'SoapObject factory' do
|
14
|
+
context "when using the factory to create to service" do
|
15
|
+
let(:world) { TestWorld.new }
|
16
|
+
|
17
|
+
it "should create a valid service object" do
|
18
|
+
service = world.using(TestSoapObject)
|
19
|
+
expect(service).to be_instance_of TestSoapObject
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should create a valid service and invoke a block" do
|
23
|
+
world.using(TestSoapObject) do |service|
|
24
|
+
expect(service).to be_instance_of TestSoapObject
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should create the service the first time we use it" do
|
29
|
+
obj = TestSoapObject.new
|
30
|
+
expect(TestSoapObject).to receive(:new).once.and_return(obj)
|
31
|
+
world.using(TestSoapObject)
|
32
|
+
world.using(TestSoapObject)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,143 +1,145 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class
|
4
|
-
include SoapObject
|
5
|
-
|
6
|
-
wsdl 'http://blah.com'
|
7
|
-
proxy 'http://proxy.com:8080'
|
8
|
-
open_timeout 10
|
9
|
-
read_timeout 20
|
10
|
-
soap_header 'Token' => 'secret'
|
11
|
-
encoding 'UTF-16'
|
12
|
-
basic_auth 'steve', 'secret'
|
13
|
-
digest_auth 'digest', 'auth'
|
14
|
-
log_level :error
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class TestSoapObjectWithProperties
|
4
|
+
include SoapObject
|
5
|
+
|
6
|
+
wsdl 'http://blah.com'
|
7
|
+
proxy 'http://proxy.com:8080'
|
8
|
+
open_timeout 10
|
9
|
+
read_timeout 20
|
10
|
+
soap_header 'Token' => 'secret'
|
11
|
+
encoding 'UTF-16'
|
12
|
+
basic_auth 'steve', 'secret'
|
13
|
+
digest_auth 'digest', 'auth'
|
14
|
+
log_level :error
|
15
|
+
end
|
16
|
+
|
17
|
+
class WithoutClientProperties
|
18
|
+
include SoapObject
|
19
|
+
end
|
20
|
+
|
21
|
+
describe SoapObject do
|
22
|
+
let(:client) { double('client') }
|
23
|
+
let(:subject) { TestSoapObjectWithProperties.new }
|
24
|
+
|
25
|
+
context 'when creating new instances' do
|
26
|
+
before do
|
27
|
+
allow(Savon).to receive(:client).and_return(client)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should initialize the client using the wsdl' do
|
31
|
+
expect(subject.send(:client_properties)[:wsdl]).to eq('http://blah.com')
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should know when it is connected to service' do
|
35
|
+
expect(subject).to be_connected
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should allow one to setup a proxy' do
|
39
|
+
expect(subject.send(:client_properties)[:proxy]).to eq('http://proxy.com:8080')
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should allow one to set an open timeout' do
|
43
|
+
expect(subject.send(:client_properties)[:open_timeout]).to eq(10)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should allow one to set a read timeout' do
|
47
|
+
expect(subject.send(:client_properties)[:read_timeout]).to eq(20)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should allow one to set a soap header' do
|
51
|
+
expect(subject.send(:client_properties)[:soap_header]).to eq({'Token' => 'secret'})
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should allow one to set the encoding' do
|
55
|
+
expect(subject.send(:client_properties)[:encoding]).to eq('UTF-16')
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should allow one to use basic authentication' do
|
59
|
+
expect(subject.send(:client_properties)[:basic_auth]).to eq(['steve', 'secret'])
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should allow one to use digest authentication' do
|
63
|
+
expect(subject.send(:client_properties)[:digest_auth]).to eq(['digest', 'auth'])
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should disable logging when no logging level set' do
|
67
|
+
expect(WithoutClientProperties.new.send(:client_properties)[:log]).to eq(false)
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should enable logging when logging level set' do
|
71
|
+
expect(subject.send(:client_properties)[:log]).to eq(true)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should allow one to set the log level' do
|
75
|
+
expect(subject.send(:client_properties)[:log_level]).to eq(:error)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should use pretty format for xml when logging' do
|
79
|
+
expect(subject.send(:client_properties)[:pretty_print_xml]).to eq(true)
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'should disable SSL verification by default' do
|
83
|
+
expect(WithoutClientProperties.new.send(:client_properties)[:ssl_verify_mode]).to eq(:none)
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should set SSL version to 3 by default' do
|
87
|
+
expect(WithoutClientProperties.new.send(:client_properties)[:ssl_version]).to eq(:SSLv3)
|
88
|
+
end
|
89
|
+
|
90
|
+
context 'with ssl_verification' do
|
91
|
+
|
92
|
+
class WithSslVerification
|
93
|
+
include SoapObject
|
94
|
+
ssl_verification true
|
95
|
+
end
|
96
|
+
|
97
|
+
class WithoutSslVerification
|
98
|
+
include SoapObject
|
99
|
+
ssl_verification false
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should allow one to explicitly disable SSL verification' do
|
103
|
+
expect(WithoutSslVerification.new.send(:client_properties)[:ssl_verify_mode]).to eq(:none)
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should allow one to enable SSL verification' do
|
107
|
+
expect(WithSslVerification.new.send(:client_properties)[:ssl_verify_mode]).to be_nil
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
context 'with ssl version' do
|
112
|
+
class WithSslVersion
|
113
|
+
include SoapObject
|
114
|
+
ssl_version :SSLv2
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'should allow one to set SSL version' do
|
119
|
+
expect(WithSslVersion.new.send(:client_properties)[:ssl_version]).to eq(:SSLv2)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
context 'when calling methods on the service' do
|
127
|
+
let(:response) { double('response') }
|
128
|
+
|
129
|
+
before do
|
130
|
+
expect(Savon).to receive(:client).and_return(client)
|
131
|
+
expect(response).to receive(:to_xml)
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'should make a valid request' do
|
135
|
+
expect(client).to receive(:call).with(:fake_call, message: {data_key: 'some_value'}).and_return(response)
|
136
|
+
subject.fake_call data_key: 'some_value'
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'should make a valid request with custom xml' do
|
140
|
+
expected_xml = '<xml><envelope/><data></data></envelope></xml>'
|
141
|
+
expect(client).to receive(:call).with(anything, xml: expected_xml).and_return(response)
|
142
|
+
subject.fake_call expected_xml
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
|
4
|
-
require 'rspec'
|
5
|
-
require 'soap-object'
|
6
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
|
4
|
+
require 'rspec'
|
5
|
+
require 'soap-object'
|
6
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soap-object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey S. Morgan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- lib/soap-object/factory.rb
|
82
82
|
- lib/soap-object/version.rb
|
83
83
|
- soap-object.gemspec
|
84
|
+
- spec/lib/factory_spec.rb
|
84
85
|
- spec/lib/soap_object_spec.rb
|
85
86
|
- spec/spec_helper.rb
|
86
87
|
homepage: http://github.com/cheezy/soap-object
|
@@ -102,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
103
|
version: '0'
|
103
104
|
requirements: []
|
104
105
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.4.5
|
106
107
|
signing_key:
|
107
108
|
specification_version: 4
|
108
109
|
summary: Wrapper around SOAP service calls to make it easy to test
|
@@ -111,5 +112,7 @@ test_files:
|
|
111
112
|
- features/step_definitions/basic_functionality_steps.rb
|
112
113
|
- features/support/env.rb
|
113
114
|
- features/wsdl/uszip.asmx.wsdl.xml
|
115
|
+
- spec/lib/factory_spec.rb
|
114
116
|
- spec/lib/soap_object_spec.rb
|
115
117
|
- spec/spec_helper.rb
|
118
|
+
has_rdoc:
|