Class: AssemblyAI::Transcripts::Chapter
- Inherits:
-
Object
- Object
- AssemblyAI::Transcripts::Chapter
- Defined in:
- lib/assemblyai/transcripts/types/chapter.rb
Overview
Chapter of the audio file
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#end_ ⇒ Integer
readonly
The starting time, in milliseconds, for the chapter.
-
#gist ⇒ String
readonly
An ultra-short summary (just a few words) of the content spoken in the chapter.
-
#headline ⇒ String
readonly
A single sentence summary of the content spoken during the chapter.
-
#start ⇒ Integer
readonly
The starting time, in milliseconds, for the chapter.
-
#summary ⇒ String
readonly
A one paragraph summary of the content spoken during the chapter.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::Chapter
Deserialize a JSON object to an instance of Chapter.
-
.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(gist:, headline:, summary:, start:, end_:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::Chapter constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Chapter to a JSON object.
Constructor Details
#initialize(gist:, headline:, summary:, start:, end_:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::Chapter
35 36 37 38 39 40 41 42 43 |
# File 'lib/assemblyai/transcripts/types/chapter.rb', line 35 def initialize(gist:, headline:, summary:, start:, end_:, additional_properties: nil) @gist = gist @headline = headline @summary = summary @start = start @end_ = end_ @additional_properties = additional_properties @_field_set = { "gist": gist, "headline": headline, "summary": summary, "start": start, "end": end_ } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
21 22 23 |
# File 'lib/assemblyai/transcripts/types/chapter.rb', line 21 def additional_properties @additional_properties end |
#end_ ⇒ Integer (readonly)
Returns The starting time, in milliseconds, for the chapter.
19 20 21 |
# File 'lib/assemblyai/transcripts/types/chapter.rb', line 19 def end_ @end_ end |
#gist ⇒ String (readonly)
Returns An ultra-short summary (just a few words) of the content spoken in the chapter.
11 12 13 |
# File 'lib/assemblyai/transcripts/types/chapter.rb', line 11 def gist @gist end |
#headline ⇒ String (readonly)
Returns A single sentence summary of the content spoken during the chapter.
13 14 15 |
# File 'lib/assemblyai/transcripts/types/chapter.rb', line 13 def headline @headline end |
#start ⇒ Integer (readonly)
Returns The starting time, in milliseconds, for the chapter.
17 18 19 |
# File 'lib/assemblyai/transcripts/types/chapter.rb', line 17 def start @start end |
#summary ⇒ String (readonly)
Returns A one paragraph summary of the content spoken during the chapter.
15 16 17 |
# File 'lib/assemblyai/transcripts/types/chapter.rb', line 15 def summary @summary end |
Class Method Details
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::Chapter
Deserialize a JSON object to an instance of Chapter
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/assemblyai/transcripts/types/chapter.rb', line 49 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) gist = struct["gist"] headline = struct["headline"] summary = struct["summary"] start = struct["start"] end_ = struct["end"] new( gist: gist, headline: headline, summary: summary, start: start, end_: end_, 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.
79 80 81 82 83 84 85 |
# File 'lib/assemblyai/transcripts/types/chapter.rb', line 79 def self.validate_raw(obj:) obj.gist.is_a?(String) != false || raise("Passed value for field obj.gist is not the expected type, validation failed.") obj.headline.is_a?(String) != false || raise("Passed value for field obj.headline is not the expected type, validation failed.") obj.summary.is_a?(String) != false || raise("Passed value for field obj.summary 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.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Chapter to a JSON object
69 70 71 |
# File 'lib/assemblyai/transcripts/types/chapter.rb', line 69 def to_json(*_args) @_field_set&.to_json end |