Class: MockServer::GrpcBidiRule
- Inherits:
-
Object
- Object
- MockServer::GrpcBidiRule
- Defined in:
- lib/mockserver/models.rb
Instance Attribute Summary collapse
-
#match_json ⇒ Object
Returns the value of attribute match_json.
-
#responses ⇒ Object
Returns the value of attribute responses.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(match_json: nil, responses: nil) ⇒ GrpcBidiRule
constructor
A new instance of GrpcBidiRule.
- #to_h ⇒ Object
Constructor Details
#initialize(match_json: nil, responses: nil) ⇒ GrpcBidiRule
Returns a new instance of GrpcBidiRule.
1333 1334 1335 1336 |
# File 'lib/mockserver/models.rb', line 1333 def initialize(match_json: nil, responses: nil) @match_json = match_json @responses = responses end |
Instance Attribute Details
#match_json ⇒ Object
Returns the value of attribute match_json.
1331 1332 1333 |
# File 'lib/mockserver/models.rb', line 1331 def match_json @match_json end |
#responses ⇒ Object
Returns the value of attribute responses.
1331 1332 1333 |
# File 'lib/mockserver/models.rb', line 1331 def responses @responses end |
Class Method Details
.from_hash(data) ⇒ Object
1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 |
# File 'lib/mockserver/models.rb', line 1345 def self.from_hash(data) return nil if data.nil? responses_data = data['responses'] responses = responses_data&.map { |r| GrpcStreamMessage.from_hash(r) } new( match_json: data['matchJson'], responses: responses ) end |
Instance Method Details
#to_h ⇒ Object
1338 1339 1340 1341 1342 1343 |
# File 'lib/mockserver/models.rb', line 1338 def to_h result = {} result['matchJson'] = @match_json unless @match_json.nil? result['responses'] = @responses&.map(&:to_h) if @responses result end |