@@ -11,6 +11,18 @@ def api_key
1111 ENV . fetch ( "ASSEMBLYAI_API_KEY" )
1212 end
1313
14+ # @return [String] AssemblyAI Base URL
15+ def base_url
16+ ENV . key? ( "ASSEMBLYAI_BASE_URL" ) ? ENV . fetch ( "ASSEMBLYAI_BASE_URL" ) : AssemblyAI ::Environment ::DEFAULT
17+ end
18+
19+ def client
20+ AssemblyAI ::Client . new (
21+ api_key : api_key ,
22+ environment : base_url
23+ )
24+ end
25+
1426 # @return [String] Transcript ID
1527 def transcript_id
1628 ENV . fetch ( "TEST_TRANSCRIPT_ID" )
@@ -22,20 +34,17 @@ def transcript_ids
2234 end
2335
2436 def test_upload_file_with_file
25- client = AssemblyAI ::Client . new ( api_key : api_key )
2637 file = File . new ( "./test/gore-short.wav" )
2738 uploaded_file = client . files . upload ( file : file )
2839 assert !uploaded_file . upload_url . nil?
2940 end
3041
3142 def test_upload_file_with_path
32- client = AssemblyAI ::Client . new ( api_key : api_key )
3343 uploaded_file = client . files . upload ( file : "./test/gore-short.wav" )
3444 assert !uploaded_file . upload_url . nil?
3545 end
3646
3747 def test_upload_file_with_base64_string
38- client = AssemblyAI ::Client . new ( api_key : api_key )
3948 uploaded_file = client . files . upload ( file : File . read ( "./test/gore-short.wav" ) )
4049 assert !uploaded_file . upload_url . nil?
4150 end
@@ -46,7 +55,6 @@ def test_init
4655 end
4756
4857 def test_pagination
49- client = AssemblyAI ::Client . new ( api_key : api_key )
5058 transcript_list = client . transcripts . list
5159
5260 count = 0
@@ -69,24 +77,19 @@ def test_pagination
6977 end
7078
7179 def test_transcribe
72- client = AssemblyAI ::Client . new ( api_key : api_key )
7380 transcript = client . transcripts . transcribe ( audio_url : "https://storage.googleapis.com/aai-web-samples/espn-bears.m4a" )
7481 assert transcript . status == AssemblyAI ::Transcripts ::TranscriptStatus ::COMPLETED
7582 end
7683
7784 def test_submit
7885 # Transcribe
79- client = AssemblyAI ::Client . new ( api_key : api_key )
80-
8186 transcript_submission = client . transcripts . submit ( audio_url : "https://storage.googleapis.com/aai-web-samples/espn-bears.m4a" )
8287 assert !transcript_submission . id . nil?
8388 gotten_transcript = client . transcripts . get ( transcript_id : transcript_submission . id )
8489 assert gotten_transcript . id == transcript_submission . id
8590 end
8691
8792 def test_polling
88- client = AssemblyAI ::Client . new ( api_key : api_key )
89-
9093 transcript = client . transcripts . submit ( audio_url : "https://storage.googleapis.com/aai-web-samples/espn-bears.m4a" )
9194 assert !transcript . id . nil?
9295
@@ -95,7 +98,6 @@ def test_polling
9598 end
9699
97100 def test_lemur
98- client = AssemblyAI ::Client . new ( api_key : api_key )
99101 assert !client . lemur . summary ( transcript_ids : transcript_ids ) . response . nil?
100102
101103 qa_response = client . lemur . question_answer (
0 commit comments