Class: MockServer::LoadStep
- Inherits:
-
Object
- Object
- MockServer::LoadStep
- Defined in:
- lib/mockserver/models.rb
Overview
A single step within a load scenario. Each step fires request (an HttpRequest) against the target, optionally pausing for think_time (a Delay) afterwards.
Instance Attribute Summary collapse
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#name ⇒ Object
Returns the value of attribute name.
-
#request ⇒ Object
Returns the value of attribute request.
-
#think_time ⇒ Object
Returns the value of attribute think_time.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(request:, name: nil, labels: nil, think_time: nil) ⇒ LoadStep
constructor
A new instance of LoadStep.
- #to_h ⇒ Object
Constructor Details
#initialize(request:, name: nil, labels: nil, think_time: nil) ⇒ LoadStep
Returns a new instance of LoadStep.
2399 2400 2401 2402 2403 2404 |
# File 'lib/mockserver/models.rb', line 2399 def initialize(request:, name: nil, labels: nil, think_time: nil) @request = request @name = name @labels = labels @think_time = think_time end |
Instance Attribute Details
#labels ⇒ Object
Returns the value of attribute labels.
2397 2398 2399 |
# File 'lib/mockserver/models.rb', line 2397 def labels @labels end |
#name ⇒ Object
Returns the value of attribute name.
2397 2398 2399 |
# File 'lib/mockserver/models.rb', line 2397 def name @name end |
#request ⇒ Object
Returns the value of attribute request.
2397 2398 2399 |
# File 'lib/mockserver/models.rb', line 2397 def request @request end |
#think_time ⇒ Object
Returns the value of attribute think_time.
2397 2398 2399 |
# File 'lib/mockserver/models.rb', line 2397 def think_time @think_time end |
Class Method Details
.from_hash(data) ⇒ Object
2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 |
# File 'lib/mockserver/models.rb', line 2415 def self.from_hash(data) return nil if data.nil? new( name: data['name'], labels: data['labels'], think_time: Delay.from_hash(data['thinkTime']), request: HttpRequest.from_hash(data['request']) ) end |
Instance Method Details
#to_h ⇒ Object
2406 2407 2408 2409 2410 2411 2412 2413 |
# File 'lib/mockserver/models.rb', line 2406 def to_h MockServer.strip_none({ 'name' => @name, 'labels' => @labels, 'thinkTime' => @think_time&.to_h, 'request' => @request&.to_h }) end |