Class: Vapi::VoiceLibraryVoiceResponse
- Inherits:
-
Object
- Object
- Vapi::VoiceLibraryVoiceResponse
- Defined in:
- lib/vapi_server_sdk/types/voice_library_voice_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
- #accent ⇒ String readonly
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #age ⇒ Hash{String => Object} readonly
- #description ⇒ String readonly
- #gender ⇒ String readonly
- #name ⇒ String readonly
- #public_owner_id ⇒ String readonly
- #voice_id ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::VoiceLibraryVoiceResponse
Deserialize a JSON object to an instance of VoiceLibraryVoiceResponse.
-
.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.
Instance Method Summary collapse
- #initialize(voice_id:, name:, public_owner_id: OMIT, description: OMIT, gender: OMIT, age: OMIT, accent: OMIT, additional_properties: nil) ⇒ Vapi::VoiceLibraryVoiceResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of VoiceLibraryVoiceResponse to a JSON object.
Constructor Details
#initialize(voice_id:, name:, public_owner_id: OMIT, description: OMIT, gender: OMIT, age: OMIT, accent: OMIT, additional_properties: nil) ⇒ Vapi::VoiceLibraryVoiceResponse
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
#accent ⇒ String (readonly)
21 22 23 |
# File 'lib/vapi_server_sdk/types/voice_library_voice_response.rb', line 21 def accent @accent end |
#additional_properties ⇒ OpenStruct (readonly)
Returns 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 |
#age ⇒ Hash{String => Object} (readonly)
19 20 21 |
# File 'lib/vapi_server_sdk/types/voice_library_voice_response.rb', line 19 def age @age end |
#description ⇒ String (readonly)
15 16 17 |
# File 'lib/vapi_server_sdk/types/voice_library_voice_response.rb', line 15 def description @description end |
#gender ⇒ String (readonly)
17 18 19 |
# File 'lib/vapi_server_sdk/types/voice_library_voice_response.rb', line 17 def gender @gender end |
#name ⇒ String (readonly)
11 12 13 |
# File 'lib/vapi_server_sdk/types/voice_library_voice_response.rb', line 11 def name @name end |
#public_owner_id ⇒ String (readonly)
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_id ⇒ String (readonly)
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
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.
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
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 |