soap-object 0.6.7 → 0.6.8
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 +4 -4
- data/.gitignore +1 -0
- data/README.md +1 -1
- data/Rakefile +5 -1
- data/cucumber.yml +2 -2
- 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 +2 -0
- 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/lib/soap-object.rb +11 -44
- data/lib/soap-object/class_methods.rb +12 -0
- data/lib/soap-object/response.rb +39 -0
- data/lib/soap-object/version.rb +1 -1
- data/spec/lib/client_options_spec.rb +6 -19
- data/spec/lib/factory_spec.rb +0 -10
- data/spec/lib/soap_object_spec.rb +13 -7
- data/spec/lib/ssl_options_spec.rb +0 -10
- data/spec/spec_helper.rb +39 -0
- metadata +34 -23
- data/features/basic_functionality.feature +0 -40
- data/features/step_definitions/basic_functionality_steps.rb +0 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c671cc72ababce59652396a4576c798e29b0a69a
|
4
|
+
data.tar.gz: 13de68c610f9ec82da27ed29c52de2a51fa51471
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d276efccddab68a8a49f92905bc083324d398a46c655132c13e14fc60bb7d7d7aa275f95ca80922e47cef1d1e6fbe99362272c49925ecc4be3c21cdc34d30d0
|
7
|
+
data.tar.gz: c7d57dac679b88423f18f092a834c1dc9e6c17ae898f9b7cfe863f37e2a1a2aaf0bbbeef35661bb6bc07f5796f1c755b42176443ec65b6bc13f9988d0e2ff664
|
data/.gitignore
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -11,7 +11,11 @@ end
|
|
11
11
|
task :spec
|
12
12
|
|
13
13
|
Cucumber::Rake::Task.new(:features, "Run all features") do |t|
|
14
|
-
t.profile = '
|
14
|
+
t.profile = 'default'
|
15
|
+
end
|
16
|
+
|
17
|
+
Cucumber::Rake::Task.new(:wip, "Wip features") do |t|
|
18
|
+
t.profile = 'wip'
|
15
19
|
end
|
16
20
|
|
17
21
|
desc 'Run all specs and features'
|
data/cucumber.yml
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
Feature: This describes the core functionality of the SoapObject object
|
2
|
+
|
3
|
+
Scenario: Establishing communications with remote wsdl
|
4
|
+
Given I have the url for a remote wsdl
|
5
|
+
When I create an instance of the SoapObject class
|
6
|
+
Then I should have a connection
|
7
|
+
|
8
|
+
Scenario: Establishing communications with a local wsdl
|
9
|
+
Given I have a wsdl file residing locally
|
10
|
+
When I create an instance of the SoapObject class
|
11
|
+
Then I should have a connection
|
12
|
+
|
13
|
+
Scenario: Providing operations when using wsdl
|
14
|
+
Given I have the url for a remote wsdl
|
15
|
+
When I create an instance of the SoapObject class
|
16
|
+
Then I should be able to determine the operations
|
17
|
+
|
18
|
+
Scenario Outline: Calling a service with a remote wsdl
|
19
|
+
When I use a SoapObject with a remote wsdl named "<soap-object>"
|
20
|
+
Then I should be able to successfully call "<operation>" with "<args>"
|
21
|
+
Examples:
|
22
|
+
| soap-object | operation | args |
|
23
|
+
| DefineService | definition_for | Cheese |
|
24
|
+
| ZipCodeService | get_zip_code_info | 44114 |
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Functionality to parse the response from the SoapObject call
|
2
|
+
|
3
|
+
Scenario: Getting the xml from a response
|
4
|
+
Given I use a SoapObject with a remote wsdl named "ZipCodeService"
|
5
|
+
When I get the information for zip code "44114"
|
6
|
+
Then the results xml should contain "<STATE>OH"
|
7
|
+
|
8
|
+
Scenario: Getting the doc from a response as a Nokogiri object
|
9
|
+
Given I use a SoapObject with a remote wsdl named "ZipCodeService"
|
10
|
+
When I get the information for zip code "44114"
|
11
|
+
And the results doc should be a Nokogiri XML object
|
12
|
+
|
13
|
+
Scenario: Getting a hash from the response
|
14
|
+
Given I use a SoapObject with a remote wsdl named "ZipCodeService"
|
15
|
+
When I get the information for zip code "44114"
|
16
|
+
Then I should be able access the correct response from a hash
|
17
|
+
|
18
|
+
Scenario: Using xpath to parse the response
|
19
|
+
Given I use a SoapObject with a remote wsdl named "ZipCodeService"
|
20
|
+
When I get the information for zip code "44114"
|
21
|
+
Then I should be able access the correct response by xpath
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Given /^I have the url for a remote wsdl$/ do
|
2
|
+
@cls = ZipCodeService
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^I have a wsdl file residing locally$/ do
|
6
|
+
@cls = LocalWsdlService
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /^I use a SoapObject with a remote wsdl named "(.*?)"$/ do |service_class|
|
10
|
+
@cls = Object.const_get(service_class)
|
11
|
+
end
|
12
|
+
|
13
|
+
When /^I create an instance of the SoapObject class$/ do
|
14
|
+
using(@cls)
|
15
|
+
end
|
16
|
+
|
17
|
+
Then /^I should have a connection$/ do
|
18
|
+
expect(using(@cls)).to be_connected
|
19
|
+
end
|
20
|
+
|
21
|
+
Then /^I should be able to determine the operations$/ do
|
22
|
+
operations = using(@cls).operations
|
23
|
+
expect(operations).to include :get_info_by_zip
|
24
|
+
end
|
25
|
+
|
26
|
+
Then /^I should be able to successfully call "(.*?)" with "(.*?)"$/ do |operation, args|
|
27
|
+
using(@cls).send(operation, args)
|
28
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
When(/^I get the information for zip code "([^"]*)"$/) do |zip_code|
|
2
|
+
sleep 0.5 #throttle requests to remote wsdl
|
3
|
+
using(@cls).get_zip_code_info(zip_code)
|
4
|
+
end
|
5
|
+
|
6
|
+
Then /^the results xml should contain "(.*?)"$/ do |xml|
|
7
|
+
using(@cls) do |so|
|
8
|
+
xml_response = so.to_xml
|
9
|
+
expect(xml_response).to be_an_instance_of(String)
|
10
|
+
expect(xml_response).to include xml
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Then /^the results doc should be a Nokogiri XML object$/ do
|
15
|
+
using(@cls) do |so|
|
16
|
+
expect(so.doc).to be_instance_of Nokogiri::XML::Document
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /^I should be able access the correct response from a hash$/ do
|
21
|
+
using(@cls) do |so|
|
22
|
+
expect(so.body).to be_an_instance_of(Hash)
|
23
|
+
expect(so.state).to eq('OH')
|
24
|
+
expect(so.city).to eq('Cleveland')
|
25
|
+
expect(so.area_code).to eq('216')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
Then(/^I should be able access the correct response by xpath$/) do
|
30
|
+
using(@cls) do |so|
|
31
|
+
expect(so.xpath('//Table/STATE').first.text).to eq('OH')
|
32
|
+
expect(so.xpath('//Table/CITY').first.text).to eq('Cleveland')
|
33
|
+
expect(so.xpath('//Table/AREA_CODE').first.text).to eq('216')
|
34
|
+
end
|
35
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
class ZipCodeService
|
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
|
data/lib/soap-object.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'savon'
|
2
|
-
require 'cgi'
|
3
2
|
require 'soap-object/version'
|
4
3
|
require 'soap-object/class_methods'
|
5
4
|
require 'soap-object/ssl_options'
|
6
5
|
require 'soap-object/factory'
|
6
|
+
require 'soap-object/response'
|
7
7
|
|
8
8
|
#
|
9
9
|
# module to make it simpler to tests SOAP web services. The goal is
|
@@ -34,6 +34,8 @@ require 'soap-object/factory'
|
|
34
34
|
# view all of the options.
|
35
35
|
#
|
36
36
|
module SoapObject
|
37
|
+
include Response
|
38
|
+
|
37
39
|
attr_reader :wsdl, :response
|
38
40
|
|
39
41
|
def initialize(platform)
|
@@ -60,61 +62,26 @@ module SoapObject
|
|
60
62
|
@client.operations
|
61
63
|
end
|
62
64
|
|
63
|
-
#
|
64
|
-
# Return the xml response
|
65
|
-
#
|
66
|
-
def to_xml
|
67
|
-
response.to_xml
|
68
|
-
end
|
69
|
-
|
70
|
-
#
|
71
|
-
# Return value at xpath
|
72
|
-
#
|
73
|
-
def xpath(path)
|
74
|
-
response.xpath(path)
|
75
|
-
end
|
76
|
-
|
77
|
-
#
|
78
|
-
# Return the response as a Hash
|
79
|
-
#
|
80
|
-
def to_hash
|
81
|
-
response.hash
|
82
|
-
end
|
83
|
-
|
84
|
-
#
|
85
|
-
# Return the body of the message as a Hash
|
86
|
-
#
|
87
|
-
def body
|
88
|
-
response.body
|
89
|
-
end
|
90
|
-
|
91
|
-
#
|
92
|
-
# Return the response as a Nokogiri document
|
93
|
-
#
|
94
|
-
def doc
|
95
|
-
response.doc
|
96
|
-
end
|
97
|
-
|
98
65
|
private
|
99
66
|
DEFAULT_PROPERTIES = {log: false,
|
100
67
|
ssl_verify_mode: :none,
|
101
68
|
ssl_version: :SSLv3}
|
102
69
|
|
103
|
-
def method_missing(
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
call(operation, {type => message})
|
70
|
+
def method_missing(operation, body)
|
71
|
+
request = build_request(body)
|
72
|
+
@response = @client.call(operation, request)
|
73
|
+
response.to_xml
|
108
74
|
end
|
109
75
|
|
110
|
-
def
|
111
|
-
|
112
|
-
|
76
|
+
def build_request(body)
|
77
|
+
type = body.is_a?(Hash) ? :message : :xml
|
78
|
+
{type => body}
|
113
79
|
end
|
114
80
|
|
115
81
|
def client_properties
|
116
82
|
properties = DEFAULT_PROPERTIES
|
117
83
|
[:with_wsdl,
|
84
|
+
:with_endpoint,
|
118
85
|
:with_proxy,
|
119
86
|
:with_open_timeout,
|
120
87
|
:with_read_timeout,
|
@@ -16,6 +16,18 @@ module SoapObject
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
#
|
20
|
+
# Override the endpoint binding in the WSDL
|
21
|
+
#
|
22
|
+
# @param [String] The target namespace is used to namespace the SOAP message.
|
23
|
+
#
|
24
|
+
def endpoint(url)
|
25
|
+
define_method(:with_endpoint) do
|
26
|
+
{endpoint: url}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
|
19
31
|
#
|
20
32
|
# Set a proxy server to be used. This will be used for retrieving
|
21
33
|
# the wsdl as well as making the remote requests.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module SoapObject
|
2
|
+
module Response
|
3
|
+
|
4
|
+
#
|
5
|
+
# Return the xml response
|
6
|
+
#
|
7
|
+
def to_xml
|
8
|
+
response.to_xml
|
9
|
+
end
|
10
|
+
|
11
|
+
#
|
12
|
+
# Return value at xpath
|
13
|
+
#
|
14
|
+
def xpath(path)
|
15
|
+
response.xpath(path)
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# Return the response as a Hash
|
20
|
+
#
|
21
|
+
def to_hash
|
22
|
+
response.hash
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# Return the body of the message as a Hash
|
27
|
+
#
|
28
|
+
def body
|
29
|
+
response.body
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# Return the response as a Nokogiri document
|
34
|
+
#
|
35
|
+
def doc
|
36
|
+
response.doc
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/soap-object/version.rb
CHANGED
@@ -1,24 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
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
|
-
soap_version 2
|
16
|
-
end
|
17
|
-
|
18
|
-
class WithoutClientProperties
|
19
|
-
include SoapObject
|
20
|
-
end
|
21
|
-
|
22
3
|
describe SoapObject do
|
23
4
|
let(:client) { double('client') }
|
24
5
|
let(:platform) {double('savon')}
|
@@ -41,6 +22,12 @@ describe SoapObject do
|
|
41
22
|
TestSoapObjectWithProperties.new(platform)
|
42
23
|
end
|
43
24
|
|
25
|
+
it 'should allow one to override the endpoint' do
|
26
|
+
expect(platform).to receive(:client).with(hash_including(endpoint: 'https://blah.com'))
|
27
|
+
|
28
|
+
TestSoapObjectWithProperties.new(platform)
|
29
|
+
end
|
30
|
+
|
44
31
|
it 'should allow one to setup a proxy' do
|
45
32
|
expect(platform).to receive(:client).with(hash_including(proxy: 'http://proxy.com:8080'))
|
46
33
|
|
data/spec/lib/factory_spec.rb
CHANGED
@@ -1,15 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
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
3
|
describe SoapObject::Factory do
|
14
4
|
context "when using the factory to create to service" do
|
15
5
|
let(:world) { TestWorld.new }
|
@@ -1,9 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
class WithoutClientProperties
|
4
|
-
include SoapObject
|
5
|
-
end
|
6
|
-
|
7
3
|
describe SoapObject do
|
8
4
|
|
9
5
|
context 'when calling methods on the service' do
|
@@ -13,8 +9,9 @@ describe SoapObject do
|
|
13
9
|
let(:subject) { WithoutClientProperties.new(platform) }
|
14
10
|
|
15
11
|
before do
|
16
|
-
|
17
|
-
|
12
|
+
allow(platform).to receive(:client).and_return(client)
|
13
|
+
allow(client).to receive(:call).with(anything, anything).and_return(response)
|
14
|
+
allow(response).to receive(:to_xml)
|
18
15
|
end
|
19
16
|
|
20
17
|
it 'should make a valid request' do
|
@@ -22,10 +19,19 @@ describe SoapObject do
|
|
22
19
|
subject.fake_call data_key: 'some_value'
|
23
20
|
end
|
24
21
|
|
22
|
+
it 'should return the repsonse as xml' do
|
23
|
+
expected_xml = '<xml><envelope/><data></data></envelope></xml>'
|
24
|
+
expect(response).to receive(:to_xml).and_return(expected_xml)
|
25
|
+
response = subject.fake_call data_key: 'some_value'
|
26
|
+
expect(response).to eq(expected_xml)
|
27
|
+
end
|
28
|
+
|
25
29
|
it 'should make a valid request with custom xml' do
|
26
30
|
expected_xml = '<xml><envelope/><data></data></envelope></xml>'
|
27
|
-
expect(client).to receive(:call).with(
|
31
|
+
expect(client).to receive(:call).with(:fake_call, xml: expected_xml).and_return(response)
|
28
32
|
subject.fake_call expected_xml
|
29
33
|
end
|
34
|
+
|
35
|
+
|
30
36
|
end
|
31
37
|
end
|
@@ -1,15 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
class WithSslOptions
|
4
|
-
include SoapObject
|
5
|
-
|
6
|
-
ssl_options do |opts|
|
7
|
-
opts.verify_mode = :peer
|
8
|
-
opts.version = :SSLv2
|
9
|
-
end
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
3
|
describe SoapObject do
|
14
4
|
let(:client) { double('client') }
|
15
5
|
let(:platform) {double('savon')}
|
data/spec/spec_helper.rb
CHANGED
@@ -4,3 +4,42 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
4
4
|
require 'rspec'
|
5
5
|
require 'soap-object'
|
6
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,13 +72,19 @@ 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
|
82
88
|
- lib/soap-object/ssl_options.rb
|
83
89
|
- lib/soap-object/version.rb
|
84
90
|
- soap-object.gemspec
|
@@ -90,30 +96,35 @@ files:
|
|
90
96
|
homepage: http://github.com/cheezy/soap-object
|
91
97
|
licenses: []
|
92
98
|
metadata: {}
|
93
|
-
post_install_message:
|
99
|
+
post_install_message:
|
94
100
|
rdoc_options: []
|
95
101
|
require_paths:
|
96
102
|
- lib
|
97
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
104
|
requirements:
|
99
|
-
- -
|
105
|
+
- - ">="
|
100
106
|
- !ruby/object:Gem::Version
|
101
107
|
version: '0'
|
102
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
109
|
requirements:
|
104
|
-
- -
|
110
|
+
- - ">="
|
105
111
|
- !ruby/object:Gem::Version
|
106
112
|
version: '0'
|
107
113
|
requirements: []
|
108
|
-
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
110
|
-
signing_key:
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.6.14.1
|
116
|
+
signing_key:
|
111
117
|
specification_version: 4
|
112
118
|
summary: Wrapper around SOAP service calls to make it easy to test
|
113
119
|
test_files:
|
114
|
-
- features/
|
115
|
-
- 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
|
116
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
|
117
128
|
- features/wsdl/uszip.asmx.wsdl.xml
|
118
129
|
- spec/lib/client_options_spec.rb
|
119
130
|
- spec/lib/factory_spec.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(Savon)
|
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
|