soap-object 0.6.3 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +21 -20
- data/.rspec +1 -1
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/ChangeLog +66 -50
- data/Gemfile +11 -11
- data/Guardfile +17 -17
- data/LICENSE.txt +21 -21
- data/README.md +131 -42
- data/Rakefile +24 -21
- data/cucumber.yml +6 -6
- data/features/core_functionality.feature +24 -0
- data/features/response_functionality.feature +21 -0
- data/features/step_definitions/core_functionality_steps.rb +28 -0
- data/features/step_definitions/response_steps.rb +35 -0
- data/features/support/env.rb +7 -5
- data/features/support/services/define_service.rb +9 -0
- data/features/support/services/local_wsdl_service.rb +5 -0
- data/features/support/services/zip_code_service.rb +28 -0
- data/features/wsdl/uszip.asmx.wsdl.xml +394 -394
- data/lib/soap-object.rb +100 -128
- data/lib/soap-object/class_methods.rb +143 -125
- data/lib/soap-object/factory.rb +22 -22
- data/lib/soap-object/response.rb +39 -0
- data/lib/soap-object/ssl_options.rb +22 -0
- data/lib/soap-object/version.rb +3 -5
- data/soap-object.gemspec +24 -24
- data/spec/lib/client_options_spec.rb +119 -0
- data/spec/lib/factory_spec.rb +25 -0
- data/spec/lib/soap_object_spec.rb +37 -143
- data/spec/lib/ssl_options_spec.rb +27 -0
- data/spec/spec_helper.rb +45 -6
- metadata +41 -23
- data/features/basic_functionality.feature +0 -40
- data/features/step_definitions/basic_functionality_steps.rb +0 -89
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SoapObject do
|
4
|
+
let(:client) { double('client') }
|
5
|
+
let(:platform) {double('savon')}
|
6
|
+
|
7
|
+
before do
|
8
|
+
allow(platform).to receive(:client).and_return(client)
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'when setting client ssl options' do
|
12
|
+
|
13
|
+
it 'should allow one to enable SSL verification' do
|
14
|
+
expect(platform).to receive(:client).with(hash_including(ssl_verify_mode: :peer))
|
15
|
+
|
16
|
+
WithSslOptions.new(platform)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should allow one to set SSL version' do
|
20
|
+
expect(platform).to receive(:client).with(hash_including(ssl_version: :SSLv2))
|
21
|
+
|
22
|
+
WithSslOptions.new(platform)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,45 @@
|
|
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
|
+
|
7
|
+
class TestWorld
|
8
|
+
include SoapObject::Factory
|
9
|
+
end
|
10
|
+
|
11
|
+
class TestSoapObjectWithProperties
|
12
|
+
include SoapObject
|
13
|
+
|
14
|
+
wsdl 'http://blah.com'
|
15
|
+
endpoint 'https://blah.com'
|
16
|
+
proxy 'http://proxy.com:8080'
|
17
|
+
open_timeout 10
|
18
|
+
read_timeout 20
|
19
|
+
soap_header 'Token' => 'secret'
|
20
|
+
encoding 'UTF-16'
|
21
|
+
basic_auth 'steve', 'secret'
|
22
|
+
digest_auth 'digest', 'auth'
|
23
|
+
log_level :error
|
24
|
+
soap_version 2
|
25
|
+
end
|
26
|
+
|
27
|
+
class WithoutClientProperties
|
28
|
+
include SoapObject
|
29
|
+
end
|
30
|
+
|
31
|
+
class TestSoapObject
|
32
|
+
include SoapObject
|
33
|
+
|
34
|
+
wsdl 'http://blah.com'
|
35
|
+
end
|
36
|
+
|
37
|
+
class WithSslOptions
|
38
|
+
include SoapObject
|
39
|
+
|
40
|
+
ssl_options do |opts|
|
41
|
+
opts.verify_mode = :peer
|
42
|
+
opts.version = :SSLv2
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
metadata
CHANGED
@@ -1,56 +1,56 @@
|
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey S. Morgan
|
8
8
|
- Doug Morgan
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 2.2.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 2.2.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rspec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 2.12.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 2.12.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: cucumber
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 1.2.0
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 1.2.0
|
56
56
|
description: Wrapper around SOAP service calls to make it easy to test
|
@@ -61,10 +61,10 @@ executables: []
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
-
- .gitignore
|
65
|
-
- .rspec
|
66
|
-
- .ruby-gemset
|
67
|
-
- .ruby-version
|
64
|
+
- ".gitignore"
|
65
|
+
- ".rspec"
|
66
|
+
- ".ruby-gemset"
|
67
|
+
- ".ruby-version"
|
68
68
|
- ChangeLog
|
69
69
|
- Gemfile
|
70
70
|
- Guardfile
|
@@ -72,44 +72,62 @@ files:
|
|
72
72
|
- README.md
|
73
73
|
- Rakefile
|
74
74
|
- cucumber.yml
|
75
|
-
- features/
|
76
|
-
- features/
|
75
|
+
- features/core_functionality.feature
|
76
|
+
- features/response_functionality.feature
|
77
|
+
- features/step_definitions/core_functionality_steps.rb
|
78
|
+
- features/step_definitions/response_steps.rb
|
77
79
|
- features/support/env.rb
|
80
|
+
- features/support/services/define_service.rb
|
81
|
+
- features/support/services/local_wsdl_service.rb
|
82
|
+
- features/support/services/zip_code_service.rb
|
78
83
|
- features/wsdl/uszip.asmx.wsdl.xml
|
79
84
|
- lib/soap-object.rb
|
80
85
|
- lib/soap-object/class_methods.rb
|
81
86
|
- lib/soap-object/factory.rb
|
87
|
+
- lib/soap-object/response.rb
|
88
|
+
- lib/soap-object/ssl_options.rb
|
82
89
|
- lib/soap-object/version.rb
|
83
90
|
- soap-object.gemspec
|
91
|
+
- spec/lib/client_options_spec.rb
|
92
|
+
- spec/lib/factory_spec.rb
|
84
93
|
- spec/lib/soap_object_spec.rb
|
94
|
+
- spec/lib/ssl_options_spec.rb
|
85
95
|
- spec/spec_helper.rb
|
86
96
|
homepage: http://github.com/cheezy/soap-object
|
87
97
|
licenses: []
|
88
98
|
metadata: {}
|
89
|
-
post_install_message:
|
99
|
+
post_install_message:
|
90
100
|
rdoc_options: []
|
91
101
|
require_paths:
|
92
102
|
- lib
|
93
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
104
|
requirements:
|
95
|
-
- -
|
105
|
+
- - ">="
|
96
106
|
- !ruby/object:Gem::Version
|
97
107
|
version: '0'
|
98
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
109
|
requirements:
|
100
|
-
- -
|
110
|
+
- - ">="
|
101
111
|
- !ruby/object:Gem::Version
|
102
112
|
version: '0'
|
103
113
|
requirements: []
|
104
|
-
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
106
|
-
signing_key:
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.6.14.1
|
116
|
+
signing_key:
|
107
117
|
specification_version: 4
|
108
118
|
summary: Wrapper around SOAP service calls to make it easy to test
|
109
119
|
test_files:
|
110
|
-
- features/
|
111
|
-
- features/
|
120
|
+
- features/core_functionality.feature
|
121
|
+
- features/response_functionality.feature
|
122
|
+
- features/step_definitions/core_functionality_steps.rb
|
123
|
+
- features/step_definitions/response_steps.rb
|
112
124
|
- features/support/env.rb
|
125
|
+
- features/support/services/define_service.rb
|
126
|
+
- features/support/services/local_wsdl_service.rb
|
127
|
+
- features/support/services/zip_code_service.rb
|
113
128
|
- features/wsdl/uszip.asmx.wsdl.xml
|
129
|
+
- spec/lib/client_options_spec.rb
|
130
|
+
- spec/lib/factory_spec.rb
|
114
131
|
- spec/lib/soap_object_spec.rb
|
132
|
+
- spec/lib/ssl_options_spec.rb
|
115
133
|
- spec/spec_helper.rb
|
@@ -1,40 +0,0 @@
|
|
1
|
-
@focus
|
2
|
-
Feature: This describes the core functionality of the SoapObject object
|
3
|
-
|
4
|
-
Scenario: Establishing communications with remote wsdl
|
5
|
-
Given I have the url for a remote wsdl
|
6
|
-
When I create an instance of the SoapObject class
|
7
|
-
Then I should have a connection
|
8
|
-
|
9
|
-
Scenario: Establishing communications with a local wsdl
|
10
|
-
Given I have a wsdl file residing locally
|
11
|
-
When I create an instance of the SoapObject class
|
12
|
-
Then I should have a connection
|
13
|
-
|
14
|
-
Scenario: Providing operations when using wsdl
|
15
|
-
Given I have the url for a remote wsdl
|
16
|
-
When I create an instance of the SoapObject class
|
17
|
-
Then I should be able to determine the operations
|
18
|
-
|
19
|
-
Scenario: Calling a service when using wsdl
|
20
|
-
Given I have the url for a remote wsdl
|
21
|
-
When I create an instance of the SoapObject class
|
22
|
-
Then I should be able to make a call and receive the correct results
|
23
|
-
|
24
|
-
Scenario: Getting the xml from a response
|
25
|
-
Given I have the url for a remote wsdl
|
26
|
-
When I create an instance of the SoapObject class
|
27
|
-
Then I should be able to make a call and receive the correct results
|
28
|
-
And the results xml should contain "<STATE>CA"
|
29
|
-
|
30
|
-
Scenario: Getting the doc from a response as a Nokogiri object
|
31
|
-
Given I have the url for a remote wsdl
|
32
|
-
When I create an instance of the SoapObject class
|
33
|
-
Then I should be able to make a call and receive the correct results
|
34
|
-
And the results doc should be a Nokogiri XML object
|
35
|
-
|
36
|
-
Scenario: Calling another service with wsdl
|
37
|
-
Given I am calling the Define service
|
38
|
-
When I create an instance of the SoapObject class
|
39
|
-
Then I should be able to get the correct definition results
|
40
|
-
|
@@ -1,89 +0,0 @@
|
|
1
|
-
class TestServiceWithWsdl
|
2
|
-
include SoapObject
|
3
|
-
|
4
|
-
wsdl 'http://www.webservicex.net/uszip.asmx?WSDL'
|
5
|
-
log_level :error
|
6
|
-
|
7
|
-
def get_zip_code_info(zip_code)
|
8
|
-
get_info_by_zip 'USZip' => zip_code
|
9
|
-
end
|
10
|
-
|
11
|
-
def state
|
12
|
-
message[:state]
|
13
|
-
end
|
14
|
-
|
15
|
-
def city
|
16
|
-
message[:city]
|
17
|
-
end
|
18
|
-
|
19
|
-
def area_code
|
20
|
-
message[:area_code]
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def message
|
26
|
-
body[:get_info_by_zip_response][:get_info_by_zip_result][:new_data_set][:table]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class TestServiceWithLocalWsdl
|
31
|
-
include SoapObject
|
32
|
-
|
33
|
-
wsdl "#{File.dirname(__FILE__)}/../wsdl/uszip.asmx.wsdl"
|
34
|
-
end
|
35
|
-
|
36
|
-
class TestDefineService
|
37
|
-
include SoapObject
|
38
|
-
|
39
|
-
wsdl "http://services.aonaware.com/DictService/DictService.asmx?WSDL"
|
40
|
-
log_level :error
|
41
|
-
|
42
|
-
def definition_for(word)
|
43
|
-
define word: word
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
Given /^I have the url for a remote wsdl$/ do
|
49
|
-
@cls = TestServiceWithWsdl
|
50
|
-
end
|
51
|
-
|
52
|
-
Given /^I have a wsdl file residing locally$/ do
|
53
|
-
@cls = TestServiceWithLocalWsdl
|
54
|
-
end
|
55
|
-
|
56
|
-
When /^I create an instance of the SoapObject class$/ do
|
57
|
-
@so = @cls.new
|
58
|
-
end
|
59
|
-
|
60
|
-
Then /^I should have a connection$/ do
|
61
|
-
expect(@so).to be_connected
|
62
|
-
end
|
63
|
-
|
64
|
-
Then /^I should be able to determine the operations$/ do
|
65
|
-
expect(@so.operations).to include :get_info_by_zip
|
66
|
-
end
|
67
|
-
|
68
|
-
Then /^I should be able to make a call and receive the correct results$/ do
|
69
|
-
@so.get_zip_code_info(90210)
|
70
|
-
expect(@so.state).to eq('CA')
|
71
|
-
expect(@so.city).to eq('Beverly Hills')
|
72
|
-
expect(@so.area_code).to eq('310')
|
73
|
-
end
|
74
|
-
|
75
|
-
Then /^the results xml should contain "(.*?)"$/ do |xml|
|
76
|
-
expect(@so.to_xml).to include xml
|
77
|
-
end
|
78
|
-
|
79
|
-
Then /^the results doc should be a Nokogiri XML object$/ do
|
80
|
-
expect(@so.doc).to be_instance_of Nokogiri::XML::Document
|
81
|
-
end
|
82
|
-
|
83
|
-
Given /^I am calling the Define service$/ do
|
84
|
-
@cls = TestDefineService
|
85
|
-
end
|
86
|
-
|
87
|
-
Then /^I should be able to get the correct definition results$/ do
|
88
|
-
@so.definition_for 'Cheese'
|
89
|
-
end
|