Class: MockServer::ScenarioState
- Inherits:
-
Object
- Object
- MockServer::ScenarioState
- Defined in:
- lib/mockserver/models.rb
Overview
The state of a single named scenario as reported by the server's scenario
control plane. scenario_name is the state-machine name and current_state
is its current state (+nil+ if not yet set).
Instance Attribute Summary collapse
-
#current_state ⇒ Object
Returns the value of attribute current_state.
-
#next_state ⇒ Object
Returns the value of attribute next_state.
-
#scenario_name ⇒ Object
Returns the value of attribute scenario_name.
-
#transition_after_ms ⇒ Object
Returns the value of attribute transition_after_ms.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(scenario_name: nil, current_state: nil, next_state: nil, transition_after_ms: nil) ⇒ ScenarioState
constructor
A new instance of ScenarioState.
- #to_h ⇒ Object
Constructor Details
#initialize(scenario_name: nil, current_state: nil, next_state: nil, transition_after_ms: nil) ⇒ ScenarioState
Returns a new instance of ScenarioState.
2095 2096 2097 2098 2099 2100 |
# File 'lib/mockserver/models.rb', line 2095 def initialize(scenario_name: nil, current_state: nil, next_state: nil, transition_after_ms: nil) @scenario_name = scenario_name @current_state = current_state @next_state = next_state @transition_after_ms = transition_after_ms end |
Instance Attribute Details
#current_state ⇒ Object
Returns the value of attribute current_state.
2093 2094 2095 |
# File 'lib/mockserver/models.rb', line 2093 def current_state @current_state end |
#next_state ⇒ Object
Returns the value of attribute next_state.
2093 2094 2095 |
# File 'lib/mockserver/models.rb', line 2093 def next_state @next_state end |
#scenario_name ⇒ Object
Returns the value of attribute scenario_name.
2093 2094 2095 |
# File 'lib/mockserver/models.rb', line 2093 def scenario_name @scenario_name end |
#transition_after_ms ⇒ Object
Returns the value of attribute transition_after_ms.
2093 2094 2095 |
# File 'lib/mockserver/models.rb', line 2093 def transition_after_ms @transition_after_ms end |
Class Method Details
.from_hash(data) ⇒ Object
2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 |
# File 'lib/mockserver/models.rb', line 2111 def self.from_hash(data) return nil if data.nil? new( scenario_name: data['scenarioName'], current_state: data['currentState'], next_state: data['nextState'], transition_after_ms: data['transitionAfterMs'] ) end |
Instance Method Details
#to_h ⇒ Object
2102 2103 2104 2105 2106 2107 2108 2109 |
# File 'lib/mockserver/models.rb', line 2102 def to_h MockServer.strip_none({ 'scenarioName' => @scenario_name, 'currentState' => @current_state, 'nextState' => @next_state, 'transitionAfterMs' => @transition_after_ms }) end |