bandwidth-sdk 11.3.0 → 12.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +18 -16
  3. data/README.md +15 -9
  4. data/Rakefile +4 -12
  5. data/bandwidth.yml +243 -28
  6. data/coverage/.last_run.json +1 -1
  7. data/coverage/.resultset.json +1412 -1009
  8. data/coverage/index.html +16274 -11823
  9. data/custom_templates/README.mustache +4 -4
  10. data/docs/AnswerCallback.md +1 -1
  11. data/docs/BridgeCompleteCallback.md +1 -1
  12. data/docs/BridgeTargetCompleteCallback.md +1 -1
  13. data/docs/CallRecordingMetadata.md +3 -3
  14. data/docs/CallTranscription.md +24 -0
  15. data/docs/CallTranscriptionMetadata.md +20 -0
  16. data/docs/CallTranscriptionResponse.md +24 -0
  17. data/docs/CallsApi.md +1 -1
  18. data/docs/ConferenceMemberExitCallback.md +1 -1
  19. data/docs/ConferenceMemberJoinCallback.md +1 -1
  20. data/docs/CreateCall.md +5 -3
  21. data/docs/DisconnectCallback.md +1 -1
  22. data/docs/DtmfCallback.md +2 -2
  23. data/docs/GatherCallback.md +2 -2
  24. data/docs/InitiateCallback.md +1 -1
  25. data/docs/MachineDetectionCompleteCallback.md +1 -1
  26. data/docs/RecordingAvailableCallback.md +4 -4
  27. data/docs/RecordingCompleteCallback.md +2 -2
  28. data/docs/RecordingTranscriptionMetadata.md +24 -0
  29. data/docs/RecordingTranscriptions.md +18 -0
  30. data/docs/RecordingsApi.md +49 -49
  31. data/docs/RedirectCallback.md +2 -2
  32. data/docs/TranscriptionAvailableCallback.md +2 -2
  33. data/docs/TranscriptionsApi.md +229 -0
  34. data/docs/TransferAnswerCallback.md +2 -2
  35. data/docs/TransferCompleteCallback.md +2 -2
  36. data/docs/TransferDisconnectCallback.md +2 -2
  37. data/lib/bandwidth-sdk/api/recordings_api.rb +56 -56
  38. data/lib/bandwidth-sdk/api/transcriptions_api.rb +241 -0
  39. data/lib/bandwidth-sdk/configuration.rb +22 -4
  40. data/lib/bandwidth-sdk/models/answer_callback.rb +1 -1
  41. data/lib/bandwidth-sdk/models/bridge_complete_callback.rb +1 -1
  42. data/lib/bandwidth-sdk/models/bridge_target_complete_callback.rb +1 -1
  43. data/lib/bandwidth-sdk/models/call_recording_metadata.rb +3 -3
  44. data/lib/bandwidth-sdk/models/call_transcription.rb +317 -0
  45. data/lib/bandwidth-sdk/models/call_transcription_metadata.rb +223 -0
  46. data/lib/bandwidth-sdk/models/call_transcription_response.rb +244 -0
  47. data/lib/bandwidth-sdk/models/conference_member_exit_callback.rb +1 -1
  48. data/lib/bandwidth-sdk/models/conference_member_join_callback.rb +1 -1
  49. data/lib/bandwidth-sdk/models/create_call.rb +14 -3
  50. data/lib/bandwidth-sdk/models/disconnect_callback.rb +1 -1
  51. data/lib/bandwidth-sdk/models/dtmf_callback.rb +2 -2
  52. data/lib/bandwidth-sdk/models/gather_callback.rb +2 -2
  53. data/lib/bandwidth-sdk/models/initiate_callback.rb +1 -1
  54. data/lib/bandwidth-sdk/models/machine_detection_complete_callback.rb +1 -1
  55. data/lib/bandwidth-sdk/models/machine_detection_configuration.rb +1 -1
  56. data/lib/bandwidth-sdk/models/recording_available_callback.rb +4 -4
  57. data/lib/bandwidth-sdk/models/recording_complete_callback.rb +2 -2
  58. data/lib/bandwidth-sdk/models/recording_transcription_metadata.rb +244 -0
  59. data/lib/bandwidth-sdk/models/recording_transcriptions.rb +214 -0
  60. data/lib/bandwidth-sdk/models/redirect_callback.rb +2 -2
  61. data/lib/bandwidth-sdk/models/transcription_available_callback.rb +2 -2
  62. data/lib/bandwidth-sdk/models/transfer_answer_callback.rb +2 -2
  63. data/lib/bandwidth-sdk/models/transfer_complete_callback.rb +2 -2
  64. data/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb +2 -2
  65. data/lib/bandwidth-sdk/version.rb +1 -1
  66. data/lib/bandwidth-sdk.rb +6 -2
  67. data/spec/{integration/calls_api_integration_spec.rb → smoke/calls_api_spec.rb} +9 -7
  68. data/spec/{integration/conferences_api_integration_spec.rb → smoke/conferences_api_spec.rb} +9 -9
  69. data/spec/{integration/media_api_integration_spec.rb → smoke/media_api_spec.rb} +7 -7
  70. data/spec/{integration/messages_api_integration_spec.rb → smoke/messages_api_spec.rb} +3 -3
  71. data/spec/{integration/mfa_api_integration_spec.rb → smoke/mfa_api_spec.rb} +3 -3
  72. data/spec/{integration/phone_number_lookup_api_integration_spec.rb → smoke/phone_number_lookup_api_spec.rb} +2 -2
  73. data/spec/{integration/recordings_api_integration_spec.rb → smoke/recordings_api_spec.rb} +14 -14
  74. data/spec/{integration/statistics_api_integration_spec.rb → smoke/statistics_api_spec.rb} +1 -1
  75. data/spec/smoke/transcriptions_api_spec.rb +84 -0
  76. data/spec/spec_helper.rb +2 -2
  77. data/spec/{api → unit/api}/calls_api_spec.rb +6 -4
  78. data/spec/{api → unit/api}/conferences_api_spec.rb +12 -12
  79. data/spec/{api → unit/api}/media_api_spec.rb +6 -6
  80. data/spec/{api → unit/api}/messages_api_spec.rb +2 -2
  81. data/spec/{api → unit/api}/mfa_api_spec.rb +6 -6
  82. data/spec/{api → unit/api}/phone_number_lookup_api_spec.rb +2 -2
  83. data/spec/{api → unit/api}/recordings_api_spec.rb +30 -30
  84. data/spec/{api → unit/api}/statistics_api_spec.rb +1 -1
  85. data/spec/unit/api/transcriptions_api_spec.rb +130 -0
  86. data/spec/{api_client_spec.rb → unit/client/api_client_spec.rb} +2 -2
  87. metadata +130 -114
  88. /data/spec/{api_error_spec.rb → unit/client/api_error_spec.rb} +0 -0
  89. /data/spec/{configuration_spec.rb → unit/client/configuration_spec.rb} +0 -0
  90. /data/spec/{models → unit/models}/bxml/bxml_spec.rb +0 -0
  91. /data/spec/{models → unit/models}/bxml/nestable_verb_spec.rb +0 -0
  92. /data/spec/{models → unit/models}/bxml/response_spec.rb +0 -0
  93. /data/spec/{models → unit/models}/bxml/verb_spec.rb +0 -0
  94. /data/spec/{models → unit/models}/bxml/verbs/bridge_spec.rb +0 -0
  95. /data/spec/{models → unit/models}/bxml/verbs/conference_spec.rb +0 -0
  96. /data/spec/{models → unit/models}/bxml/verbs/custom_param_spec.rb +0 -0
  97. /data/spec/{models → unit/models}/bxml/verbs/forward_spec.rb +0 -0
  98. /data/spec/{models → unit/models}/bxml/verbs/gather_spec.rb +0 -0
  99. /data/spec/{models → unit/models}/bxml/verbs/hangup_spec.rb +0 -0
  100. /data/spec/{models → unit/models}/bxml/verbs/pause_recording_spec.rb +0 -0
  101. /data/spec/{models → unit/models}/bxml/verbs/pause_spec.rb +0 -0
  102. /data/spec/{models → unit/models}/bxml/verbs/phone_number_spec.rb +0 -0
  103. /data/spec/{models → unit/models}/bxml/verbs/play_audio_spec.rb +0 -0
  104. /data/spec/{models → unit/models}/bxml/verbs/record_spec.rb +0 -0
  105. /data/spec/{models → unit/models}/bxml/verbs/redirect_spec.rb +0 -0
  106. /data/spec/{models → unit/models}/bxml/verbs/resume_recording_spec.rb +0 -0
  107. /data/spec/{models → unit/models}/bxml/verbs/ring_spec.rb +0 -0
  108. /data/spec/{models → unit/models}/bxml/verbs/send_dtmf_spec.rb +0 -0
  109. /data/spec/{models → unit/models}/bxml/verbs/sip_uri_spec.rb +0 -0
  110. /data/spec/{models → unit/models}/bxml/verbs/speak_sentence_spec.rb +0 -0
  111. /data/spec/{models → unit/models}/bxml/verbs/start_gather_spec.rb +0 -0
  112. /data/spec/{models → unit/models}/bxml/verbs/start_recording_spec.rb +0 -0
  113. /data/spec/{models → unit/models}/bxml/verbs/start_stream_spec.rb +0 -0
  114. /data/spec/{models → unit/models}/bxml/verbs/start_transcription_spec.rb +0 -0
  115. /data/spec/{models → unit/models}/bxml/verbs/stop_gather_spec.rb +0 -0
  116. /data/spec/{models → unit/models}/bxml/verbs/stop_recording_spec.rb +0 -0
  117. /data/spec/{models → unit/models}/bxml/verbs/stop_stream_spec.rb +0 -0
  118. /data/spec/{models → unit/models}/bxml/verbs/stop_transcription_spec.rb +0 -0
  119. /data/spec/{models → unit/models}/bxml/verbs/stream_param_spec.rb +0 -0
  120. /data/spec/{models → unit/models}/bxml/verbs/tag_spec.rb +0 -0
  121. /data/spec/{models → unit/models}/bxml/verbs/transfer_spec.rb +0 -0
  122. /data/spec/{models → unit/models}/call_state_enum_spec.rb +0 -0
  123. /data/spec/{models → unit/models}/call_state_spec.rb +0 -0
  124. /data/spec/{models → unit/models}/deferred_result_spec.rb +0 -0
  125. /data/spec/{models → unit/models}/message_spec.rb +0 -0
  126. /data/spec/{models → unit/models}/verify_code_request_spec.rb +0 -0
@@ -41,7 +41,7 @@ describe 'MFAApi' do
41
41
  digits: digits
42
42
  )
43
43
 
44
- data, status_code, headers = @mfa_api_instance.generate_messaging_code_with_http_info(BW_ACCOUNT_ID, req_schema)
44
+ data, status_code = @mfa_api_instance.generate_messaging_code_with_http_info(BW_ACCOUNT_ID, req_schema)
45
45
 
46
46
  expect(status_code).to eq(200)
47
47
  expect(data).to be_instance_of(Bandwidth::MessagingCodeResponse)
@@ -50,7 +50,7 @@ describe 'MFAApi' do
50
50
 
51
51
  it 'causes an ArgumentError for a missing account_id' do
52
52
  expect {
53
- resp = @mfa_api_instance.generate_messaging_code(nil, {})
53
+ @mfa_api_instance.generate_messaging_code(nil, {})
54
54
  }.to raise_error(ArgumentError)
55
55
  end
56
56
 
@@ -75,7 +75,7 @@ describe 'MFAApi' do
75
75
  digits: digits
76
76
  )
77
77
 
78
- data, status_code, headers = @mfa_api_instance.generate_voice_code_with_http_info(BW_ACCOUNT_ID, req_schema)
78
+ data, status_code = @mfa_api_instance.generate_voice_code_with_http_info(BW_ACCOUNT_ID, req_schema)
79
79
 
80
80
  expect(status_code).to eq(200)
81
81
  expect(data).to be_instance_of(Bandwidth::VoiceCodeResponse)
@@ -84,7 +84,7 @@ describe 'MFAApi' do
84
84
 
85
85
  it 'causes an ArgumentError for a missing account_id' do
86
86
  expect {
87
- resp = @mfa_api_instance.generate_voice_code(nil, {})
87
+ @mfa_api_instance.generate_voice_code(nil, {})
88
88
  }.to raise_error(ArgumentError)
89
89
  end
90
90
 
@@ -108,7 +108,7 @@ describe 'MFAApi' do
108
108
  code: '12345'
109
109
  )
110
110
 
111
- data, status_code, headers = @mfa_api_instance.verify_code_with_http_info(BW_ACCOUNT_ID, req_schema)
111
+ data, status_code = @mfa_api_instance.verify_code_with_http_info(BW_ACCOUNT_ID, req_schema)
112
112
 
113
113
  expect(status_code).to eq(200)
114
114
  expect(data).to be_instance_of(Bandwidth::VerifyCodeResponse)
@@ -117,7 +117,7 @@ describe 'MFAApi' do
117
117
 
118
118
  it 'causes an ArgumentError for a missing account_id' do
119
119
  expect {
120
- resp = @mfa_api_instance.verify_code(nil, {})
120
+ @mfa_api_instance.verify_code(nil, {})
121
121
  }.to raise_error(ArgumentError)
122
122
  end
123
123
 
@@ -50,7 +50,7 @@ describe 'PhoneNumberLookupApi' do
50
50
 
51
51
  it 'causes an ArgumentError for a missing account_id' do
52
52
  expect {
53
- resp = @phone_number_lookup_api_instance.create_lookup(nil, {})
53
+ @phone_number_lookup_api_instance.create_lookup(nil, {})
54
54
  }.to raise_error(ArgumentError)
55
55
  end
56
56
 
@@ -87,7 +87,7 @@ describe 'PhoneNumberLookupApi' do
87
87
 
88
88
  it 'causes an ArgumentError for a missing account_id' do
89
89
  expect {
90
- resp = @phone_number_lookup_api_instance.get_lookup_status(nil, '')
90
+ @phone_number_lookup_api_instance.get_lookup_status(nil, '')
91
91
  }.to raise_error(ArgumentError)
92
92
  end
93
93
 
@@ -20,8 +20,8 @@ describe 'RecordingsApi' do
20
20
  let(:download_call_recording_headers_stub) { { 'content-type' => 'audio/vnd.wave', 'content-length' => "#{download_call_recording_body_stub.length}" } }
21
21
  let(:get_call_recording_headers_stub) { { 'content-type' => 'application/json' } }
22
22
  let(:get_call_recording_body_stub) { "{\"applicationId\":\"#{BW_VOICE_APPLICATION_ID}\",\"accountId\":\"#{BW_ACCOUNT_ID}\",\"callId\":\"#{call_id}\",\"recordingId\":\"#{recording_id}\",\"to\":\"#{USER_NUMBER}\",\"from\":\"#{BW_NUMBER}\",\"duration\":\"#{duration}\",\"direction\":\"#{direction}\",\"channels\":#{channels},\"startTime\":\"#{start_time}\",\"endTime\":\"#{end_time}\",\"fileFormat\":\"#{file_format}\",\"status\":\"#{status}\",\"mediaUrl\":\"#{media_url}\"}" }
23
- let(:get_call_transcription_headers_stub) { { 'content-type' => 'application/json' } }
24
- let(:get_call_transcription_body_stub) { "{\"transcripts\":[{\"text\":\"#{text}\",\"confidence\":#{confidence}}]}" }
23
+ let(:get_recording_transcription_headers_stub) { { 'content-type' => 'application/json' } }
24
+ let(:get_recording_transcription_body_stub) { "{\"transcripts\":[{\"text\":\"#{text}\",\"confidence\":#{confidence}}]}" }
25
25
  let(:list_account_call_recordings_headers_stub) { { 'content-type' => 'application/json' } }
26
26
  let(:list_account_call_recordings_body_stub) { "[{\"applicationId\":\"#{BW_VOICE_APPLICATION_ID}\",\"accountId\":\"#{BW_ACCOUNT_ID}\",\"callId\":\"#{call_id}\",\"recordingId\":\"#{recording_id}\",\"to\":\"#{USER_NUMBER}\",\"from\":\"#{BW_NUMBER}\",\"duration\":\"#{duration}\",\"direction\":\"#{direction}\",\"channels\":#{channels},\"startTime\":\"#{start_time}\",\"endTime\":\"#{end_time}\",\"fileFormat\":\"#{file_format}\",\"status\":\"#{status}\",\"mediaUrl\":\"#{media_url}\"}]" }
27
27
  let(:list_call_recordings_headers_stub) { { 'content-type' => 'application/json' } }
@@ -42,32 +42,32 @@ describe 'RecordingsApi' do
42
42
  end
43
43
  end
44
44
 
45
- # Delete Transcription
46
- describe 'delete_call_transcription' do
45
+ # Delete Recording Transcription
46
+ describe 'delete_recording_transcription' do
47
47
  it 'deletes the completed call recording transcription' do
48
48
  stub_request(:delete, "https://voice.bandwidth.com/api/v2/accounts/#{BW_ACCOUNT_ID}/calls/#{call_id}/recordings/#{recording_id}/transcription").
49
49
  to_return(status: 204)
50
50
 
51
- data, status_code, headers = @recordings_api_instance.delete_call_transcription_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
51
+ _data, status_code = @recordings_api_instance.delete_recording_transcription_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
52
52
 
53
53
  expect(status_code).to eq(204)
54
54
  end
55
55
 
56
56
  it 'causes an ArgumentError for a missing account_id' do
57
57
  expect {
58
- resp = @recordings_api_instance.delete_call_transcription(nil, '', '')
58
+ @recordings_api_instance.delete_recording_transcription(nil, '', '')
59
59
  }.to raise_error(ArgumentError)
60
60
  end
61
61
 
62
62
  it 'causes an ArgumentError for a missing call_id' do
63
63
  expect {
64
- @recordings_api_instance.delete_call_transcription(BW_ACCOUNT_ID, nil, '')
64
+ @recordings_api_instance.delete_recording_transcription(BW_ACCOUNT_ID, nil, '')
65
65
  }.to raise_error(ArgumentError)
66
66
  end
67
67
 
68
68
  it 'causes an ArgumentError for a missing recording_id' do
69
69
  expect {
70
- @recordings_api_instance.delete_call_transcription(BW_ACCOUNT_ID, '', nil)
70
+ @recordings_api_instance.delete_recording_transcription(BW_ACCOUNT_ID, '', nil)
71
71
  }.to raise_error(ArgumentError)
72
72
  end
73
73
  end
@@ -78,14 +78,14 @@ describe 'RecordingsApi' do
78
78
  stub_request(:delete, "https://voice.bandwidth.com/api/v2/accounts/#{BW_ACCOUNT_ID}/calls/#{call_id}/recordings/#{recording_id}").
79
79
  to_return(status: 204)
80
80
 
81
- data, status_code, headers = @recordings_api_instance.delete_recording_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
81
+ _data, status_code = @recordings_api_instance.delete_recording_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
82
82
 
83
83
  expect(status_code).to eq(204)
84
84
  end
85
85
 
86
86
  it 'causes an ArgumentError for a missing account_id' do
87
87
  expect {
88
- resp = @recordings_api_instance.delete_recording(nil, '', '')
88
+ @recordings_api_instance.delete_recording(nil, '', '')
89
89
  }.to raise_error(ArgumentError)
90
90
  end
91
91
 
@@ -108,14 +108,14 @@ describe 'RecordingsApi' do
108
108
  stub_request(:delete, "https://voice.bandwidth.com/api/v2/accounts/#{BW_ACCOUNT_ID}/calls/#{call_id}/recordings/#{recording_id}/media").
109
109
  to_return(status: 204)
110
110
 
111
- data, status_code, headers = @recordings_api_instance.delete_recording_media_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
111
+ _data, status_code = @recordings_api_instance.delete_recording_media_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
112
112
 
113
113
  expect(status_code).to eq(204)
114
114
  end
115
115
 
116
116
  it 'causes an ArgumentError for a missing account_id' do
117
117
  expect {
118
- resp = @recordings_api_instance.delete_recording_media(nil, '', '')
118
+ @recordings_api_instance.delete_recording_media(nil, '', '')
119
119
  }.to raise_error(ArgumentError)
120
120
  end
121
121
 
@@ -147,7 +147,7 @@ describe 'RecordingsApi' do
147
147
 
148
148
  it 'causes an ArgumentError for a missing account_id' do
149
149
  expect {
150
- resp = @recordings_api_instance.download_call_recording(nil, '', '')
150
+ @recordings_api_instance.download_call_recording(nil, '', '')
151
151
  }.to raise_error(ArgumentError)
152
152
  end
153
153
 
@@ -193,7 +193,7 @@ describe 'RecordingsApi' do
193
193
 
194
194
  it 'causes an ArgumentError for a missing account_id' do
195
195
  expect {
196
- resp = @recordings_api_instance.get_call_recording(nil, '', '')
196
+ @recordings_api_instance.get_call_recording(nil, '', '')
197
197
  }.to raise_error(ArgumentError)
198
198
  end
199
199
 
@@ -210,16 +210,16 @@ describe 'RecordingsApi' do
210
210
  end
211
211
  end
212
212
 
213
- # Get Transcription
214
- describe 'get_call_transcription' do
213
+ # Get Recording Transcription
214
+ describe 'get_recording_transcription' do
215
215
  it 'gets the completed call recording transcription' do
216
216
  stub_request(:get, "https://voice.bandwidth.com/api/v2/accounts/#{BW_ACCOUNT_ID}/calls/#{call_id}/recordings/#{recording_id}/transcription").
217
- to_return(status: 200, headers: get_call_transcription_headers_stub, body: get_call_transcription_body_stub)
217
+ to_return(status: 200, headers: get_recording_transcription_headers_stub, body: get_recording_transcription_body_stub)
218
218
 
219
- data, status_code, headers = @recordings_api_instance.get_call_transcription_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
219
+ data, status_code = @recordings_api_instance.get_recording_transcription_with_http_info(BW_ACCOUNT_ID, call_id, recording_id)
220
220
 
221
221
  expect(status_code).to eq(200)
222
- expect(data).to be_instance_of(Bandwidth::TranscriptionList)
222
+ expect(data).to be_instance_of(Bandwidth::RecordingTranscriptions)
223
223
  expect(data.transcripts).to be_instance_of(Array)
224
224
  expect(data.transcripts[0]).to be_instance_of(Bandwidth::Transcription)
225
225
  expect(data.transcripts[0].text).to eq(text)
@@ -228,19 +228,19 @@ describe 'RecordingsApi' do
228
228
 
229
229
  it 'causes an ArgumentError for a missing account_id' do
230
230
  expect {
231
- resp = @recordings_api_instance.get_call_transcription(nil, '', '')
231
+ @recordings_api_instance.get_recording_transcription(nil, '', '')
232
232
  }.to raise_error(ArgumentError)
233
233
  end
234
234
 
235
235
  it 'causes an ArgumentError for a missing call_id' do
236
236
  expect {
237
- @recordings_api_instance.get_call_transcription(BW_ACCOUNT_ID, nil, '')
237
+ @recordings_api_instance.get_recording_transcription(BW_ACCOUNT_ID, nil, '')
238
238
  }.to raise_error(ArgumentError)
239
239
  end
240
240
 
241
241
  it 'causes an ArgumentError for a missing recording_id' do
242
242
  expect {
243
- @recordings_api_instance.get_call_transcription(BW_ACCOUNT_ID, '', nil)
243
+ @recordings_api_instance.get_recording_transcription(BW_ACCOUNT_ID, '', nil)
244
244
  }.to raise_error(ArgumentError)
245
245
  end
246
246
  end
@@ -251,7 +251,7 @@ describe 'RecordingsApi' do
251
251
  stub_request(:get, "https://voice.bandwidth.com/api/v2/accounts/#{BW_ACCOUNT_ID}/recordings").
252
252
  to_return(status: 200, headers: list_account_call_recordings_headers_stub, body: list_account_call_recordings_body_stub)
253
253
 
254
- data, status_code, headers = @recordings_api_instance.list_account_call_recordings_with_http_info(BW_ACCOUNT_ID)
254
+ data, status_code = @recordings_api_instance.list_account_call_recordings_with_http_info(BW_ACCOUNT_ID)
255
255
 
256
256
  expect(status_code).to eq(200)
257
257
  expect(data).to be_instance_of(Array)
@@ -274,7 +274,7 @@ describe 'RecordingsApi' do
274
274
 
275
275
  it 'causes an ArgumentError for a missing account_id' do
276
276
  expect {
277
- resp = @recordings_api_instance.list_account_call_recordings(nil)
277
+ @recordings_api_instance.list_account_call_recordings(nil)
278
278
  }.to raise_error(ArgumentError)
279
279
  end
280
280
  end
@@ -285,7 +285,7 @@ describe 'RecordingsApi' do
285
285
  stub_request(:get, "https://voice.bandwidth.com/api/v2/accounts/#{BW_ACCOUNT_ID}/calls/#{call_id}/recordings").
286
286
  to_return(status: 200, headers: list_call_recordings_headers_stub, body: list_call_recordings_body_stub)
287
287
 
288
- data, status_code, headers = @recordings_api_instance.list_call_recordings_with_http_info(BW_ACCOUNT_ID, call_id)
288
+ data, status_code = @recordings_api_instance.list_call_recordings_with_http_info(BW_ACCOUNT_ID, call_id)
289
289
 
290
290
  expect(status_code).to eq(200)
291
291
  expect(data).to be_instance_of(Array)
@@ -307,7 +307,7 @@ describe 'RecordingsApi' do
307
307
 
308
308
  it 'causes an ArgumentError for a missing account_id' do
309
309
  expect {
310
- resp = @recordings_api_instance.list_call_recordings(nil, '')
310
+ @recordings_api_instance.list_call_recordings(nil, '')
311
311
  }.to raise_error(ArgumentError)
312
312
  end
313
313
 
@@ -329,14 +329,14 @@ describe 'RecordingsApi' do
329
329
  tag: test_id
330
330
  )
331
331
 
332
- data, status_code, headers = @recordings_api_instance.transcribe_call_recording_with_http_info(BW_ACCOUNT_ID, call_id, recording_id, transcribe_recording)
332
+ _data, status_code = @recordings_api_instance.transcribe_call_recording_with_http_info(BW_ACCOUNT_ID, call_id, recording_id, transcribe_recording)
333
333
 
334
334
  expect(status_code).to eq(204)
335
335
  end
336
336
 
337
337
  it 'causes an ArgumentError for a missing account_id' do
338
338
  expect {
339
- resp = @recordings_api_instance.transcribe_call_recording(nil, '', '', '')
339
+ @recordings_api_instance.transcribe_call_recording(nil, '', '', '')
340
340
  }.to raise_error(ArgumentError)
341
341
  end
342
342
 
@@ -369,14 +369,14 @@ describe 'RecordingsApi' do
369
369
  state: Bandwidth::RecordingStateEnum::PAUSED
370
370
  )
371
371
 
372
- data, status_code, headers = @recordings_api_instance.update_call_recording_state_with_http_info(BW_ACCOUNT_ID, call_id, pause_recording)
372
+ _data, status_code = @recordings_api_instance.update_call_recording_state_with_http_info(BW_ACCOUNT_ID, call_id, pause_recording)
373
373
 
374
374
  expect(status_code).to eq(200)
375
375
  end
376
376
 
377
377
  it 'causes an ArgumentError for a missing account_id' do
378
378
  expect {
379
- resp = @recordings_api_instance.update_call_recording_state(nil, '', {})
379
+ @recordings_api_instance.update_call_recording_state(nil, '', {})
380
380
  }.to raise_error(ArgumentError)
381
381
  end
382
382
 
@@ -38,7 +38,7 @@ describe 'StatisticsApi' do
38
38
 
39
39
  it 'causes an ArgumentError for a missing account_id' do
40
40
  expect {
41
- resp = @statistics_api_instance.get_statistics(nil)
41
+ @statistics_api_instance.get_statistics(nil)
42
42
  }.to raise_error(ArgumentError)
43
43
  end
44
44
  end
@@ -0,0 +1,130 @@
1
+ # Unit tests for Bandwidth::TranscriptionsApi
2
+ describe 'TranscriptionsApi' do
3
+ # transcription info
4
+ let(:call_id) { 'c-3f758f24-40c0bd9f-0a8e-4ab6-88d4-c88a2e961c7d' }
5
+ let(:transcription_id) { 't-3f758f24-c7a2fc78-7c91-401a-8b2e-e542f9c40d6b' }
6
+ let(:transcription_url) { "https://voice.bandwidth.com/api/v2/accounts/#{BW_ACCOUNT_ID}/calls/#{call_id}/transcriptions/#{transcription_id}" }
7
+ let(:detected_language) { 'en-US' }
8
+ let(:track) { 'inbound' }
9
+ let(:text) { 'Hello World! This is an example.' }
10
+ let(:confidence) { 0.9 }
11
+
12
+ # stubs
13
+ let(:list_real_time_transcriptions_headers_stub) { { 'content-type' => 'application/json' } }
14
+ let(:list_real_time_transcriptions_body_stub) { "[{\"transcriptionId\":\"#{transcription_id}\",\"transcriptionUrl\":\"#{transcription_url}\"}]" }
15
+ let(:get_real_time_transcription_headers_stub) { { 'content-type' => 'application/json' } }
16
+ let(:get_real_time_transcription_body_stub) { "{\"accountId\":\"#{BW_ACCOUNT_ID}\",\"callId\":\"#{call_id}\",\"transcriptionId\":\"#{transcription_id}\",\"tracks\":[{\"detectedLanguage\":\"#{detected_language}\",\"track\":\"#{track}\",\"text\":\"#{text}\",\"confidence\":#{confidence}}]}" }
17
+
18
+ before(:all) do
19
+ Bandwidth.configure do |config|
20
+ config.debugging = true
21
+ end
22
+ @transcriptions_api_instance = Bandwidth::TranscriptionsApi.new
23
+ end
24
+
25
+ describe 'test an instance of TranscriptionsApi' do
26
+ it 'should create an instance of TranscriptionsApi' do
27
+ expect(@transcriptions_api_instance).to be_instance_of(Bandwidth::TranscriptionsApi)
28
+ end
29
+ end
30
+
31
+ # Delete Call Transcription
32
+ describe 'delete_real_time_transcription' do
33
+ it 'deletes the specified call transcription' do
34
+ stub_request(:delete, "https://voice.bandwidth.com/api/v2/accounts/#{BW_ACCOUNT_ID}/calls/#{call_id}/transcriptions/#{transcription_id}").
35
+ to_return(status: 204)
36
+
37
+ _data, status_code = @transcriptions_api_instance.delete_real_time_transcription_with_http_info(BW_ACCOUNT_ID, call_id, transcription_id)
38
+
39
+ expect(status_code).to eq(204)
40
+ end
41
+
42
+ it 'causes an ArgumentError for a missing account_id' do
43
+ expect {
44
+ @transcriptions_api_instance.delete_real_time_transcription(nil, '', '')
45
+ }.to raise_error(ArgumentError)
46
+ end
47
+
48
+ it 'causes an ArgumentError for a missing call_id' do
49
+ expect {
50
+ @transcriptions_api_instance.delete_real_time_transcription(BW_ACCOUNT_ID, nil, '')
51
+ }.to raise_error(ArgumentError)
52
+ end
53
+
54
+ it 'causes an ArgumentError for a missing transcription_id' do
55
+ expect {
56
+ @transcriptions_api_instance.delete_real_time_transcription(BW_ACCOUNT_ID, '', nil)
57
+ }.to raise_error(ArgumentError)
58
+ end
59
+ end
60
+
61
+ # List Call Transcriptions
62
+ describe 'list_real_time_transcriptions' do
63
+ it 'lists call transcriptions' do
64
+ stub_request(:get, "https://voice.bandwidth.com/api/v2/accounts/#{BW_ACCOUNT_ID}/calls/#{call_id}/transcriptions").
65
+ to_return(status: 200, headers: list_real_time_transcriptions_headers_stub, body: list_real_time_transcriptions_body_stub)
66
+
67
+ data, status_code, headers = @transcriptions_api_instance.list_real_time_transcriptions_with_http_info(BW_ACCOUNT_ID, call_id)
68
+
69
+ expect(status_code).to eq(200)
70
+ expect(headers).to eq(list_real_time_transcriptions_headers_stub)
71
+ expect(data).to be_instance_of(Array)
72
+ expect(data[0]).to be_instance_of(Bandwidth::CallTranscriptionMetadata)
73
+ expect(data[0].transcription_id).to eq(transcription_id)
74
+ expect(data[0].transcription_url).to eq(transcription_url)
75
+ end
76
+
77
+ it 'causes an ArgumentError for a missing account_id' do
78
+ expect {
79
+ @transcriptions_api_instance.list_real_time_transcriptions(nil, '')
80
+ }.to raise_error(ArgumentError)
81
+ end
82
+
83
+ it 'causes an ArgumentError for a missing call_id' do
84
+ expect {
85
+ @transcriptions_api_instance.list_real_time_transcriptions(BW_ACCOUNT_ID, nil)
86
+ }.to raise_error(ArgumentError)
87
+ end
88
+ end
89
+
90
+ # Get Call Transcription
91
+ describe 'get_real_time_transcription' do
92
+ it 'gets the specified call transcription' do
93
+ stub_request(:get, "https://voice.bandwidth.com/api/v2/accounts/#{BW_ACCOUNT_ID}/calls/#{call_id}/transcriptions/#{transcription_id}").
94
+ to_return(status: 200, headers: get_real_time_transcription_headers_stub, body: get_real_time_transcription_body_stub)
95
+
96
+ data, status_code, headers = @transcriptions_api_instance.get_real_time_transcription_with_http_info(BW_ACCOUNT_ID, call_id, transcription_id)
97
+
98
+ expect(status_code).to eq(200)
99
+ expect(headers).to eq(get_real_time_transcription_headers_stub)
100
+ expect(data).to be_instance_of(Bandwidth::CallTranscriptionResponse)
101
+ expect(data.account_id).to eq(BW_ACCOUNT_ID)
102
+ expect(data.call_id).to eq(call_id)
103
+ expect(data.transcription_id).to eq(transcription_id)
104
+ expect(data.tracks).to be_instance_of(Array)
105
+ expect(data.tracks[0]).to be_instance_of(Bandwidth::CallTranscription)
106
+ expect(data.tracks[0].detected_language).to eq(detected_language)
107
+ expect(data.tracks[0].track).to eq(track)
108
+ expect(data.tracks[0].text).to eq(text)
109
+ expect(data.tracks[0].confidence).to eq(confidence)
110
+ end
111
+
112
+ it 'causes an ArgumentError for a missing account_id' do
113
+ expect {
114
+ @transcriptions_api_instance.get_real_time_transcription(nil, '', '')
115
+ }.to raise_error(ArgumentError)
116
+ end
117
+
118
+ it 'causes an ArgumentError for a missing call_id' do
119
+ expect {
120
+ @transcriptions_api_instance.get_real_time_transcription(BW_ACCOUNT_ID, nil, '')
121
+ }.to raise_error(ArgumentError)
122
+ end
123
+
124
+ it 'causes an ArgumentError for a missing transcription_id' do
125
+ expect {
126
+ @transcriptions_api_instance.get_real_time_transcription(BW_ACCOUNT_ID, '', nil)
127
+ }.to raise_error(ArgumentError)
128
+ end
129
+ end
130
+ end
@@ -111,7 +111,7 @@ describe Bandwidth::ApiClient do
111
111
  auth_names: ['Basic'],
112
112
  return_type: nil
113
113
  }
114
- data, status_code, headers = api_client.call_api(:POST, 'path', opts)
114
+ data, status_code = api_client.call_api(:POST, 'path', opts)
115
115
 
116
116
  expect(status_code).to eq(204)
117
117
  expect(data).to be nil
@@ -130,7 +130,7 @@ describe Bandwidth::ApiClient do
130
130
  auth_names: ['Basic'],
131
131
  return_type: nil
132
132
  }
133
- data, status_code, headers = api_client.call_api(:POST, 'path', opts)
133
+ data, status_code = api_client.call_api(:POST, 'path', opts)
134
134
 
135
135
  expect(status_code).to eq(204)
136
136
  expect(data).to be nil