Class: Vapi::AddVoiceToProviderDto

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner_id:, voice_id:, name:, additional_properties: nil) ⇒ Vapi::AddVoiceToProviderDto



33
34
35
36
37
38
39
# File 'lib/vapi_server_sdk/types/add_voice_to_provider_dto.rb', line 33

def initialize(owner_id:, voice_id:, name:, additional_properties: nil)
  @owner_id = owner_id
  @voice_id = voice_id
  @name = name
  @additional_properties = additional_properties
  @_field_set = { "ownerId": owner_id, "voiceId": voice_id, "name": name }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



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

def additional_properties
  @additional_properties
end

#nameString (readonly)



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

def name
  @name
end

#owner_idString (readonly)



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

def owner_id
  @owner_id
end

#voice_idString (readonly)



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

def voice_id
  @voice_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::AddVoiceToProviderDto

Deserialize a JSON object to an instance of AddVoiceToProviderDto



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/vapi_server_sdk/types/add_voice_to_provider_dto.rb', line 45

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  owner_id = parsed_json["ownerId"]
  voice_id = parsed_json["voiceId"]
  name = parsed_json["name"]
  new(
    owner_id: owner_id,
    voice_id: voice_id,
    name: name,
    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.


72
73
74
75
76
# File 'lib/vapi_server_sdk/types/add_voice_to_provider_dto.rb', line 72

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AddVoiceToProviderDto to a JSON object



62
63
64
# File 'lib/vapi_server_sdk/types/add_voice_to_provider_dto.rb', line 62

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