smacks-savon 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -23,8 +23,8 @@ Instantiate a new Savon::Service instance passing in the WSDL of your service.
23
23
 
24
24
  proxy = Savon::Service.new "http://example.com/ExampleService?wsdl"
25
25
 
26
- Call the SOAP service method you would like to choose on your Savon::Service
27
- instance passing in a Hash of options for the service method to receive.
26
+ Call the SOAP service method of your choice on your Savon::Service instance
27
+ passing in a Hash of options for the service method to receive.
28
28
 
29
29
  response = proxy.findExampleById(:id => 123)
30
30
 
@@ -41,12 +41,12 @@ instance to get a list of available SOAP service methods.
41
41
  Check if the SOAP request was successful.
42
42
 
43
43
  response.success?
44
- response.fault?
44
+ response.error?
45
45
 
46
- Access the fault message and code.
46
+ Access error message and code in case a request was not successful.
47
47
 
48
- response.fault
49
- response.fault_code
48
+ response.error_message
49
+ response.error_code
50
50
 
51
51
  === Different response formats
52
52
 
@@ -7,11 +7,11 @@ module Savon
7
7
  # Savon::Response represents the HTTP response.
8
8
  class Response
9
9
 
10
- # The HTTP or SOAP fault message.
11
- attr_reader :fault
10
+ # The HTTP error or SOAP fault message.
11
+ attr_reader :error_message
12
12
 
13
- # The HTTP or SOAP fault code.
14
- attr_reader :fault_code
13
+ # The HTTP error or SOAP fault code.
14
+ attr_reader :error_code
15
15
 
16
16
  # Initializer expects the HTTP response and checks for HTTP or SOAP faults.
17
17
  #
@@ -25,12 +25,12 @@ module Savon
25
25
 
26
26
  # Returns true if the request was successful, false otherwise.
27
27
  def success?
28
- @fault_code.nil?
28
+ @error_code.nil?
29
29
  end
30
30
 
31
31
  # Returns true if there was a HTTP or SOAP fault, false otherwise.
32
- def fault?
33
- !@fault_code.nil?
32
+ def error?
33
+ !@error_code.nil?
34
34
  end
35
35
 
36
36
  # Returns the SOAP response message as a Hash. Call with XPath expession
@@ -41,7 +41,7 @@ module Savon
41
41
  #
42
42
  # * +root_node+ - Optional. Custom root node to start parsing at.
43
43
  def to_hash(root_node = "//return")
44
- return nil if fault?
44
+ return nil if error?
45
45
  ApricotEatsGorilla[@response.body, root_node]
46
46
  end
47
47
 
@@ -53,7 +53,7 @@ module Savon
53
53
  #
54
54
  # * +root_node+ - Optional. Custom root node to start parsing at.
55
55
  def to_mash(root_node = "//return")
56
- return nil if fault?
56
+ return nil if error?
57
57
  hash = to_hash(root_node)
58
58
  Savon::Mash.new(hash)
59
59
  end
@@ -65,14 +65,14 @@ module Savon
65
65
 
66
66
  private
67
67
 
68
- # Checks for HTTP and SOAP faults.
68
+ # Checks for HTTP errors and SOAP faults.
69
69
  def validate
70
70
  if @response.code.to_i >= 300
71
- @fault, @fault_code = @response.message, @response.code
71
+ @error_message, @error_code = @response.message, @response.code
72
72
  else
73
- fault = to_hash("//soap:Fault")
74
- @fault = fault[:faultstring] unless fault.nil?
75
- @fault_code = fault[:faultcode] unless fault.nil?
73
+ soap_fault = to_hash("//soap:Fault")
74
+ @error_message = soap_fault[:faultstring] unless soap_fault.nil?
75
+ @error_code = soap_fault[:faultcode] unless soap_fault.nil?
76
76
  end
77
77
  end
78
78
 
@@ -35,16 +35,16 @@ class SavonResponseTest < Test::Unit::TestCase
35
35
  assert_equal true, @response.success?
36
36
  end
37
37
 
38
- should "return 'false' on fault?" do
39
- assert_equal false, @response.fault?
38
+ should "return 'false' on error?" do
39
+ assert_equal false, @response.error?
40
40
  end
41
41
 
42
- should "return 'nil' for fault" do
43
- assert_equal nil, @response.fault
42
+ should "return 'nil' for error_message" do
43
+ assert_equal nil, @response.error_message
44
44
  end
45
45
 
46
- should "return 'nil' for fault_code" do
47
- assert_equal nil, @response.fault_code
46
+ should "return 'nil' for error_code" do
47
+ assert_equal nil, @response.error_code
48
48
  end
49
49
  end
50
50
 
@@ -70,16 +70,16 @@ class SavonResponseTest < Test::Unit::TestCase
70
70
  assert_equal false, @response.success?
71
71
  end
72
72
 
73
- should "return 'true' on fault?" do
74
- assert_equal true, @response.fault?
73
+ should "return 'true' on error?" do
74
+ assert_equal true, @response.error?
75
75
  end
76
76
 
77
- should "return the fault on fault" do
78
- assert_equal soap_fault, @response.fault
77
+ should "return the error message on error_message" do
78
+ assert_equal soap_fault, @response.error_message
79
79
  end
80
80
 
81
- should "return the fault_code on fault_code" do
82
- assert_equal soap_fault_code, @response.fault_code
81
+ should "return the error code on error_code" do
82
+ assert_equal soap_fault_code, @response.error_code
83
83
  end
84
84
  end
85
85
 
@@ -105,16 +105,16 @@ class SavonResponseTest < Test::Unit::TestCase
105
105
  assert_equal false, @response.success?
106
106
  end
107
107
 
108
- should "return 'true' on fault?" do
109
- assert_equal true, @response.fault?
108
+ should "return 'true' on error?" do
109
+ assert_equal true, @response.error?
110
110
  end
111
111
 
112
- should "return the fault on fault" do
113
- assert_equal "NotFound", @response.fault
112
+ should "return the error message on error_message" do
113
+ assert_equal "NotFound", @response.error_message
114
114
  end
115
115
 
116
- should "return the fault_code on fault_code" do
117
- assert_equal "404", @response.fault_code
116
+ should "return the error code on error_code" do
117
+ assert_equal "404", @response.error_code
118
118
  end
119
119
 
120
120
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smacks-savon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Harrington