Class: AssemblyAI::Transcripts::AutoHighlightResult
- Inherits:
-
Object
- Object
- AssemblyAI::Transcripts::AutoHighlightResult
- Defined in:
- lib/assemblyai/transcripts/types/auto_highlight_result.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#count ⇒ Integer
readonly
The total number of times the key phrase appears in the audio file.
-
#rank ⇒ Float
readonly
The total relevancy to the overall audio file of this key phrase - a greater number means more relevant.
-
#text ⇒ String
readonly
The text itself of the key phrase.
-
#timestamps ⇒ Array<AssemblyAI::Transcripts::Timestamp>
readonly
The timestamp of the of the key phrase.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::AutoHighlightResult
Deserialize a JSON object to an instance of AutoHighlightResult.
-
.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(count:, rank:, text:, timestamps:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::AutoHighlightResult constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AutoHighlightResult to a JSON object.
Constructor Details
#initialize(count:, rank:, text:, timestamps:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::AutoHighlightResult
34 35 36 37 38 39 40 41 |
# File 'lib/assemblyai/transcripts/types/auto_highlight_result.rb', line 34 def initialize(count:, rank:, text:, timestamps:, additional_properties: nil) @count = count @rank = rank @text = text @timestamps = @additional_properties = additional_properties @_field_set = { "count": count, "rank": rank, "text": text, "timestamps": } 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_highlight_result.rb', line 20 def additional_properties @additional_properties end |
#count ⇒ Integer (readonly)
Returns The total number of times the key phrase appears in the audio file.
11 12 13 |
# File 'lib/assemblyai/transcripts/types/auto_highlight_result.rb', line 11 def count @count end |
#rank ⇒ Float (readonly)
Returns The total relevancy to the overall audio file of this key phrase - a greater number means more relevant.
14 15 16 |
# File 'lib/assemblyai/transcripts/types/auto_highlight_result.rb', line 14 def rank @rank end |
#text ⇒ String (readonly)
Returns The text itself of the key phrase.
16 17 18 |
# File 'lib/assemblyai/transcripts/types/auto_highlight_result.rb', line 16 def text @text end |
#timestamps ⇒ Array<AssemblyAI::Transcripts::Timestamp> (readonly)
Returns The timestamp of the of the key phrase.
18 19 20 |
# File 'lib/assemblyai/transcripts/types/auto_highlight_result.rb', line 18 def @timestamps end |
Class Method Details
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::AutoHighlightResult
Deserialize a JSON object to an instance of AutoHighlightResult
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/assemblyai/transcripts/types/auto_highlight_result.rb', line 47 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) count = struct["count"] rank = struct["rank"] text = struct["text"] = parsed_json["timestamps"]&.map do |v| v = v.to_json AssemblyAI::Transcripts::Timestamp.from_json(json_object: v) end new( count: count, rank: rank, text: text, timestamps: , 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 |
# File 'lib/assemblyai/transcripts/types/auto_highlight_result.rb', line 79 def self.validate_raw(obj:) obj.count.is_a?(Integer) != false || raise("Passed value for field obj.count is not the expected type, validation failed.") obj.rank.is_a?(Float) != false || raise("Passed value for field obj.rank is not the expected type, validation failed.") obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.") obj..is_a?(Array) != false || raise("Passed value for field obj.timestamps is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AutoHighlightResult to a JSON object
69 70 71 |
# File 'lib/assemblyai/transcripts/types/auto_highlight_result.rb', line 69 def to_json(*_args) @_field_set&.to_json end |