Class: Vapi::TestSuiteRunTestResult

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/test_suite_run_test_result.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test:, attempts:, additional_properties: nil) ⇒ Vapi::TestSuiteRunTestResult

Parameters:

  • test (Vapi::TestSuiteTestVoice)

    This is the test that was run.

  • attempts (Array<Vapi::TestSuiteRunTestAttempt>)

    These are the attempts made for this test.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



26
27
28
29
30
31
# File 'lib/vapi_server_sdk/types/test_suite_run_test_result.rb', line 26

def initialize(test:, attempts:, additional_properties: nil)
  @test = test
  @attempts = attempts
  @additional_properties = additional_properties
  @_field_set = { "test": test, "attempts": attempts }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



15
16
17
# File 'lib/vapi_server_sdk/types/test_suite_run_test_result.rb', line 15

def additional_properties
  @additional_properties
end

#attemptsArray<Vapi::TestSuiteRunTestAttempt> (readonly)

Returns These are the attempts made for this test.

Returns:



13
14
15
# File 'lib/vapi_server_sdk/types/test_suite_run_test_result.rb', line 13

def attempts
  @attempts
end

#testVapi::TestSuiteTestVoice (readonly)

Returns This is the test that was run.

Returns:



11
12
13
# File 'lib/vapi_server_sdk/types/test_suite_run_test_result.rb', line 11

def test
  @test
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TestSuiteRunTestResult

Deserialize a JSON object to an instance of TestSuiteRunTestResult

Parameters:

  • json_object (String)

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/vapi_server_sdk/types/test_suite_run_test_result.rb', line 37

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["test"].nil?
    test = nil
  else
    test = parsed_json["test"].to_json
    test = Vapi::TestSuiteTestVoice.from_json(json_object: test)
  end
  attempts = parsed_json["attempts"]&.map do |item|
    item = item.to_json
    Vapi::TestSuiteRunTestAttempt.from_json(json_object: item)
  end
  new(
    test: test,
    attempts: attempts,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


70
71
72
73
# File 'lib/vapi_server_sdk/types/test_suite_run_test_result.rb', line 70

def self.validate_raw(obj:)
  Vapi::TestSuiteTestVoice.validate_raw(obj: obj.test)
  obj.attempts.is_a?(Array) != false || raise("Passed value for field obj.attempts is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TestSuiteRunTestResult to a JSON object

Returns:

  • (String)


60
61
62
# File 'lib/vapi_server_sdk/types/test_suite_run_test_result.rb', line 60

def to_json(*_args)
  @_field_set&.to_json
end