Class: Vapi::TestSuiteRunTestAttempt

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scorer_results:, call: OMIT, call_id: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Vapi::TestSuiteRunTestAttempt

Parameters:

  • scorer_results (Array<Vapi::TestSuiteRunScorerAi>)

    These are the results of the scorers used to evaluate the test attempt.

  • call (Vapi::TestSuiteRunTestAttemptCall) (defaults to: OMIT)

    This is the call made during the test attempt.

  • call_id (String) (defaults to: OMIT)

    This is the call ID for the test attempt.

  • metadata (Vapi::TestSuiteRunTestAttemptMetadata) (defaults to: OMIT)

    This is the metadata for the test attempt.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb', line 33

def initialize(scorer_results:, call: OMIT, call_id: OMIT, metadata: OMIT, additional_properties: nil)
  @scorer_results = scorer_results
  @call = call if call != OMIT
  @call_id = call_id if call_id != OMIT
  @metadata =  if  != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "scorerResults": scorer_results,
    "call": call,
    "callId": call_id,
    "metadata": 
  }.reject do |_k, v|
    v == OMIT
  end
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



20
21
22
# File 'lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb', line 20

def additional_properties
  @additional_properties
end

#callVapi::TestSuiteRunTestAttemptCall (readonly)

Returns This is the call made during the test attempt.

Returns:



14
15
16
# File 'lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb', line 14

def call
  @call
end

#call_idString (readonly)

Returns This is the call ID for the test attempt.

Returns:

  • (String)

    This is the call ID for the test attempt.



16
17
18
# File 'lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb', line 16

def call_id
  @call_id
end

#metadataVapi::TestSuiteRunTestAttemptMetadata (readonly)

Returns This is the metadata for the test attempt.

Returns:



18
19
20
# File 'lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb', line 18

def 
  @metadata
end

#scorer_resultsArray<Vapi::TestSuiteRunScorerAi> (readonly)

Returns These are the results of the scorers used to evaluate the test attempt.

Returns:



12
13
14
# File 'lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb', line 12

def scorer_results
  @scorer_results
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TestSuiteRunTestAttempt

Deserialize a JSON object to an instance of TestSuiteRunTestAttempt

Parameters:

  • json_object (String)

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb', line 53

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  scorer_results = parsed_json["scorerResults"]&.map do |item|
    item = item.to_json
    Vapi::TestSuiteRunScorerAi.from_json(json_object: item)
  end
  if parsed_json["call"].nil?
    call = nil
  else
    call = parsed_json["call"].to_json
    call = Vapi::TestSuiteRunTestAttemptCall.from_json(json_object: call)
  end
  call_id = parsed_json["callId"]
  if parsed_json["metadata"].nil?
     = nil
  else
     = parsed_json["metadata"].to_json
     = Vapi::TestSuiteRunTestAttemptMetadata.from_json(json_object: )
  end
  new(
    scorer_results: scorer_results,
    call: call,
    call_id: call_id,
    metadata: ,
    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)


95
96
97
98
99
100
# File 'lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb', line 95

def self.validate_raw(obj:)
  obj.scorer_results.is_a?(Array) != false || raise("Passed value for field obj.scorer_results is not the expected type, validation failed.")
  obj.call.nil? || Vapi::TestSuiteRunTestAttemptCall.validate_raw(obj: obj.call)
  obj.call_id&.is_a?(String) != false || raise("Passed value for field obj.call_id is not the expected type, validation failed.")
  obj..nil? || Vapi::TestSuiteRunTestAttemptMetadata.validate_raw(obj: obj.)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TestSuiteRunTestAttempt to a JSON object

Returns:

  • (String)


85
86
87
# File 'lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb', line 85

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