Class: AssemblyAI::Lemur::LemurSummaryResponse
- Inherits:
-
Object
- Object
- AssemblyAI::Lemur::LemurSummaryResponse
- Defined in:
- lib/assemblyai/lemur/types/lemur_summary_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#request_id ⇒ String
readonly
The ID of the LeMUR request.
-
#response ⇒ String
readonly
The response generated by LeMUR.
-
#usage ⇒ AssemblyAI::Lemur::LemurUsage
readonly
The usage numbers for the LeMUR request.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ AssemblyAI::Lemur::LemurSummaryResponse
Deserialize a JSON object to an instance of LemurSummaryResponse.
-
.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(response:, request_id:, usage:, additional_properties: nil) ⇒ AssemblyAI::Lemur::LemurSummaryResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of LemurSummaryResponse to a JSON object.
Constructor Details
#initialize(response:, request_id:, usage:, additional_properties: nil) ⇒ AssemblyAI::Lemur::LemurSummaryResponse
29 30 31 32 33 34 35 |
# File 'lib/assemblyai/lemur/types/lemur_summary_response.rb', line 29 def initialize(response:, request_id:, usage:, additional_properties: nil) @response = response @request_id = request_id @usage = usage @additional_properties = additional_properties @_field_set = { "response": response, "request_id": request_id, "usage": usage } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/assemblyai/lemur/types/lemur_summary_response.rb', line 17 def additional_properties @additional_properties end |
#request_id ⇒ String (readonly)
Returns The ID of the LeMUR request.
13 14 15 |
# File 'lib/assemblyai/lemur/types/lemur_summary_response.rb', line 13 def request_id @request_id end |
#response ⇒ String (readonly)
Returns The response generated by LeMUR.
11 12 13 |
# File 'lib/assemblyai/lemur/types/lemur_summary_response.rb', line 11 def response @response end |
#usage ⇒ AssemblyAI::Lemur::LemurUsage (readonly)
Returns The usage numbers for the LeMUR request.
15 16 17 |
# File 'lib/assemblyai/lemur/types/lemur_summary_response.rb', line 15 def usage @usage end |
Class Method Details
.from_json(json_object:) ⇒ AssemblyAI::Lemur::LemurSummaryResponse
Deserialize a JSON object to an instance of LemurSummaryResponse
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/assemblyai/lemur/types/lemur_summary_response.rb', line 41 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) response = struct["response"] request_id = struct["request_id"] if parsed_json["usage"].nil? usage = nil else usage = parsed_json["usage"].to_json usage = AssemblyAI::Lemur::LemurUsage.from_json(json_object: usage) end new( response: response, request_id: request_id, usage: usage, 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.
73 74 75 76 77 |
# File 'lib/assemblyai/lemur/types/lemur_summary_response.rb', line 73 def self.validate_raw(obj:) obj.response.is_a?(String) != false || raise("Passed value for field obj.response is not the expected type, validation failed.") obj.request_id.is_a?(String) != false || raise("Passed value for field obj.request_id is not the expected type, validation failed.") AssemblyAI::Lemur::LemurUsage.validate_raw(obj: obj.usage) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of LemurSummaryResponse to a JSON object
63 64 65 |
# File 'lib/assemblyai/lemur/types/lemur_summary_response.rb', line 63 def to_json(*_args) @_field_set&.to_json end |