Class: AssemblyAI::Transcripts::TranscriptList

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page_details:, transcripts:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::TranscriptList

Parameters:



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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_detailsAssemblyAI::Transcripts::PageDetails (readonly)

Returns Details of the transcript page.

Returns:



14
15
16
# File 'lib/assemblyai/transcripts/types/transcript_list.rb', line 14

def page_details
  @page_details
end

#transcriptsArray<AssemblyAI::Transcripts::TranscriptListItem> (readonly)

Returns An array of transcripts.

Returns:



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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


63
64
65
# File 'lib/assemblyai/transcripts/types/transcript_list.rb', line 63

def to_json(*_args)
  @_field_set&.to_json
end