Class: HttpStub::Configurator::State
- Inherits:
-
Object
- Object
- HttpStub::Configurator::State
- Defined in:
- lib/http_stub/configurator/state.rb
Instance Attribute Summary collapse
-
#port ⇒ Object
Returns the value of attribute port.
-
#scenario_hashes ⇒ Object
readonly
Returns the value of attribute scenario_hashes.
-
#session_identifier ⇒ Object
writeonly
Sets the attribute session_identifier.
-
#stub_hashes ⇒ Object
readonly
Returns the value of attribute stub_hashes.
Instance Method Summary collapse
- #add_scenario(scenario) ⇒ Object
- #add_stub(stub) ⇒ Object
- #application_settings ⇒ Object
- #enable(feature) ⇒ Object
- #external_base_uri ⇒ Object
-
#initialize ⇒ State
constructor
A new instance of State.
Constructor Details
#initialize ⇒ State
Returns a new instance of State.
12 13 14 15 16 |
# File 'lib/http_stub/configurator/state.rb', line 12 def initialize @scenario_hashes = [] @stub_hashes = [] @cross_origin_support_flag = false end |
Instance Attribute Details
#port ⇒ Object
Returns the value of attribute port.
6 7 8 |
# File 'lib/http_stub/configurator/state.rb', line 6 def port @port end |
#scenario_hashes ⇒ Object (readonly)
Returns the value of attribute scenario_hashes.
10 11 12 |
# File 'lib/http_stub/configurator/state.rb', line 10 def scenario_hashes @scenario_hashes end |
#session_identifier=(value) ⇒ Object (writeonly)
Sets the attribute session_identifier
8 9 10 |
# File 'lib/http_stub/configurator/state.rb', line 8 def session_identifier=(value) @session_identifier = value end |
#stub_hashes ⇒ Object (readonly)
Returns the value of attribute stub_hashes.
10 11 12 |
# File 'lib/http_stub/configurator/state.rb', line 10 def stub_hashes @stub_hashes end |
Instance Method Details
#add_scenario(scenario) ⇒ Object
26 27 28 |
# File 'lib/http_stub/configurator/state.rb', line 26 def add_scenario(scenario) @scenario_hashes << scenario.to_hash end |
#add_stub(stub) ⇒ Object
30 31 32 |
# File 'lib/http_stub/configurator/state.rb', line 30 def add_stub(stub) @stub_hashes << stub.to_hash end |
#application_settings ⇒ Object
34 35 36 |
# File 'lib/http_stub/configurator/state.rb', line 34 def application_settings { port: @port, session_identifier: @session_identifier, cross_origin_support: @cross_origin_support_flag } end |
#enable(feature) ⇒ Object
22 23 24 |
# File 'lib/http_stub/configurator/state.rb', line 22 def enable(feature) @cross_origin_support_flag = true if feature == :cross_origin_support end |
#external_base_uri ⇒ Object
18 19 20 |
# File 'lib/http_stub/configurator/state.rb', line 18 def external_base_uri ENV["STUB_EXTERNAL_BASE_URI"] || "http://localhost:#{@port}" end |