lib/soaspec/exchange_handlers/rest_handler.rb in soaspec-0.0.44 vs lib/soaspec/exchange_handlers/rest_handler.rb in soaspec-0.0.45
- old
+ new
@@ -89,14 +89,18 @@
}
end
# Setup object to handle communicating with a particular SOAP WSDL
# @param [Hash] specific_options Options defining SOAP request. WSDL, authentication
- def initialize(name, specific_options = {})
+ def initialize(name = self.class.to_s, options = {})
raise "Base URL not set! Please set in class with 'base_url' method" unless base_url_value
- options = rest_resource_options
- options.merge!(specific_options)
- @resource = RestClient::Resource.new(base_url_value, options) # @resource[url_extension].get
+ if name.is_a?(Hash) && options == {} # If name is not set
+ options = name
+ name = self.class.to_s
+ end
+ merged_options = rest_resource_options
+ merged_options.merge!(options)
+ @resource = RestClient::Resource.new(base_url_value, merged_options) # @resource[url_extension].get
super
end
# Used in together with Exchange request that passes such override parameters
# @param [Hash] override_parameters Params to characterize REST request
\ No newline at end of file