Class: AssemblyAI::Lemur::LemurBaseResponse
- Inherits:
-
Object
- Object
- AssemblyAI::Lemur::LemurBaseResponse
- Defined in:
- lib/assemblyai/lemur/types/lemur_base_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.
-
#usage ⇒ AssemblyAI::Lemur::LemurUsage
readonly
The usage numbers for the LeMUR request.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ AssemblyAI::Lemur::LemurBaseResponse
Deserialize a JSON object to an instance of LemurBaseResponse.
-
.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(request_id:, usage:, additional_properties: nil) ⇒ AssemblyAI::Lemur::LemurBaseResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of LemurBaseResponse to a JSON object.
Constructor Details
#initialize(request_id:, usage:, additional_properties: nil) ⇒ AssemblyAI::Lemur::LemurBaseResponse
26 27 28 29 30 31 |
# File 'lib/assemblyai/lemur/types/lemur_base_response.rb', line 26 def initialize(request_id:, usage:, additional_properties: nil) @request_id = request_id @usage = usage @additional_properties = additional_properties @_field_set = { "request_id": request_id, "usage": usage } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/assemblyai/lemur/types/lemur_base_response.rb', line 15 def additional_properties @additional_properties end |
#request_id ⇒ String (readonly)
Returns The ID of the LeMUR request.
11 12 13 |
# File 'lib/assemblyai/lemur/types/lemur_base_response.rb', line 11 def request_id @request_id end |
#usage ⇒ AssemblyAI::Lemur::LemurUsage (readonly)
Returns The usage numbers for the LeMUR request.
13 14 15 |
# File 'lib/assemblyai/lemur/types/lemur_base_response.rb', line 13 def usage @usage end |
Class Method Details
.from_json(json_object:) ⇒ AssemblyAI::Lemur::LemurBaseResponse
Deserialize a JSON object to an instance of LemurBaseResponse
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/assemblyai/lemur/types/lemur_base_response.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) 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( 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.
67 68 69 70 |
# File 'lib/assemblyai/lemur/types/lemur_base_response.rb', line 67 def self.validate_raw(obj:) 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 LemurBaseResponse to a JSON object
57 58 59 |
# File 'lib/assemblyai/lemur/types/lemur_base_response.rb', line 57 def to_json(*_args) @_field_set&.to_json end |