Class: AssemblyAI::Lemur::LemurSummaryResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/assemblyai/lemur/types/lemur_summary_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response:, request_id:, usage:, additional_properties: nil) ⇒ AssemblyAI::Lemur::LemurSummaryResponse

Parameters:

  • response (String)

    The response generated by LeMUR.

  • request_id (String)

    The ID of the LeMUR request

  • usage (AssemblyAI::Lemur::LemurUsage)

    The usage numbers for the LeMUR request

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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_idString (readonly)

Returns The ID of the LeMUR request.

Returns:

  • (String)

    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

#responseString (readonly)

Returns The response generated by LeMUR.

Returns:

  • (String)

    The response generated by LeMUR.



11
12
13
# File 'lib/assemblyai/lemur/types/lemur_summary_response.rb', line 11

def response
  @response
end

#usageAssemblyAI::Lemur::LemurUsage (readonly)

Returns The usage numbers for the LeMUR request.

Returns:



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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


63
64
65
# File 'lib/assemblyai/lemur/types/lemur_summary_response.rb', line 63

def to_json(*_args)
  @_field_set&.to_json
end