Class: Vapi::VoiceLibraryVoiceResponse

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(voice_id:, name:, public_owner_id: OMIT, description: OMIT, gender: OMIT, age: OMIT, accent: OMIT, additional_properties: nil) ⇒ Vapi::VoiceLibraryVoiceResponse

Parameters:

  • voice_id (String)
  • name (String)
  • public_owner_id (String) (defaults to: OMIT)
  • description (String) (defaults to: OMIT)
  • gender (String) (defaults to: OMIT)
  • age (Hash{String => Object}) (defaults to: OMIT)
  • accent (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/vapi_server_sdk/types/voice_library_voice_response.rb', line 39

def initialize(voice_id:, name:, public_owner_id: OMIT, description: OMIT, gender: OMIT, age: OMIT, accent: OMIT,
               additional_properties: nil)
  @voice_id = voice_id
  @name = name
  @public_owner_id = public_owner_id if public_owner_id != OMIT
  @description = description if description != OMIT
  @gender = gender if gender != OMIT
  @age = age if age != OMIT
  @accent = accent if accent != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "voiceId": voice_id,
    "name": name,
    "publicOwnerId": public_owner_id,
    "description": description,
    "gender": gender,
    "age": age,
    "accent": accent
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#accentString (readonly)

Returns:

  • (String)


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

def accent
  @accent
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



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

def additional_properties
  @additional_properties
end

#ageHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


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

def age
  @age
end

#descriptionString (readonly)

Returns:

  • (String)


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

def description
  @description
end

#genderString (readonly)

Returns:

  • (String)


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

def gender
  @gender
end

#nameString (readonly)

Returns:

  • (String)


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

def name
  @name
end

#public_owner_idString (readonly)

Returns:

  • (String)


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

def public_owner_id
  @public_owner_id
end

#voice_idString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/vapi_server_sdk/types/voice_library_voice_response.rb', line 9

def voice_id
  @voice_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::VoiceLibraryVoiceResponse

Deserialize a JSON object to an instance of VoiceLibraryVoiceResponse

Parameters:

  • json_object (String)

Returns:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/vapi_server_sdk/types/voice_library_voice_response.rb', line 66

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  voice_id = parsed_json["voiceId"]
  name = parsed_json["name"]
  public_owner_id = parsed_json["publicOwnerId"]
  description = parsed_json["description"]
  gender = parsed_json["gender"]
  age = parsed_json["age"]
  accent = parsed_json["accent"]
  new(
    voice_id: voice_id,
    name: name,
    public_owner_id: public_owner_id,
    description: description,
    gender: gender,
    age: age,
    accent: accent,
    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)


101
102
103
104
105
106
107
108
109
# File 'lib/vapi_server_sdk/types/voice_library_voice_response.rb', line 101

def self.validate_raw(obj:)
  obj.voice_id.is_a?(String) != false || raise("Passed value for field obj.voice_id 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.public_owner_id&.is_a?(String) != false || raise("Passed value for field obj.public_owner_id is not the expected type, validation failed.")
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.gender&.is_a?(String) != false || raise("Passed value for field obj.gender is not the expected type, validation failed.")
  obj.age&.is_a?(Hash) != false || raise("Passed value for field obj.age is not the expected type, validation failed.")
  obj.accent&.is_a?(String) != false || raise("Passed value for field obj.accent is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of VoiceLibraryVoiceResponse to a JSON object

Returns:

  • (String)


91
92
93
# File 'lib/vapi_server_sdk/types/voice_library_voice_response.rb', line 91

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