Class: Vapi::TestSuiteTestVoice

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scorers:, id:, test_suite_id:, org_id:, created_at:, updated_at:, script:, name: OMIT, num_attempts: OMIT, additional_properties: nil) ⇒ Vapi::TestSuiteTestVoice

Parameters:

  • scorers (Array<Vapi::TestSuiteTestScorerAi>)

    These are the scorers used to evaluate the test.

  • id (String)

    This is the unique identifier for the test.

  • test_suite_id (String)

    This is the unique identifier for the test suite this test belongs to.

  • org_id (String)

    This is the unique identifier for the organization this test belongs to.

  • created_at (DateTime)

    This is the ISO 8601 date-time string of when the test was created.

  • updated_at (DateTime)

    This is the ISO 8601 date-time string of when the test was last updated.

  • name (String) (defaults to: OMIT)

    This is the name of the test.

  • script (String)

    This is the script to be used for the voice 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



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/vapi_server_sdk/types/test_suite_test_voice.rb', line 47

def initialize(scorers:, id:, test_suite_id:, org_id:, created_at:, updated_at:, script:, name: OMIT,
               num_attempts: OMIT, additional_properties: nil)
  @scorers = scorers
  @id = id
  @test_suite_id = test_suite_id
  @org_id = org_id
  @created_at = created_at
  @updated_at = updated_at
  @name = name if name != OMIT
  @script = script
  @num_attempts = num_attempts if num_attempts != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "scorers": scorers,
    "id": id,
    "testSuiteId": test_suite_id,
    "orgId": org_id,
    "createdAt": created_at,
    "updatedAt": updated_at,
    "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



29
30
31
# File 'lib/vapi_server_sdk/types/test_suite_test_voice.rb', line 29

def additional_properties
  @additional_properties
end

#created_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the test was created.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the test was created.



19
20
21
# File 'lib/vapi_server_sdk/types/test_suite_test_voice.rb', line 19

def created_at
  @created_at
end

#idString (readonly)

Returns This is the unique identifier for the test.

Returns:

  • (String)

    This is the unique identifier for the test.



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

def id
  @id
end

#nameString (readonly)

Returns This is the name of the test.

Returns:

  • (String)

    This is the name of the test.



23
24
25
# File 'lib/vapi_server_sdk/types/test_suite_test_voice.rb', line 23

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.



27
28
29
# File 'lib/vapi_server_sdk/types/test_suite_test_voice.rb', line 27

def num_attempts
  @num_attempts
end

#org_idString (readonly)

Returns This is the unique identifier for the organization this test belongs to.

Returns:

  • (String)

    This is the unique identifier for the organization this test belongs to.



17
18
19
# File 'lib/vapi_server_sdk/types/test_suite_test_voice.rb', line 17

def org_id
  @org_id
end

#scorersArray<Vapi::TestSuiteTestScorerAi> (readonly)

Returns These are the scorers used to evaluate the test.

Returns:



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

def scorers
  @scorers
end

#scriptString (readonly)

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

Returns:

  • (String)

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



25
26
27
# File 'lib/vapi_server_sdk/types/test_suite_test_voice.rb', line 25

def script
  @script
end

#test_suite_idString (readonly)

Returns This is the unique identifier for the test suite this test belongs to.

Returns:

  • (String)

    This is the unique identifier for the test suite this test belongs to.



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

def test_suite_id
  @test_suite_id
end

#updated_atDateTime (readonly)

Returns This is the ISO 8601 date-time string of when the test was last updated.

Returns:

  • (DateTime)

    This is the ISO 8601 date-time string of when the test was last updated.



21
22
23
# File 'lib/vapi_server_sdk/types/test_suite_test_voice.rb', line 21

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TestSuiteTestVoice

Deserialize a JSON object to an instance of TestSuiteTestVoice

Parameters:

  • json_object (String)

Returns:



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/vapi_server_sdk/types/test_suite_test_voice.rb', line 78

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
  id = parsed_json["id"]
  test_suite_id = parsed_json["testSuiteId"]
  org_id = parsed_json["orgId"]
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
  updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
  name = parsed_json["name"]
  script = parsed_json["script"]
  num_attempts = parsed_json["numAttempts"]
  new(
    scorers: scorers,
    id: id,
    test_suite_id: test_suite_id,
    org_id: org_id,
    created_at: created_at,
    updated_at: updated_at,
    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)


120
121
122
123
124
125
126
127
128
129
130
# File 'lib/vapi_server_sdk/types/test_suite_test_voice.rb', line 120

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.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.test_suite_id.is_a?(String) != false || raise("Passed value for field obj.test_suite_id is not the expected type, validation failed.")
  obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
  obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at 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 TestSuiteTestVoice to a JSON object

Returns:

  • (String)


110
111
112
# File 'lib/vapi_server_sdk/types/test_suite_test_voice.rb', line 110

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