Class: Exchange
- Inherits:
-
Object
- Object
- Exchange
- Defined in:
- lib/soaspec/exchange.rb
Overview
This represents a request / response pair
Instance Attribute Summary collapse
-
#xml_response ⇒ Object
readonly
Returns the value of attribute xml_response.
Instance Method Summary collapse
- #contain(value) ⇒ Object
-
#initialize(name, override_parameters = {}) ⇒ Exchange
constructor
A new instance of Exchange.
-
#make_request ⇒ Object
Make request to handler with parameters defined.
- #status_code ⇒ Object
-
#to_s ⇒ String
Name describing this class when used with
RSpec.describe.
Constructor Details
#initialize(name, override_parameters = {}) ⇒ Exchange
Returns a new instance of Exchange.
7 8 9 10 11 |
# File 'lib/soaspec/exchange.rb', line 7 def initialize(name, override_parameters = {}) @test_name = name.to_s @api_class = Soaspec::Environment.api_handler @override_parameters = override_parameters end |
Instance Attribute Details
#xml_response ⇒ Object (readonly)
Returns the value of attribute xml_response.
5 6 7 |
# File 'lib/soaspec/exchange.rb', line 5 def xml_response @xml_response end |
Instance Method Details
#contain(value) ⇒ Object
26 27 28 |
# File 'lib/soaspec/exchange.rb', line 26 def contain(value) @xml_response.include? value end |
#make_request ⇒ Object
Make request to handler with parameters defined
14 15 16 |
# File 'lib/soaspec/exchange.rb', line 14 def make_request @api_class.make_request(@override_parameters) end |
#status_code ⇒ Object
30 31 32 |
# File 'lib/soaspec/exchange.rb', line 30 def status_code @response.http.code end |
#to_s ⇒ String
Name describing this class when used with RSpec.describe
20 21 22 23 24 |
# File 'lib/soaspec/exchange.rb', line 20 def to_s @response = self.make_request @xml_response = @response.to_xml @test_name end |