Class: Vapi::FallbackOpenAiTranscriber

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model:, language: OMIT, additional_properties: nil) ⇒ Vapi::FallbackOpenAiTranscriber



26
27
28
29
30
31
32
33
# File 'lib/vapi_server_sdk/types/fallback_open_ai_transcriber.rb', line 26

def initialize(model:, language: OMIT, additional_properties: nil)
  @model = model
  @language = language if language != OMIT
  @additional_properties = additional_properties
  @_field_set = { "model": model, "language": language }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



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

def additional_properties
  @additional_properties
end

#languageVapi::FallbackOpenAiTranscriberLanguage (readonly)



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

def language
  @language
end

#modelVapi::FallbackOpenAiTranscriberModel (readonly)



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

def model
  @model
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::FallbackOpenAiTranscriber

Deserialize a JSON object to an instance of FallbackOpenAiTranscriber



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/vapi_server_sdk/types/fallback_open_ai_transcriber.rb', line 39

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


64
65
66
67
# File 'lib/vapi_server_sdk/types/fallback_open_ai_transcriber.rb', line 64

def self.validate_raw(obj:)
  obj.model.is_a?(Vapi::FallbackOpenAiTranscriberModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.language&.is_a?(Vapi::FallbackOpenAiTranscriberLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FallbackOpenAiTranscriber to a JSON object



54
55
56
# File 'lib/vapi_server_sdk/types/fallback_open_ai_transcriber.rb', line 54

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