lib/soaspec/basic_soap_handler.rb in soaspec-0.0.28 vs lib/soaspec/basic_soap_handler.rb in soaspec-0.0.29
- old
+ new
@@ -1,7 +1,7 @@
-require_relative 'tester'
+require_relative 'exchange_handler'
require_relative 'hash_methods'
require_relative 'xpath_not_found'
require_relative 'accessors'
module Soaspec
@@ -15,11 +15,11 @@
end
end
end
# Wraps around Savon client defining default values dependent on the soap request
- class BasicSoapHandler < Tester
+ class SoapHandler < ExchangeHandler
extend Soaspec::Accessors
extend Soaspec::SoapAccessors
# Savon client used to make SOAP calls
attr_accessor :client
@@ -104,10 +104,23 @@
def default_hash=(hash)
@request_option = :hash
@default_hash = Soaspec::Environment.always_use_keys? ? hash.transform_keys_to_symbols : hash
end
+ # @param [Hash] format Format of expected result
+ # @return [Object] Generic body to be displayed in error messages
+ def response_body(response, format: :hash)
+ case format
+ when :hash
+ response.body
+ when :xml
+ response.body.to_xml
+ else
+ response.body
+ end
+ end
+
def status_code_for(response)
response.http.code
end
def include_in_body?(response, expected)
@@ -136,7 +149,15 @@
# Whether any of the keys of the Body Hash include value
def include_value?(response, expected_value)
response.body.include_value?(expected_value)
end
+ end
+
+ class BasicSoapHandler < SoapHandler
+
+ def initialize(name, specific_options = {})
+ super
+ warn "'BasicSoapHandler' class is Deprecated. Please use 'SoapHandler' instead"
+ end
end
end
\ No newline at end of file