lib/soaspec/exchange.rb in soaspec-0.2.8 vs lib/soaspec/exchange.rb in soaspec-0.2.9

- old
+ new

@@ -60,10 +60,11 @@ def initialize(name = self.class.to_s, override_parameters = {}) self.test_name ||= name.to_s # As a last resort this uses the global parameter. The handler should be set straight before an exchange is made to use this @exchange_handler ||= default_handler_used || Soaspec.api_handler raise '@exchange_handler not set. Set either with `Soaspec.api_handler = Handler.new` or within the exchange' unless @exchange_handler + @fail_factory = nil @override_parameters = override_parameters @retry_for_success = false self.retry_count = 3 @exchange_handler.elements.each { |element| methods_for_element(element) } @@ -89,10 +90,11 @@ request_params = @override_parameters (1..retry_count).each do |count| response = exchange_handler.make_request(request_params) return response unless retry_for_success? return response if (200..299).cover? @exchange_handler.status_code_for(response) + sleep 0.5 break response if count == retry_count end end @@ -107,10 +109,11 @@ # @param [String, Symbol] name Name of value to retrieve # @return [Object] value from the Api Handler stored previously def retrieve(name) method = '__stored_val__' + name.to_s raise ArgumentError('Value not stored at ') unless exchange_handler.respond_to? method + exchange_handler.send(method) end # Name describing this class when used with `RSpec.describe` # This will make the request and store the response @@ -228,6 +231,6 @@ @response = nil # Reset response so it can be made repeatedly instance_eval(&script) end self end -end \ No newline at end of file +end