Method: AssemblyAI::Transcripts::SentencesResponse.from_json
- Defined in:
- lib/assemblyai/transcripts/types/sentences_response.rb
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::SentencesResponse
Deserialize a JSON object to an instance of SentencesResponse
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/assemblyai/transcripts/types/sentences_response.rb', line 45 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct["id"] confidence = struct["confidence"] audio_duration = struct["audio_duration"] sentences = parsed_json["sentences"]&.map do |v| v = v.to_json AssemblyAI::Transcripts::TranscriptSentence.from_json(json_object: v) end new( id: id, confidence: confidence, audio_duration: audio_duration, sentences: sentences, additional_properties: struct ) end |