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.
1805 1806 1807 1808 1809 1810 |
# File 'lib/mockserver/models.rb', line 1805 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.
1803 1804 1805 |
# File 'lib/mockserver/models.rb', line 1803 def current_state @current_state end |
#next_state ⇒ Object
Returns the value of attribute next_state.
1803 1804 1805 |
# File 'lib/mockserver/models.rb', line 1803 def next_state @next_state end |
#scenario_name ⇒ Object
Returns the value of attribute scenario_name.
1803 1804 1805 |
# File 'lib/mockserver/models.rb', line 1803 def scenario_name @scenario_name end |
#transition_after_ms ⇒ Object
Returns the value of attribute transition_after_ms.
1803 1804 1805 |
# File 'lib/mockserver/models.rb', line 1803 def transition_after_ms @transition_after_ms end |
Class Method Details
.from_hash(data) ⇒ Object
1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 |
# File 'lib/mockserver/models.rb', line 1821 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
1812 1813 1814 1815 1816 1817 1818 1819 |
# File 'lib/mockserver/models.rb', line 1812 def to_h MockServer.strip_none({ 'scenarioName' => @scenario_name, 'currentState' => @current_state, 'nextState' => @next_state, 'transitionAfterMs' => @transition_after_ms }) end |