Class: AssemblyAI::Transcripts::TranscriptList
- Inherits:
-
Object
- Object
- AssemblyAI::Transcripts::TranscriptList
- Defined in:
- lib/assemblyai/transcripts/types/transcript_list.rb
Overview
A list of transcripts. Transcripts are sorted from newest to oldest. The
previous URL always points to a page with older transcripts.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#page_details ⇒ AssemblyAI::Transcripts::PageDetails
readonly
Details of the transcript page.
-
#transcripts ⇒ Array<AssemblyAI::Transcripts::TranscriptListItem>
readonly
An array of transcripts.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::TranscriptList
Deserialize a JSON object to an instance of TranscriptList.
-
.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(page_details:, transcripts:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::TranscriptList constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TranscriptList to a JSON object.
Constructor Details
#initialize(page_details:, transcripts:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::TranscriptList
29 30 31 32 33 34 |
# File 'lib/assemblyai/transcripts/types/transcript_list.rb', line 29 def initialize(page_details:, transcripts:, additional_properties: nil) @page_details = page_details @transcripts = transcripts @additional_properties = additional_properties @_field_set = { "page_details": page_details, "transcripts": transcripts } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
18 19 20 |
# File 'lib/assemblyai/transcripts/types/transcript_list.rb', line 18 def additional_properties @additional_properties end |
#page_details ⇒ AssemblyAI::Transcripts::PageDetails (readonly)
Returns Details of the transcript page.
14 15 16 |
# File 'lib/assemblyai/transcripts/types/transcript_list.rb', line 14 def page_details @page_details end |
#transcripts ⇒ Array<AssemblyAI::Transcripts::TranscriptListItem> (readonly)
Returns An array of transcripts.
16 17 18 |
# File 'lib/assemblyai/transcripts/types/transcript_list.rb', line 16 def transcripts @transcripts end |
Class Method Details
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::TranscriptList
Deserialize a JSON object to an instance of TranscriptList
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/assemblyai/transcripts/types/transcript_list.rb', line 40 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["page_details"].nil? page_details = nil else page_details = parsed_json["page_details"].to_json page_details = AssemblyAI::Transcripts::PageDetails.from_json(json_object: page_details) end transcripts = parsed_json["transcripts"]&.map do |v| v = v.to_json AssemblyAI::Transcripts::TranscriptListItem.from_json(json_object: v) end new( page_details: page_details, transcripts: transcripts, 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.
73 74 75 76 |
# File 'lib/assemblyai/transcripts/types/transcript_list.rb', line 73 def self.validate_raw(obj:) AssemblyAI::Transcripts::PageDetails.validate_raw(obj: obj.page_details) obj.transcripts.is_a?(Array) != false || raise("Passed value for field obj.transcripts is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TranscriptList to a JSON object
63 64 65 |
# File 'lib/assemblyai/transcripts/types/transcript_list.rb', line 63 def to_json(*_args) @_field_set&.to_json end |