-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from AssemblyAI/fern-bot/06-27-2024-0121PM
🌿 Fern Regeneration -- June 27, 2024
- Loading branch information
Showing
9 changed files
with
107 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "lemur_usage" | ||
require "ostruct" | ||
require "json" | ||
|
||
module AssemblyAI | ||
class Lemur | ||
class LemurStringResponse | ||
# @return [String] The response generated by LeMUR. | ||
attr_reader :response | ||
# @return [String] The ID of the LeMUR request | ||
attr_reader :request_id | ||
# @return [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request | ||
attr_reader :usage | ||
# @return [OpenStruct] Additional properties unmapped to the current class definition | ||
attr_reader :additional_properties | ||
# @return [Object] | ||
attr_reader :_field_set | ||
protected :_field_set | ||
|
||
OMIT = Object.new | ||
|
||
# @param response [String] The response generated by LeMUR. | ||
# @param request_id [String] The ID of the LeMUR request | ||
# @param usage [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request | ||
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition | ||
# @return [AssemblyAI::Lemur::LemurStringResponse] | ||
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 | ||
|
||
# Deserialize a JSON object to an instance of LemurStringResponse | ||
# | ||
# @param json_object [String] | ||
# @return [AssemblyAI::Lemur::LemurStringResponse] | ||
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 | ||
|
||
# Serialize an instance of LemurStringResponse to a JSON object | ||
# | ||
# @return [String] | ||
def to_json(*_args) | ||
@_field_set&.to_json | ||
end | ||
|
||
# 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. | ||
# | ||
# @param obj [Object] | ||
# @return [Void] | ||
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 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
module AssemblyAI | ||
module Gemconfig | ||
VERSION = "1.0.0-beta.12" | ||
VERSION = "1.0.0-beta.13" | ||
AUTHORS = [""].freeze | ||
EMAIL = "[email protected]" | ||
SUMMARY = "AssemblyAI Ruby SDK" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters