Method: AssemblyAI::Transcripts::TranscriptSentence.validate_raw

Defined in:
lib/assemblyai/transcripts/types/transcript_sentence.rb

.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)


112
113
114
115
116
117
118
119
120
# File 'lib/assemblyai/transcripts/types/transcript_sentence.rb', line 112

def self.validate_raw(obj:)
  obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
  obj.start.is_a?(Integer) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
  obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
  obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.")
  obj.words.is_a?(Array) != false || raise("Passed value for field obj.words is not the expected type, validation failed.")
  obj.channel&.is_a?(String) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.")
  obj.speaker&.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.")
end