Class: Vapi::DeepgramVoice

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/deepgram_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:, caching_enabled: OMIT, model: OMIT, mip_opt_out: OMIT, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil) ⇒ Vapi::DeepgramVoice



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/vapi_server_sdk/types/deepgram_voice.rb', line 52

def initialize(voice_id:, caching_enabled: OMIT, model: OMIT, mip_opt_out: OMIT, chunk_plan: OMIT,
               fallback_plan: OMIT, additional_properties: nil)
  @caching_enabled = caching_enabled if caching_enabled != OMIT
  @voice_id = voice_id
  @model = model if model != OMIT
  @mip_opt_out = mip_opt_out if mip_opt_out != OMIT
  @chunk_plan = chunk_plan if chunk_plan != OMIT
  @fallback_plan = fallback_plan if fallback_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "cachingEnabled": caching_enabled,
    "voiceId": voice_id,
    "model": model,
    "mipOptOut": mip_opt_out,
    "chunkPlan": chunk_plan,
    "fallbackPlan": fallback_plan
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



31
32
33
# File 'lib/vapi_server_sdk/types/deepgram_voice.rb', line 31

def additional_properties
  @additional_properties
end

#caching_enabledBoolean (readonly)



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

def caching_enabled
  @caching_enabled
end

#chunk_planVapi::ChunkPlan (readonly)



26
27
28
# File 'lib/vapi_server_sdk/types/deepgram_voice.rb', line 26

def chunk_plan
  @chunk_plan
end

#fallback_planVapi::FallbackPlan (readonly)



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

def fallback_plan
  @fallback_plan
end

#mip_opt_outBoolean (readonly)



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

def mip_opt_out
  @mip_opt_out
end

#modelVapi::DeepgramVoiceModel (readonly)



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

def model
  @model
end

#voice_idVapi::DeepgramVoiceId (readonly)



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

def voice_id
  @voice_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::DeepgramVoice

Deserialize a JSON object to an instance of DeepgramVoice



77
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/deepgram_voice.rb', line 77

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  caching_enabled = parsed_json["cachingEnabled"]
  voice_id = parsed_json["voiceId"]
  model = parsed_json["model"]
  mip_opt_out = parsed_json["mipOptOut"]
  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
  if parsed_json["fallbackPlan"].nil?
    fallback_plan = nil
  else
    fallback_plan = parsed_json["fallbackPlan"].to_json
    fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan)
  end
  new(
    caching_enabled: caching_enabled,
    voice_id: voice_id,
    model: model,
    mip_opt_out: mip_opt_out,
    chunk_plan: chunk_plan,
    fallback_plan: fallback_plan,
    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.


120
121
122
123
124
125
126
127
# File 'lib/vapi_server_sdk/types/deepgram_voice.rb', line 120

def self.validate_raw(obj:)
  obj.caching_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.caching_enabled is not the expected type, validation failed.")
  obj.voice_id.is_a?(Vapi::DeepgramVoiceId) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.")
  obj.model&.is_a?(Vapi::DeepgramVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.mip_opt_out&.is_a?(Boolean) != false || raise("Passed value for field obj.mip_opt_out is not the expected type, validation failed.")
  obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan)
  obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of DeepgramVoice to a JSON object



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

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