lib/soaspec/exchange.rb in soaspec-0.0.43 vs lib/soaspec/exchange.rb in soaspec-0.0.44

- old
+ new

@@ -40,9 +40,25 @@ return response if @api_class.status_code_for(response) == 200 response end end + # Stores a value in the api handler that can be accessed by the provided name + # @param [Symbol] name Name of method to use to access this value within handler + # @param [String] value Path to value to store + def store(name, value) + @api_class.store(name, self[value]) + end + + # Retrieve the stored value from the Api Handler + # @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 api_class.respond_to? method + @api_class.send(method) + end + # Name describing this class when used with `RSpec.describe` # This will make the request and store the response # @return [String] Name given when initializing def to_s @test_name \ No newline at end of file