-
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 #19 from AssemblyAI/fern-bot/03-09-2024-0336AM
🌿 Fern Regeneration -- March 9, 2024
- Loading branch information
Showing
6 changed files
with
72 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
# Specify files that shouldn't be modified by Fern | ||
|
||
README.md | ||
.gitignore | ||
test/ | ||
|
||
<!-- Allow for the polling client --> | ||
lib/assemblyai.rb | ||
lib/assemblyai/transcripts/polling_client.rb | ||
lib/assemblyai/transcripts/listing_client.rb | ||
lib/assemblyai/transcripts/list_by_url_client.rb | ||
lib/assemblyai/transcripts/types/polling_options.rb | ||
|
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
54 changes: 54 additions & 0 deletions
54
lib/assemblyai/transcripts/types/transcript_ready_notification.rb
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,54 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "transcript_ready_status" | ||
require "json" | ||
|
||
module AssemblyAI | ||
class Transcripts | ||
# The notification when the transcript status is completed or error. | ||
class TranscriptReadyNotification | ||
attr_reader :transcript_id, :status, :additional_properties | ||
|
||
# @param transcript_id [String] The ID of the transcript | ||
# @param status [Transcripts::TranscriptReadyStatus] The status of the transcript. Either completed or error. | ||
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition | ||
# @return [Transcripts::TranscriptReadyNotification] | ||
def initialize(transcript_id:, status:, additional_properties: nil) | ||
# @type [String] The ID of the transcript | ||
@transcript_id = transcript_id | ||
# @type [Transcripts::TranscriptReadyStatus] The status of the transcript. Either completed or error. | ||
@status = status | ||
# @type [OpenStruct] Additional properties unmapped to the current class definition | ||
@additional_properties = additional_properties | ||
end | ||
|
||
# Deserialize a JSON object to an instance of TranscriptReadyNotification | ||
# | ||
# @param json_object [JSON] | ||
# @return [Transcripts::TranscriptReadyNotification] | ||
def self.from_json(json_object:) | ||
struct = JSON.parse(json_object, object_class: OpenStruct) | ||
JSON.parse(json_object) | ||
transcript_id = struct.transcript_id | ||
status = struct.status | ||
new(transcript_id: transcript_id, status: status, additional_properties: struct) | ||
end | ||
|
||
# Serialize an instance of TranscriptReadyNotification to a JSON object | ||
# | ||
# @return [JSON] | ||
def to_json(*_args) | ||
{ "transcript_id": @transcript_id, "status": @status }.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.transcript_id.is_a?(String) != false || raise("Passed value for field obj.transcript_id is not the expected type, validation failed.") | ||
obj.status.is_a?(Transcripts::TranscriptReadyStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") | ||
end | ||
end | ||
end | ||
end |
11 changes: 11 additions & 0 deletions
11
lib/assemblyai/transcripts/types/transcript_ready_status.rb
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,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module AssemblyAI | ||
class Transcripts | ||
# The status of the transcript. Either completed or error. | ||
class TranscriptReadyStatus | ||
COMPLETED = "completed" | ||
ERROR = "error" | ||
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