Class: Vellum::TestSuiteRunRead
- Inherits:
-
Object
- Object
- Vellum::TestSuiteRunRead
- Defined in:
- lib/vellum_ai/types/test_suite_run_read.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#exec_config ⇒ Object
readonly
Returns the value of attribute exec_config.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#test_suite ⇒ Object
readonly
Returns the value of attribute test_suite.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TestSuiteRunRead
Deserialize a JSON object to an instance of TestSuiteRunRead.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(id:, created:, test_suite:, state:, exec_config: nil, additional_properties: nil) ⇒ TestSuiteRunRead constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of TestSuiteRunRead to a JSON object.
Constructor Details
#initialize(id:, created:, test_suite:, state:, exec_config: nil, additional_properties: nil) ⇒ TestSuiteRunRead
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/vellum_ai/types/test_suite_run_read.rb', line 25 def initialize(id:, created:, test_suite:, state:, exec_config: nil, additional_properties: nil) # @type [String] @id = id # @type [DateTime] @created = created # @type [TestSuiteRunTestSuite] @test_suite = test_suite # @type [TEST_SUITE_RUN_STATE] The current state of this run # - `QUEUED` - Queued # - `RUNNING` - Running # - `COMPLETE` - Complete # - `FAILED` - Failed # - `CANCELLED` - Cancelled @state = state # @type [TestSuiteRunExecConfig] Configuration that defines how the Test Suite should be run @exec_config = exec_config # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
11 12 13 |
# File 'lib/vellum_ai/types/test_suite_run_read.rb', line 11 def additional_properties @additional_properties end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
11 12 13 |
# File 'lib/vellum_ai/types/test_suite_run_read.rb', line 11 def created @created end |
#exec_config ⇒ Object (readonly)
Returns the value of attribute exec_config.
11 12 13 |
# File 'lib/vellum_ai/types/test_suite_run_read.rb', line 11 def exec_config @exec_config end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
11 12 13 |
# File 'lib/vellum_ai/types/test_suite_run_read.rb', line 11 def id @id end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
11 12 13 |
# File 'lib/vellum_ai/types/test_suite_run_read.rb', line 11 def state @state end |
#test_suite ⇒ Object (readonly)
Returns the value of attribute test_suite.
11 12 13 |
# File 'lib/vellum_ai/types/test_suite_run_read.rb', line 11 def test_suite @test_suite end |
Class Method Details
.from_json(json_object:) ⇒ TestSuiteRunRead
Deserialize a JSON object to an instance of TestSuiteRunRead
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/vellum_ai/types/test_suite_run_read.rb', line 49 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct.id created = DateTime.parse(parsed_json["created"]) if parsed_json["test_suite"].nil? test_suite = nil else test_suite = parsed_json["test_suite"].to_json test_suite = TestSuiteRunTestSuite.from_json(json_object: test_suite) end state = TEST_SUITE_RUN_STATE.key(parsed_json["state"]) || parsed_json["state"] if parsed_json["exec_config"].nil? exec_config = nil else exec_config = parsed_json["exec_config"].to_json exec_config = TestSuiteRunExecConfig.from_json(json_object: exec_config) end new(id: id, created: created, test_suite: test_suite, state: state, exec_config: exec_config, additional_properties: struct) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
88 89 90 91 92 93 94 |
# File 'lib/vellum_ai/types/test_suite_run_read.rb', line 88 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.") TestSuiteRunTestSuite.validate_raw(obj: obj.test_suite) obj.state.is_a?(TEST_SUITE_RUN_STATE) != false || raise("Passed value for field obj.state is not the expected type, validation failed.") obj.exec_config.nil? || TestSuiteRunExecConfig.validate_raw(obj: obj.exec_config) end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of TestSuiteRunRead to a JSON object
74 75 76 77 78 79 80 81 82 |
# File 'lib/vellum_ai/types/test_suite_run_read.rb', line 74 def to_json(*_args) { "id": @id, "created": @created, "test_suite": @test_suite, "state": TEST_SUITE_RUN_STATE[@state] || @state, "exec_config": @exec_config }.to_json end |