Class: Vapi::FallbackAzureVoice

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(voice_id:, speed: OMIT, chunk_plan: OMIT, one_of: OMIT, additional_properties: nil) ⇒ Vapi::FallbackAzureVoice

Parameters:

  • voice_id (Vapi::FallbackAzureVoiceId)

    This is the provider-specific ID that will be used.

  • speed (Float) (defaults to: OMIT)

    This is the speed multiplier that will be used.

  • chunk_plan (Vapi::ChunkPlan) (defaults to: OMIT)

    This is the plan for chunking the model output before it is sent to the voice provider.

  • one_of (Object) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/vapi_server_sdk/types/fallback_azure_voice.rb', line 34

def initialize(voice_id:, speed: OMIT, chunk_plan: OMIT, one_of: OMIT, additional_properties: nil)
  @voice_id = voice_id
  @speed = speed if speed != OMIT
  @chunk_plan = chunk_plan if chunk_plan != OMIT
  @one_of = one_of if one_of != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "voiceId": voice_id,
    "speed": speed,
    "chunkPlan": chunk_plan,
    "oneOf": one_of
  }.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



20
21
22
# File 'lib/vapi_server_sdk/types/fallback_azure_voice.rb', line 20

def additional_properties
  @additional_properties
end

#chunk_planVapi::ChunkPlan (readonly)

Returns This is the plan for chunking the model output before it is sent to the voice provider.

Returns:

  • (Vapi::ChunkPlan)

    This is the plan for chunking the model output before it is sent to the voice provider.



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

def chunk_plan
  @chunk_plan
end

#one_ofObject (readonly)

Returns:

  • (Object)


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

def one_of
  @one_of
end

#speedFloat (readonly)

Returns This is the speed multiplier that will be used.

Returns:

  • (Float)

    This is the speed multiplier that will be used.



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

def speed
  @speed
end

#voice_idVapi::FallbackAzureVoiceId (readonly)

Returns This is the provider-specific ID that will be used.

Returns:



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

def voice_id
  @voice_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::FallbackAzureVoice

Deserialize a JSON object to an instance of FallbackAzureVoice

Parameters:

  • json_object (String)

Returns:



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/vapi_server_sdk/types/fallback_azure_voice.rb', line 54

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["voiceId"].nil?
    voice_id = nil
  else
    voice_id = parsed_json["voiceId"].to_json
    voice_id = Vapi::FallbackAzureVoiceId.from_json(json_object: voice_id)
  end
  speed = parsed_json["speed"]
  if parsed_json["chunkPlan"].nil?
    chunk_plan = nil
  else
    chunk_plan = parsed_json["chunkPlan"].to_json
    chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan)
  end
  one_of = parsed_json["oneOf"]
  new(
    voice_id: voice_id,
    speed: speed,
    chunk_plan: chunk_plan,
    one_of: one_of,
    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)


93
94
95
96
97
98
# File 'lib/vapi_server_sdk/types/fallback_azure_voice.rb', line 93

def self.validate_raw(obj:)
  Vapi::FallbackAzureVoiceId.validate_raw(obj: obj.voice_id)
  obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.")
  obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan)
  obj.one_of&.is_a?(Object) != false || raise("Passed value for field obj.one_of is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FallbackAzureVoice to a JSON object

Returns:

  • (String)


83
84
85
# File 'lib/vapi_server_sdk/types/fallback_azure_voice.rb', line 83

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