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
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NzMwMWY4Zjk4MmZlMTA5NGVmNDUyNWFkNWJlMzJlZDM3MmQ3NDI5Mw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c671cc72ababce59652396a4576c798e29b0a69a
|
4
|
+
data.tar.gz: 13de68c610f9ec82da27ed29c52de2a51fa51471
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MzJlOWQ2NzkxYzI2OTlhMThjOTgwYzJhNDU1OTI3NWE1YWQ5NjQ3NmEwMWRl
|
11
|
-
N2UwYmMyY2I4NGFlMTA3NjY4YmYwNjU3MDU4NTM0NjUwNTJjMjk=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZWU0MTQ5YWRkYjFmYjk1YmMxY2M5MjFjNDFlMDQ3MWEzMWQwMjNhMWYyOGNk
|
14
|
-
NjI3NmRlMDc5MDZjMmI2MDE0ZjZjYmU2ZDQzZWRhZWE4Nzc2MGZjYjUzOTll
|
15
|
-
M2ZiZmFiYzY2NjQxMjZkODkwOWUwNWFhNTgzMzA4NzM3ZDJiN2M=
|
6
|
+
metadata.gz: 8d276efccddab68a8a49f92905bc083324d398a46c655132c13e14fc60bb7d7d7aa275f95ca80922e47cef1d1e6fbe99362272c49925ecc4be3c21cdc34d30d0
|
7
|
+
data.tar.gz: c7d57dac679b88423f18f092a834c1dc9e6c17ae898f9b7cfe863f37e2a1a2aaf0bbbeef35661bb6bc07f5796f1c755b42176443ec65b6bc13f9988d0e2ff664
|
data/.gitignore
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.swp
|
19
|
-
TAGS
|
20
|
-
.idea/
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.swp
|
19
|
+
TAGS
|
20
|
+
.idea/
|
21
|
+
.DS_Store
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--color
|
1
|
+
--color
|
2
2
|
--format doc
|
data/.ruby-gemset
CHANGED
@@ -1 +1 @@
|
|
1
|
-
soap-object
|
1
|
+
soap-object
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.0.0-
|
1
|
+
ruby-2.0.0-p643
|
data/ChangeLog
CHANGED
@@ -1,50 +1,66 @@
|
|
1
|
-
=== Version 0.6.
|
2
|
-
*
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
*
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
*
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
*
|
15
|
-
* Added ability to
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
*
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
*
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
* Added
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
*
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
*
|
43
|
-
* Added
|
44
|
-
* Added
|
45
|
-
*
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
1
|
+
=== Version 0.6.7 / 2015-10-24
|
2
|
+
* Cleanup
|
3
|
+
|
4
|
+
=== Version 0.6.6 / 2015-10-24
|
5
|
+
* Enhancements
|
6
|
+
* Added ssl_options method.
|
7
|
+
|
8
|
+
=== Version 0.6.5 / 2015-6-3
|
9
|
+
* Enhancements
|
10
|
+
* Added ability to set soap version
|
11
|
+
|
12
|
+
=== Version 0.6.4 / 2015-4-22
|
13
|
+
* Enhancements
|
14
|
+
* SSL version is :SSLv3 by default
|
15
|
+
* Added ability to set SSL version.
|
16
|
+
|
17
|
+
=== Version 0.6.3 / 2015-3-26
|
18
|
+
* Enhancements
|
19
|
+
* Added ability to disable ssl verification
|
20
|
+
|
21
|
+
=== Version 0.6.2 / 2015-3-12
|
22
|
+
* Enhancements
|
23
|
+
* Calling xpath on Savon response, to take advantage of namespace collecting from response.
|
24
|
+
|
25
|
+
=== Version 0.6.1 / 2015-3-12
|
26
|
+
* Enhancements
|
27
|
+
* Added xpath method to return to allow user to access path directly
|
28
|
+
|
29
|
+
=== Version 0.6 / 2014-12-22
|
30
|
+
* Enhancements
|
31
|
+
* Added ability to call operation with hand rolled xml
|
32
|
+
* Disabled logging by default, setting log_level enables it
|
33
|
+
|
34
|
+
=== Version 0.5.1 / 2013-6-1
|
35
|
+
* Enhancements
|
36
|
+
* Added body method to return the body of the result as a Hash
|
37
|
+
|
38
|
+
=== Version 0.5 / 2013-6-1
|
39
|
+
* Enhancements
|
40
|
+
* Removed the body accessor
|
41
|
+
* Removed the body_xml method
|
42
|
+
* Added to_xml method to return the response as a String containing the XML
|
43
|
+
* Added to_hash method to return the respons as a Hash
|
44
|
+
* Added doc method to return response as a Nokogiri::XML::Document document
|
45
|
+
* Updated method_missing so when services methods are called the raw XML is returned
|
46
|
+
|
47
|
+
=== Version 0.4 / 2013-3-18
|
48
|
+
* Enhancements
|
49
|
+
* Added body accessor to SoapObject to return raw body
|
50
|
+
* Added body_xml method to SoapObject to return Nokogiri::XML::Document containing body
|
51
|
+
|
52
|
+
=== Version 0.3 / 2013-3-17
|
53
|
+
* Enhancements
|
54
|
+
* Added SoapObject::Factory to assist in creating new service objects
|
55
|
+
* Added accessor for @response
|
56
|
+
|
57
|
+
=== Version 0.2 / 2013-3-11
|
58
|
+
* Enhancements
|
59
|
+
* Added ability to add XML to the soap header
|
60
|
+
* Added ability to set the encoding for the messages
|
61
|
+
* Added ability to use basic authentication
|
62
|
+
* Added ability to use digest authentication
|
63
|
+
* Added ability to set the log level
|
64
|
+
|
65
|
+
=== Version 0.1 / 2013-3-4
|
66
|
+
Initial release
|
data/Gemfile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in soap-object.gemspec
|
4
|
-
|
5
|
-
gem 'rake'
|
6
|
-
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
|
7
|
-
gem 'growl'
|
8
|
-
gem 'guard-rspec'
|
9
|
-
gem 'guard-cucumber'
|
10
|
-
|
11
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in soap-object.gemspec
|
4
|
+
|
5
|
+
gem 'rake'
|
6
|
+
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
|
7
|
+
gem 'growl'
|
8
|
+
gem 'guard-rspec'
|
9
|
+
gem 'guard-cucumber'
|
10
|
+
|
11
|
+
gemspec
|
data/Guardfile
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
|
4
|
-
guard 'rspec', :cli => '--color --format doc' do
|
5
|
-
watch(%r{^spec/.+_spec\.rb$})
|
6
|
-
watch(%r{^lib/(.+)\.rb$}) { "spec" }
|
7
|
-
watch('spec/spec_helper.rb') { "spec" }
|
8
|
-
end
|
9
|
-
|
10
|
-
|
11
|
-
guard 'cucumber', :notification => true, :all_after_pass => false, :cli => '--profile focus' do
|
12
|
-
watch(%r{^features/.+\.feature$})
|
13
|
-
watch(%r{^features/support/.+$}) { 'features' }
|
14
|
-
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
15
|
-
watch(%r{^lib/.+\.rb$}) { "features" }
|
16
|
-
watch(%r{^cucumber.yml$}) { "features" }
|
17
|
-
end
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :cli => '--color --format doc' do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { "spec" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
guard 'cucumber', :notification => true, :all_after_pass => false, :cli => '--profile focus' do
|
12
|
+
watch(%r{^features/.+\.feature$})
|
13
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
14
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
15
|
+
watch(%r{^lib/.+\.rb$}) { "features" }
|
16
|
+
watch(%r{^cucumber.yml$}) { "features" }
|
17
|
+
end
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2013 Jeffrey S. Morgan
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
1
|
+
Copyright (c) 2013 Jeffrey S. Morgan
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,42 +1,131 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
Module to make it simpler to tests SOAP web services. The goal is
|
4
|
-
to abstract all information about how your call and parse results
|
5
|
-
from the web service within the soap objects.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
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
|
-
|
1
|
+
# SoapObject
|
2
|
+
|
3
|
+
Module to make it simpler to tests SOAP web services. The goal is
|
4
|
+
to abstract all information about how your call and parse results
|
5
|
+
from the web service within the soap objects.
|
6
|
+
|
7
|
+
## Defining a soap-object
|
8
|
+
|
9
|
+
````ruby
|
10
|
+
class AirportService
|
11
|
+
include SoapObject
|
12
|
+
|
13
|
+
wsdl 'http://www.webservicex.net/airport.asmx?WSDL'
|
14
|
+
|
15
|
+
def airport_name
|
16
|
+
xpath('//Table/CityOrAirportName').first.content
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
````
|
21
|
+
|
22
|
+
#### Client Properties
|
23
|
+
|
24
|
+
By default, the following properties are set on the Savon::Client:
|
25
|
+
|
26
|
+
````ruby
|
27
|
+
log: false
|
28
|
+
ssl_verify_mode: :none
|
29
|
+
ssl_version: :SSLv3
|
30
|
+
````
|
31
|
+
|
32
|
+
The following methods are available to set client properties:
|
33
|
+
|
34
|
+
````ruby
|
35
|
+
proxy 'http://proxy.com:8080'
|
36
|
+
open_timeout 10
|
37
|
+
read_timeout 20
|
38
|
+
soap_header 'Token' => 'secret'
|
39
|
+
encoding 'UTF-16'
|
40
|
+
basic_auth 'steve', 'secret'
|
41
|
+
digest_auth 'digest', 'auth'
|
42
|
+
log_level :error
|
43
|
+
soap_version 2
|
44
|
+
|
45
|
+
ssl_options do |opts|
|
46
|
+
opts.verify_mode = :peer
|
47
|
+
opts.version = :SSLv2
|
48
|
+
end
|
49
|
+
````
|
50
|
+
|
51
|
+
## Usage
|
52
|
+
|
53
|
+
````ruby
|
54
|
+
require 'soap-object'
|
55
|
+
|
56
|
+
service = AirportService.new
|
57
|
+
|
58
|
+
service.operations
|
59
|
+
#=> [:get_airport_information_by_iso_country_code,
|
60
|
+
# :get_airport_information_by_city_or_airport_name,
|
61
|
+
# :get_airport_information_by_country,
|
62
|
+
# :get_airport_information_by_airport_code]
|
63
|
+
|
64
|
+
service.get_airport_information_by_airport_code
|
65
|
+
#=> <Savon::Response>
|
66
|
+
|
67
|
+
````
|
68
|
+
|
69
|
+
By default soap-object attempts to handle any missing method call by passing it through to the underlying Savon client. This enable the soap-object to handle calls to all operations on a given WSDL.
|
70
|
+
|
71
|
+
|
72
|
+
## Using with Cucumber
|
73
|
+
|
74
|
+
Include the factory methods by placing the following line in the cucumber env.rb file.
|
75
|
+
|
76
|
+
````ruby
|
77
|
+
World(SoapObject::Factory)
|
78
|
+
````
|
79
|
+
By doing so, soap-object's methods are available in cucumbers step definitions.
|
80
|
+
|
81
|
+
````ruby
|
82
|
+
When(/^I request the airport information for "([^"]*)"$/) do |airport_code|
|
83
|
+
using(AirportService).get_airport_information_by_airport_code({airport_code: airport_code})
|
84
|
+
end
|
85
|
+
|
86
|
+
Then(/^the airport name should be "([^"]*)"$/) do |airport_name|
|
87
|
+
expect(using(AirportService).airport_name).to be eq(airport_name)
|
88
|
+
end
|
89
|
+
````
|
90
|
+
|
91
|
+
## Parsing the response
|
92
|
+
|
93
|
+
Several methods exists on the soap-object to help parse the response.
|
94
|
+
|
95
|
+
Return the xml response
|
96
|
+
- to_xml
|
97
|
+
|
98
|
+
Return value at a specific path using xpath
|
99
|
+
- xpath(path)
|
100
|
+
|
101
|
+
Return the response as a Hash
|
102
|
+
- to_hash
|
103
|
+
|
104
|
+
Return the body of the message as a Hash
|
105
|
+
- body
|
106
|
+
|
107
|
+
Return the response as a Nokogiri document
|
108
|
+
- doc
|
109
|
+
|
110
|
+
## Installation
|
111
|
+
|
112
|
+
Add this line to your application's Gemfile:
|
113
|
+
|
114
|
+
gem 'soap-object'
|
115
|
+
|
116
|
+
And then execute:
|
117
|
+
|
118
|
+
$ bundle
|
119
|
+
|
120
|
+
Or install it yourself as:
|
121
|
+
|
122
|
+
$ gem install soap-object
|
123
|
+
|
124
|
+
|
125
|
+
## Contributing
|
126
|
+
|
127
|
+
1. Fork it
|
128
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
129
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
130
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
131
|
+
5. Create new Pull Request
|