savon 2.8.1 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 379ca76fcbfd623cc2e02ff387233fd764e50fdf
4
- data.tar.gz: 2a2ff2a7c89ac4d5da0d62196388b49514bc3eeb
3
+ metadata.gz: 85eee2aa2cf1a1c2130cf5c50c453ef5dec838c3
4
+ data.tar.gz: bb9aa1c1c8e3cff15b8bbb4ca24a3d8b0764814a
5
5
  SHA512:
6
- metadata.gz: b5a27414b2371f54d7d7ccc7c92ca360bba02bee470c6274af9491aae939229ad15e4997415818d3b2947503bcdc79c1d6c7fc3860019195ef5e85589ab1edd1
7
- data.tar.gz: 55804add86b33a9bddac6cdf6383bc7f89025eaf4fdcee9d43ccd0aaa21295a39932b98eae75b111c86882c26e916eea8693aea1e7f7015cb22c815b8ba13374
6
+ metadata.gz: 0681726a8f75c5ea133b98bdf2ac582e9af225677b643a20dbf0832cbd2458fce15a6c409d42691dbeffc97cdb15f6451dece2d60b5dcf8d2b3c4d5801de555c
7
+ data.tar.gz: 09cf940fcb8e9e8b669967eac9daa31f14ccfb633a1679af94aec21856be2fccd329018fc549014a7a9bded9fabb396393adf4e0c6c526c9e9c844613546f506
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 2.9.0 (2015-01-29)
2
+
3
+ * Feature: [#655] Wasabi exceptions should be rethrown as Savon errors. This should make it easier to catch errors thrown by Savon::Client.
4
+ * Feature: [#630] ServiceFaults are correctly identified as Soap Faults.
5
+
1
6
  # 2.8.0 (2014-11-12)
2
7
 
3
8
  * Feature : [#620](https://github.com/savonrb/savon/pull/620) add #build_request method that builds the actual XML request body, but does not submit it. Useful for debugging, possibly.
@@ -4,6 +4,7 @@ require "savon/request"
4
4
  require "savon/builder"
5
5
  require "savon/response"
6
6
  require "savon/request_logger"
7
+ require "savon/http_error"
7
8
 
8
9
  module Savon
9
10
  class Operation
@@ -22,6 +23,8 @@ module Savon
22
23
  raise UnknownOperationError, "Unable to find SOAP operation: #{operation_name.inspect}\n" \
23
24
  "Operations provided by your service: #{wsdl.soap_actions.inspect}"
24
25
  end
26
+ rescue Wasabi::Resolver::HTTPError => e
27
+ raise HTTPError.new(e.response)
25
28
  end
26
29
 
27
30
  def self.ensure_name_is_symbol!(operation_name)
@@ -21,7 +21,7 @@ module Savon
21
21
  attr_reader :http, :nori, :xml
22
22
 
23
23
  def to_s
24
- fault = nori.find(to_hash, 'Fault')
24
+ fault = nori.find(to_hash, 'Fault') || nori.find(to_hash, 'ServiceFault')
25
25
  message_by_version(fault)
26
26
  end
27
27
 
data/lib/savon/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Savon
2
- VERSION = '2.8.1'
2
+ VERSION = '2.9.0'
3
3
  end
@@ -0,0 +1,8 @@
1
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
2
+ <soap:Body>
3
+ <soap:ServiceFault>
4
+ <faultcode>42</faultcode>
5
+ <faultstring>The Answer to Life The Universe And Everything</faultstring>
6
+ </soap:ServiceFault>
7
+ </soap:Body>
8
+ </soap:Envelope>
@@ -40,12 +40,9 @@ describe 'Correct translation of attributes to XML' do
40
40
  xml_doc.remove_namespaces!
41
41
 
42
42
  attributes_element_not_present = xml_doc.xpath("//AddNewUser/attributes").blank?
43
-
44
- puts "new syntax: attributes element not present: " + attributes_element_not_present.to_s
45
-
46
43
  expect(attributes_element_not_present).to eq true
47
44
  end
48
-
45
+
49
46
  it "old :attributes! syntax: correctly maps a Ruby Hash to XML attributes" do
50
47
  LogInterceptor.reset_intercepted_request
51
48
 
@@ -64,9 +61,6 @@ describe 'Correct translation of attributes to XML' do
64
61
  xml_doc.remove_namespaces!
65
62
 
66
63
  attributes_element_not_present = xml_doc.xpath("//AddNewUser/attributes").blank?
67
-
68
- puts "new syntax: attributes element not present: " + attributes_element_not_present.to_s
69
-
70
64
  expect(attributes_element_not_present).to eq true
71
65
  end
72
66
  end
@@ -44,6 +44,16 @@ describe Savon::Operation do
44
44
  expect { new_operation(:no_such_operation, wsdl, globals) }.
45
45
  to raise_error(Savon::UnknownOperationError, /Unable to find SOAP operation: :no_such_operation/)
46
46
  end
47
+
48
+ it "raises if the endpoint cannot be reached" do
49
+ message = "Error!"
50
+ response = HTTPI::Response.new(500, {}, message)
51
+ error = Wasabi::Resolver::HTTPError.new(message, response)
52
+ Wasabi::Document.any_instance.stubs(:soap_actions).raises(error)
53
+
54
+ expect { new_operation(:verify_address, wsdl, globals) }.
55
+ to raise_error(Savon::HTTPError, /#{message}/)
56
+ end
47
57
  end
48
58
 
49
59
  describe ".create without a WSDL" do
@@ -3,6 +3,7 @@ require "spec_helper"
3
3
  describe Savon::SOAPFault do
4
4
  let(:soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault)), nori }
5
5
  let(:soap_fault2) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault12)), nori }
6
+ let(:soap_fault_funky) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault_funky)), nori }
6
7
  let(:soap_fault_nc) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault)), nori_no_convert }
7
8
  let(:soap_fault_nc2) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault12)), nori_no_convert }
8
9
  let(:another_soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:another_soap_fault)), nori }
@@ -63,6 +64,10 @@ describe Savon::SOAPFault do
63
64
  it "works even if the keys are different in a SOAP 1.2 fault message" do
64
65
  expect(soap_fault_nc2.send method).to eq("(soap:Sender) Sender Timeout")
65
66
  end
67
+
68
+ it "works even if the keys are different in a funky SOAP fault message" do
69
+ expect(soap_fault_funky.send method).to eq("(42) The Answer to Life The Universe And Everything")
70
+ end
66
71
  end
67
72
  end
68
73
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: savon
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.1
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Harrington
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-15 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nori
@@ -253,6 +253,7 @@ files:
253
253
  - spec/fixtures/response/multi_ref.xml
254
254
  - spec/fixtures/response/soap_fault.xml
255
255
  - spec/fixtures/response/soap_fault12.xml
256
+ - spec/fixtures/response/soap_fault_funky.xml
256
257
  - spec/fixtures/response/taxcloud.xml
257
258
  - spec/fixtures/ssl/client_cert.pem
258
259
  - spec/fixtures/ssl/client_encrypted_key.pem