Class: Vapi::UpdateTestSuiteTestChatDto

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scorers: OMIT, name: OMIT, script: OMIT, num_attempts: OMIT, additional_properties: nil) ⇒ Vapi::UpdateTestSuiteTestChatDto

Parameters:

  • scorers (Array<Vapi::TestSuiteTestScorerAi>) (defaults to: OMIT)

    These are the scorers used to evaluate the test.

  • name (String) (defaults to: OMIT)

    This is the name of the test.

  • script (String) (defaults to: OMIT)

    This is the script to be used for the chat test.

  • num_attempts (Float) (defaults to: OMIT)

    This is the number of attempts allowed for the test.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(scorers: OMIT, name: OMIT, script: OMIT, num_attempts: OMIT, additional_properties: nil)
  @scorers = scorers if scorers != OMIT
  @name = name if name != OMIT
  @script = script if script != OMIT
  @num_attempts = num_attempts if num_attempts != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "scorers": scorers,
    "name": name,
    "script": script,
    "numAttempts": num_attempts
  }.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



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

def additional_properties
  @additional_properties
end

#nameString (readonly)

Returns This is the name of the test.

Returns:

  • (String)

    This is the name of the test.



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

def name
  @name
end

#num_attemptsFloat (readonly)

Returns This is the number of attempts allowed for the test.

Returns:

  • (Float)

    This is the number of attempts allowed for the test.



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

def num_attempts
  @num_attempts
end

#scorersArray<Vapi::TestSuiteTestScorerAi> (readonly)

Returns These are the scorers used to evaluate the test.

Returns:



10
11
12
# File 'lib/vapi_server_sdk/types/update_test_suite_test_chat_dto.rb', line 10

def scorers
  @scorers
end

#scriptString (readonly)

Returns This is the script to be used for the chat test.

Returns:

  • (String)

    This is the script to be used for the chat test.



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

def script
  @script
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::UpdateTestSuiteTestChatDto

Deserialize a JSON object to an instance of UpdateTestSuiteTestChatDto

Parameters:

  • json_object (String)

Returns:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/vapi_server_sdk/types/update_test_suite_test_chat_dto.rb', line 51

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  scorers = parsed_json["scorers"]&.map do |item|
    item = item.to_json
    Vapi::TestSuiteTestScorerAi.from_json(json_object: item)
  end
  name = parsed_json["name"]
  script = parsed_json["script"]
  num_attempts = parsed_json["numAttempts"]
  new(
    scorers: scorers,
    name: name,
    script: script,
    num_attempts: num_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)


83
84
85
86
87
88
# File 'lib/vapi_server_sdk/types/update_test_suite_test_chat_dto.rb', line 83

def self.validate_raw(obj:)
  obj.scorers&.is_a?(Array) != false || raise("Passed value for field obj.scorers is not the expected type, validation failed.")
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.script&.is_a?(String) != false || raise("Passed value for field obj.script is not the expected type, validation failed.")
  obj.num_attempts&.is_a?(Float) != false || raise("Passed value for field obj.num_attempts is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of UpdateTestSuiteTestChatDto to a JSON object

Returns:

  • (String)


73
74
75
# File 'lib/vapi_server_sdk/types/update_test_suite_test_chat_dto.rb', line 73

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