Class: AssemblyAI::Transcripts::ContentSafetyLabel
- Inherits:
-
Object
- Object
- AssemblyAI::Transcripts::ContentSafetyLabel
- Defined in:
- lib/assemblyai/transcripts/types/content_safety_label.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#confidence ⇒ Float
readonly
The confidence score for the topic being discussed, from 0 to 1.
-
#label ⇒ String
readonly
The label of the sensitive topic.
-
#severity ⇒ Float
readonly
How severely the topic is discussed in the section, from 0 to 1.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::ContentSafetyLabel
Deserialize a JSON object to an instance of ContentSafetyLabel.
-
.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(label:, confidence:, severity:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::ContentSafetyLabel constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ContentSafetyLabel to a JSON object.
Constructor Details
#initialize(label:, confidence:, severity:, additional_properties: nil) ⇒ AssemblyAI::Transcripts::ContentSafetyLabel
28 29 30 31 32 33 34 |
# File 'lib/assemblyai/transcripts/types/content_safety_label.rb', line 28 def initialize(label:, confidence:, severity:, additional_properties: nil) @label = label @confidence = confidence @severity = severity @additional_properties = additional_properties @_field_set = { "label": label, "confidence": confidence, "severity": severity } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/assemblyai/transcripts/types/content_safety_label.rb', line 16 def additional_properties @additional_properties end |
#confidence ⇒ Float (readonly)
Returns The confidence score for the topic being discussed, from 0 to 1.
12 13 14 |
# File 'lib/assemblyai/transcripts/types/content_safety_label.rb', line 12 def confidence @confidence end |
#label ⇒ String (readonly)
Returns The label of the sensitive topic.
10 11 12 |
# File 'lib/assemblyai/transcripts/types/content_safety_label.rb', line 10 def label @label end |
#severity ⇒ Float (readonly)
Returns How severely the topic is discussed in the section, from 0 to 1.
14 15 16 |
# File 'lib/assemblyai/transcripts/types/content_safety_label.rb', line 14 def severity @severity end |
Class Method Details
.from_json(json_object:) ⇒ AssemblyAI::Transcripts::ContentSafetyLabel
Deserialize a JSON object to an instance of ContentSafetyLabel
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/assemblyai/transcripts/types/content_safety_label.rb', line 40 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) label = struct["label"] confidence = struct["confidence"] severity = struct["severity"] new( label: label, confidence: confidence, severity: severity, 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.
66 67 68 69 70 |
# File 'lib/assemblyai/transcripts/types/content_safety_label.rb', line 66 def self.validate_raw(obj:) obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.") obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.") obj.severity.is_a?(Float) != false || raise("Passed value for field obj.severity is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ContentSafetyLabel to a JSON object
56 57 58 |
# File 'lib/assemblyai/transcripts/types/content_safety_label.rb', line 56 def to_json(*_args) @_field_set&.to_json end |