savon 2.11.2 → 2.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/CHANGELOG.md +103 -73
- data/CONTRIBUTING.md +15 -19
- data/Gemfile +2 -7
- data/README.md +26 -15
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
- data/coverage/assets/0.12.3/application.css +1 -0
- data/coverage/assets/0.12.3/application.js +7 -0
- data/coverage/assets/0.12.3/colorbox/border.png +0 -0
- data/coverage/assets/0.12.3/colorbox/controls.png +0 -0
- data/coverage/assets/0.12.3/colorbox/loading.gif +0 -0
- data/coverage/assets/0.12.3/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.12.3/favicon_green.png +0 -0
- data/coverage/assets/0.12.3/favicon_red.png +0 -0
- data/coverage/assets/0.12.3/favicon_yellow.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/assets/0.12.3/loading.gif +0 -0
- data/coverage/assets/0.12.3/magnify.png +0 -0
- data/coverage/index.html +21518 -0
- data/lib/savon/block_interface.rb +1 -0
- data/lib/savon/builder.rb +95 -29
- data/lib/savon/client.rb +1 -0
- data/lib/savon/core_ext/string.rb +1 -0
- data/lib/savon/header.rb +2 -6
- data/lib/savon/http_error.rb +4 -4
- data/lib/savon/log_message.rb +1 -0
- data/lib/savon/message.rb +1 -0
- data/lib/savon/mock/expectation.rb +1 -0
- data/lib/savon/mock/spec_helper.rb +1 -0
- data/lib/savon/mock.rb +1 -0
- data/lib/savon/model.rb +1 -0
- data/lib/savon/operation.rb +20 -18
- data/lib/savon/options.rb +70 -1
- data/lib/savon/qualified_message.rb +5 -4
- data/lib/savon/request.rb +18 -3
- data/lib/savon/request_logger.rb +8 -2
- data/lib/savon/response.rb +49 -2
- data/lib/savon/soap_fault.rb +2 -3
- data/lib/savon/version.rb +2 -1
- data/lib/savon.rb +1 -0
- data/savon.gemspec +10 -9
- data/spec/fixtures/response/empty_soap_fault.xml +13 -0
- data/spec/fixtures/response/no_body.xml +1 -0
- data/spec/fixtures/wsdl/elements_in_types.xml +43 -0
- data/spec/integration/support/application.rb +34 -2
- data/spec/integration/support/server.rb +1 -0
- data/spec/integration/zipcode_example_spec.rb +5 -8
- data/spec/savon/builder_spec.rb +2 -1
- data/spec/savon/client_spec.rb +5 -4
- data/spec/savon/core_ext/string_spec.rb +2 -1
- data/spec/savon/features/message_tag_spec.rb +2 -1
- data/spec/savon/http_error_spec.rb +9 -1
- data/spec/savon/log_message_spec.rb +2 -1
- data/spec/savon/message_spec.rb +2 -11
- data/spec/savon/mock_spec.rb +2 -1
- data/spec/savon/model_spec.rb +2 -1
- data/spec/savon/multipart_request_spec.rb +46 -0
- data/spec/savon/observers_spec.rb +2 -1
- data/spec/savon/operation_spec.rb +20 -43
- data/spec/savon/options_spec.rb +84 -5
- data/spec/savon/qualified_message_spec.rb +35 -1
- data/spec/savon/request_logger_spec.rb +2 -1
- data/spec/savon/request_spec.rb +99 -14
- data/spec/savon/response_spec.rb +7 -1
- data/spec/savon/soap_fault_spec.rb +12 -1
- data/spec/savon/softlayer_spec.rb +3 -2
- data/spec/spec_helper.rb +5 -4
- data/spec/support/adapters.rb +1 -0
- data/spec/support/endpoint.rb +1 -0
- data/spec/support/fixture.rb +1 -0
- data/spec/support/integration.rb +2 -1
- data/spec/support/stdout.rb +1 -0
- metadata +86 -33
- data/.travis.yml +0 -19
- data/donate.png +0 -0
- data/spec/integration/centra_spec.rb +0 -66
- data/spec/integration/email_example_spec.rb +0 -32
- data/spec/integration/random_quote_spec.rb +0 -23
- data/spec/integration/ratp_example_spec.rb +0 -28
- data/spec/integration/stockquote_example_spec.rb +0 -34
- data/spec/integration/temperature_example_spec.rb +0 -46
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module LogInterceptor
|
4
|
-
@@intercepted_request = ""
|
5
|
-
def self.debug(message)
|
6
|
-
# save only the first XMLly message
|
7
|
-
if message.include? "xml version"
|
8
|
-
@@intercepted_request = message if @@intercepted_request == ""
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.info(message)
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.get_intercepted_request
|
16
|
-
@@intercepted_request
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.reset_intercepted_request
|
20
|
-
@@intercepted_request = ""
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe 'Correct translation of attributes to XML' do
|
25
|
-
it "new :@attr syntax: correctly maps a Ruby Hash to XML attributes" do
|
26
|
-
LogInterceptor.reset_intercepted_request
|
27
|
-
|
28
|
-
client = Savon.client(
|
29
|
-
:wsdl => "http://mt205.sabameeting.com/CWS/CWS.asmx?WSDL",
|
30
|
-
:logger => LogInterceptor
|
31
|
-
)
|
32
|
-
|
33
|
-
response = nil
|
34
|
-
begin
|
35
|
-
response = call_and_fail_gracefully(client, :add_new_user, :message => { :user => { :@userID => "test" } })
|
36
|
-
rescue
|
37
|
-
end
|
38
|
-
|
39
|
-
xml_doc = Nokogiri::XML(LogInterceptor.get_intercepted_request)
|
40
|
-
xml_doc.remove_namespaces!
|
41
|
-
|
42
|
-
attributes_element_not_present = xml_doc.xpath("//AddNewUser/attributes").blank?
|
43
|
-
expect(attributes_element_not_present).to eq true
|
44
|
-
end
|
45
|
-
|
46
|
-
it "old :attributes! syntax: correctly maps a Ruby Hash to XML attributes" do
|
47
|
-
LogInterceptor.reset_intercepted_request
|
48
|
-
|
49
|
-
client = Savon.client(
|
50
|
-
:wsdl => "http://mt205.sabameeting.com/CWS/CWS.asmx?WSDL",
|
51
|
-
:logger => LogInterceptor
|
52
|
-
)
|
53
|
-
|
54
|
-
response = nil
|
55
|
-
begin
|
56
|
-
response = call_and_fail_gracefully(client, :add_new_user, :message => { :user => {}, :attributes! => { :user => { :userID => "test" } } })
|
57
|
-
rescue
|
58
|
-
end
|
59
|
-
|
60
|
-
xml_doc = Nokogiri::XML(LogInterceptor.get_intercepted_request)
|
61
|
-
xml_doc.remove_namespaces!
|
62
|
-
|
63
|
-
attributes_element_not_present = xml_doc.xpath("//AddNewUser/attributes").blank?
|
64
|
-
expect(attributes_element_not_present).to eq true
|
65
|
-
end
|
66
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Email example" do
|
4
|
-
|
5
|
-
it "passes Strings as they are" do
|
6
|
-
client = Savon.client(
|
7
|
-
# The WSDL document provided by the service.
|
8
|
-
:wsdl => "http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx?wsdl",
|
9
|
-
|
10
|
-
# Lower timeouts so these specs don't take forever when the service is not available.
|
11
|
-
:open_timeout => 10,
|
12
|
-
:read_timeout => 10,
|
13
|
-
|
14
|
-
# Disable logging for cleaner spec output.
|
15
|
-
:log => false
|
16
|
-
)
|
17
|
-
|
18
|
-
response = call_and_fail_gracefully(client, :verify_email, :message => { :email => "soap@example.com", "LicenseKey" => "?" })
|
19
|
-
|
20
|
-
response_text = response.body[:verify_email_response][:verify_email_result][:response_text]
|
21
|
-
|
22
|
-
if response_text == "Current license key only allows so many checks"
|
23
|
-
# Fallback to not fail the specs when the service's API limit is reached,
|
24
|
-
# but to mark the spec as pending instead.
|
25
|
-
pending "API limit exceeded"
|
26
|
-
else
|
27
|
-
# The expected result. We unfortunately don't have a license key for this service.
|
28
|
-
expect(response_text).to eq("Email Domain Not Found")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'rpc/encoded binding test' do
|
4
|
-
|
5
|
-
it 'should should work with WSDLs that have rpc/encoded SOAP binding' do
|
6
|
-
client = Savon.client(
|
7
|
-
:wsdl => "http://www.boyzoid.com/comp/randomQuote.cfc?wsdl",
|
8
|
-
:open_timeout => 10,
|
9
|
-
:read_timeout => 10,
|
10
|
-
:log => false
|
11
|
-
)
|
12
|
-
|
13
|
-
begin
|
14
|
-
client.call(:get_quote)
|
15
|
-
rescue Savon::SOAPFault => e
|
16
|
-
$stderr.puts e.to_hash.inspect
|
17
|
-
f_c = e.to_hash[:fault][:faultstring]
|
18
|
-
expect(f_c).not_to eq('No such operation \'getQuoteRequest\'')
|
19
|
-
expect(f_c).to eq('lucee.runtime.exp.DatabaseException: ')
|
20
|
-
pending e
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "RATP example" do
|
4
|
-
|
5
|
-
it "retrieves information about a specific station" do
|
6
|
-
client = Savon.client do
|
7
|
-
# The WSDL document provided by the service.
|
8
|
-
wsdl "http://www.ratp.fr/wsiv/services/Wsiv?wsdl"
|
9
|
-
|
10
|
-
# Lower timeouts so these specs don't take forever when the service is not available.
|
11
|
-
open_timeout 10
|
12
|
-
read_timeout 10
|
13
|
-
|
14
|
-
# Disable logging for cleaner spec output.
|
15
|
-
log false
|
16
|
-
end
|
17
|
-
|
18
|
-
# XXX: the service seems to rely on the order of arguments.
|
19
|
-
# try to fix this with the new wsdl parser.
|
20
|
-
response = call_and_fail_gracefully(client, :get_stations) do
|
21
|
-
message(:station => { :id => 1975 }, :limit => 1)
|
22
|
-
end
|
23
|
-
|
24
|
-
station_name = response.body[:get_stations_response][:return][:stations][:name]
|
25
|
-
expect(station_name).to eq("Cite")
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Stockquote example" do
|
4
|
-
|
5
|
-
it "returns the result in a CDATA tag" do
|
6
|
-
client = Savon.client(
|
7
|
-
# The WSDL document provided by the service.
|
8
|
-
:wsdl => "http://www.webservicex.net/stockquote.asmx?WSDL",
|
9
|
-
|
10
|
-
# Lower timeouts so these specs don't take forever when the service is not available.
|
11
|
-
:open_timeout => 10,
|
12
|
-
:read_timeout => 10,
|
13
|
-
|
14
|
-
# Disable logging for cleaner spec output.
|
15
|
-
:log => false
|
16
|
-
)
|
17
|
-
|
18
|
-
response = call_and_fail_gracefully(client, :get_quote, :message => { :symbol => "AAPL" })
|
19
|
-
|
20
|
-
cdata = response.body[:get_quote_response][:get_quote_result]
|
21
|
-
|
22
|
-
if cdata == "exception"
|
23
|
-
# Fallback to not fail the specs when the service's API limit is reached,
|
24
|
-
# but to mark the spec as pending instead.
|
25
|
-
pending "Exception on API"
|
26
|
-
end
|
27
|
-
|
28
|
-
nori_options = { :convert_tags_to => lambda { |tag| tag.snakecase.to_sym } }
|
29
|
-
result = Nori.new(nori_options).parse(cdata)
|
30
|
-
|
31
|
-
expect(result[:stock_quotes][:stock][:symbol]).to eq("AAPL")
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Temperature example" do
|
4
|
-
|
5
|
-
it "converts 30 degrees celsius to 86 degrees fahrenheit" do
|
6
|
-
client = Savon.client do
|
7
|
-
# The WSDL document provided by the service.
|
8
|
-
wsdl "http://www.webservicex.net/ConvertTemperature.asmx?WSDL"
|
9
|
-
|
10
|
-
# Needed because (up until now), Savon doesn't match XS types to Hash keys,
|
11
|
-
# but defaults to convert Hash message Symbols (like :from_unit) to lowerCamelCase.
|
12
|
-
# The service expects these to be CamelCase instead. Look at Savon's log output
|
13
|
-
# and compare it with an example request generated by soapUI.
|
14
|
-
convert_request_keys_to :camelcase
|
15
|
-
|
16
|
-
# Lower timeouts so these specs don't take forever when the service is not available.
|
17
|
-
open_timeout 10
|
18
|
-
read_timeout 10
|
19
|
-
|
20
|
-
# Disable logging for cleaner spec output.
|
21
|
-
log false
|
22
|
-
end
|
23
|
-
|
24
|
-
response = call_and_fail_gracefully(client, :convert_temp) do
|
25
|
-
# For the corrent values to pass for :from_unit and :to_unit, I searched the WSDL for
|
26
|
-
# the "FromUnit" type which is a "TemperatureUnit" enumeration that looks like this:
|
27
|
-
#
|
28
|
-
# <s:simpleType name="TemperatureUnit">
|
29
|
-
# <s:restriction base="s:string">
|
30
|
-
# <s:enumeration value="degreeCelsius"/>
|
31
|
-
# <s:enumeration value="degreeFahrenheit"/>
|
32
|
-
# <s:enumeration value="degreeRankine"/>
|
33
|
-
# <s:enumeration value="degreeReaumur"/>
|
34
|
-
# <s:enumeration value="kelvin"/>
|
35
|
-
# </s:restriction>
|
36
|
-
# </s:simpleType>
|
37
|
-
#
|
38
|
-
# Support for XS schema types needs to be improved.
|
39
|
-
message(:temperature => 30, :from_unit => "degreeCelsius", :to_unit => "degreeFahrenheit")
|
40
|
-
end
|
41
|
-
|
42
|
-
fahrenheit = response.body[:convert_temp_response][:convert_temp_result]
|
43
|
-
expect(fahrenheit).to eq("86")
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|