Class: AssemblyAI::Transcripts::AutoHighlightsResult
- Inherits:
-
Object
- Object
- AssemblyAI::Transcripts::AutoHighlightsResult
- 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
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#results ⇒ Array<AssemblyAI::Transcripts::AutoHighlightResult>
readonly
A temporally-sequential array of Key Phrases.
-
#status ⇒ AssemblyAI::Transcripts::AudioIntelligenceModelStatus
readonly
The status of the Key Phrases model.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::AutoHighlightsResult
Deserialize a JSON object to an instance of AutoHighlightsResult.
-
.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(status:, results:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::AutoHighlightsResult constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AutoHighlightsResult to a JSON object.
Constructor Details
#initialize(status:, results:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::AutoHighlightsResult
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_properties ⇒ OpenStruct (readonly)
Returns 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 |
#results ⇒ Array<AssemblyAI::Transcripts::AutoHighlightResult> (readonly)
Returns A temporally-sequential array of Key Phrases.
18 19 20 |
# File 'lib/assemblyai/transcripts/types/auto_highlights_result.rb', line 18 def results @results end |
#status ⇒ AssemblyAI::Transcripts::AudioIntelligenceModelStatus (readonly)
Returns The status of the Key Phrases model. Either success, or unavailable in the rare case that the model failed.
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
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.
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
61 62 63 |
# File 'lib/assemblyai/transcripts/types/auto_highlights_result.rb', line 61 def to_json(*_args) @_field_set&.to_json end |