Module: Soaspec::VariableStorer

Included in:
Exchange
Defined in:
lib/soaspec/exchange/variable_storer.rb

Overview

Enables Exchange to store and retrieve variables so that one exchange can make assertions based on a previous one

Instance Method Summary collapse

Instance Method Details

#retrieve(name) ⇒ Object

Retrieve the stored value from the Api Handler



17
18
19
20
21
22
# File 'lib/soaspec/exchange/variable_storer.rb', line 17

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

#store(name, value) ⇒ Object

Stores a value in the api handler that can be accessed by the provided name



10
11
12
# File 'lib/soaspec/exchange/variable_storer.rb', line 10

def store(name, value)
  exchange_handler.store(name, self[value])
end