Class: AssemblyAI::Transcripts::AutoHighlightsResult

Inherits:
Object
  • Object
show all
Defined in:
lib/assemblyai/transcripts/types/auto_highlights_result.rb

Overview

An array of results for the Key Phrases model, if it is enabled.

See [Key phrases](https://www.assemblyai.com/docs/models/key-phrases) for more
information.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, results:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::AutoHighlightsResult

Parameters:



32
33
34
35
36
37
# File 'lib/assemblyai/transcripts/types/auto_highlights_result.rb', line 32

def initialize(status:, results:, additional_properties: nil)
  @status = status
  @results = results
  @additional_properties = additional_properties
  @_field_set = { "status": status, "results": results }
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



20
21
22
# File 'lib/assemblyai/transcripts/types/auto_highlights_result.rb', line 20

def additional_properties
  @additional_properties
end

#resultsArray<AssemblyAI::Transcripts::AutoHighlightResult> (readonly)

Returns A temporally-sequential array of Key Phrases.

Returns:



18
19
20
# File 'lib/assemblyai/transcripts/types/auto_highlights_result.rb', line 18

def results
  @results
end

#statusAssemblyAI::Transcripts::AudioIntelligenceModelStatus (readonly)

Returns The status of the Key Phrases model. Either success, or unavailable in the rare case that the model failed.

Returns:



16
17
18
# File 'lib/assemblyai/transcripts/types/auto_highlights_result.rb', line 16

def status
  @status
end

Class Method Details

.from_json(json_object:) ⇒ AssemblyAI::Transcripts::AutoHighlightsResult

Deserialize a JSON object to an instance of AutoHighlightsResult

Parameters:

  • json_object (String)

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/assemblyai/transcripts/types/auto_highlights_result.rb', line 43

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  status = struct["status"]
  results = parsed_json["results"]&.map do |v|
    v = v.to_json
    AssemblyAI::Transcripts::AutoHighlightResult.from_json(json_object: v)
  end
  new(
    status: status,
    results: results,
    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)


71
72
73
74
# File 'lib/assemblyai/transcripts/types/auto_highlights_result.rb', line 71

def self.validate_raw(obj:)
  obj.status.is_a?(AssemblyAI::Transcripts::AudioIntelligenceModelStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AutoHighlightsResult to a JSON object

Returns:

  • (String)


61
62
63
# File 'lib/assemblyai/transcripts/types/auto_highlights_result.rb', line 61

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