Method: AssemblyAI::Transcripts::TranscriptWebhookNotification.from_json

Defined in:
lib/assemblyai/transcripts/types/transcript_webhook_notification.rb

.from_json(json_object:) ⇒ AssemblyAI::Transcripts::TranscriptWebhookNotification

Deserialize a JSON object to an instance of TranscriptWebhookNotification

Parameters:

  • json_object (String)

Returns:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/assemblyai/transcripts/types/transcript_webhook_notification.rb', line 15

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  begin
    AssemblyAI::Transcripts::TranscriptReadyNotification.validate_raw(obj: struct)
    unless json_object.nil?
      return AssemblyAI::Transcripts::TranscriptReadyNotification.from_json(json_object: json_object)
    end

    return nil
  rescue StandardError
    # noop
  end
  begin
    AssemblyAI::Transcripts::RedactedAudioResponse.validate_raw(obj: struct)
    unless json_object.nil?
      return AssemblyAI::Transcripts::RedactedAudioResponse.from_json(json_object: json_object)
    end

    return nil
  rescue StandardError
    # noop
  end
  struct
end