Class: AssemblyAI::Transcripts::ParagraphsResponse
- Inherits:
-
Object
- Object
- AssemblyAI::Transcripts::ParagraphsResponse
- Defined in:
- lib/assemblyai/transcripts/types/paragraphs_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#audio_duration ⇒ Float
readonly
The duration of the audio file in seconds.
-
#confidence ⇒ Float
readonly
The confidence score for the transcript.
-
#id ⇒ String
readonly
The unique identifier of your transcript.
-
#paragraphs ⇒ Array<AssemblyAI::Transcripts::TranscriptParagraph>
readonly
An array of paragraphs in the transcript.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::ParagraphsResponse
Deserialize a JSON object to an instance of ParagraphsResponse.
-
.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.
Instance Method Summary collapse
- #initialize(id:, confidence:, audio_duration:, paragraphs:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::ParagraphsResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ParagraphsResponse to a JSON object.
Constructor Details
#initialize(id:, confidence:, audio_duration:, paragraphs:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::ParagraphsResponse
32 33 34 35 36 37 38 39 |
# File 'lib/assemblyai/transcripts/types/paragraphs_response.rb', line 32 def initialize(id:, confidence:, audio_duration:, paragraphs:, additional_properties: nil) @id = id @confidence = confidence @audio_duration = audio_duration @paragraphs = paragraphs @additional_properties = additional_properties @_field_set = { "id": id, "confidence": confidence, "audio_duration": audio_duration, "paragraphs": paragraphs } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/assemblyai/transcripts/types/paragraphs_response.rb', line 19 def additional_properties @additional_properties end |
#audio_duration ⇒ Float (readonly)
Returns The duration of the audio file in seconds.
15 16 17 |
# File 'lib/assemblyai/transcripts/types/paragraphs_response.rb', line 15 def audio_duration @audio_duration end |
#confidence ⇒ Float (readonly)
Returns The confidence score for the transcript.
13 14 15 |
# File 'lib/assemblyai/transcripts/types/paragraphs_response.rb', line 13 def confidence @confidence end |
#id ⇒ String (readonly)
Returns The unique identifier of your transcript.
11 12 13 |
# File 'lib/assemblyai/transcripts/types/paragraphs_response.rb', line 11 def id @id end |
#paragraphs ⇒ Array<AssemblyAI::Transcripts::TranscriptParagraph> (readonly)
Returns An array of paragraphs in the transcript.
17 18 19 |
# File 'lib/assemblyai/transcripts/types/paragraphs_response.rb', line 17 def paragraphs @paragraphs end |
Class Method Details
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::ParagraphsResponse
Deserialize a JSON object to an instance of ParagraphsResponse
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/assemblyai/transcripts/types/paragraphs_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"] paragraphs = parsed_json["paragraphs"]&.map do |v| v = v.to_json AssemblyAI::Transcripts::TranscriptParagraph.from_json(json_object: v) end new( id: id, confidence: confidence, audio_duration: audio_duration, paragraphs: paragraphs, 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.
77 78 79 80 81 82 |
# File 'lib/assemblyai/transcripts/types/paragraphs_response.rb', line 77 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id 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.audio_duration.is_a?(Float) != false || raise("Passed value for field obj.audio_duration is not the expected type, validation failed.") obj.paragraphs.is_a?(Array) != false || raise("Passed value for field obj.paragraphs is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ParagraphsResponse to a JSON object
67 68 69 |
# File 'lib/assemblyai/transcripts/types/paragraphs_response.rb', line 67 def to_json(*_args) @_field_set&.to_json end |