bandwidth-sdk 12.0.0 → 13.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -2
  3. data/Gemfile.lock +13 -22
  4. data/README.md +3 -1
  5. data/Rakefile +4 -12
  6. data/bandwidth-sdk.gemspec +3 -1
  7. data/bandwidth.yml +48 -33
  8. data/coverage/.last_run.json +1 -1
  9. data/coverage/.resultset.json +1333 -1598
  10. data/coverage/index.html +6890 -9805
  11. data/custom_templates/Gemfile.mustache +1 -2
  12. data/custom_templates/gemspec.mustache +2 -0
  13. data/docs/AnswerCallback.md +2 -2
  14. data/docs/BridgeCompleteCallback.md +2 -2
  15. data/docs/BridgeTargetCompleteCallback.md +2 -2
  16. data/docs/CallRecordingMetadata.md +4 -4
  17. data/docs/CallState.md +1 -1
  18. data/docs/CallTranscription.md +6 -6
  19. data/docs/CallTranscriptionDetectedLanguageEnum.md +15 -0
  20. data/docs/CallTranscriptionResponse.md +2 -2
  21. data/docs/CallTranscriptionTrackEnum.md +15 -0
  22. data/docs/CallsApi.md +1 -1
  23. data/docs/ConferenceMemberExitCallback.md +1 -1
  24. data/docs/ConferenceMemberJoinCallback.md +1 -1
  25. data/docs/ConferenceRecordingAvailableCallback.md +1 -1
  26. data/docs/ConferenceRecordingMetadata.md +1 -1
  27. data/docs/CreateCall.md +5 -3
  28. data/docs/DisconnectCallback.md +2 -2
  29. data/docs/DtmfCallback.md +4 -4
  30. data/docs/GatherCallback.md +4 -4
  31. data/docs/InitiateCallback.md +2 -2
  32. data/docs/MachineDetectionCompleteCallback.md +2 -2
  33. data/docs/MessagingCodeResponse.md +1 -1
  34. data/docs/RecordingAvailableCallback.md +4 -4
  35. data/docs/RecordingCompleteCallback.md +4 -4
  36. data/docs/RecordingTranscriptionMetadata.md +1 -1
  37. data/docs/RedirectCallback.md +4 -4
  38. data/docs/TranscriptionAvailableCallback.md +4 -4
  39. data/docs/TranscriptionsApi.md +1 -1
  40. data/docs/TransferAnswerCallback.md +4 -4
  41. data/docs/TransferCompleteCallback.md +4 -4
  42. data/docs/TransferDisconnectCallback.md +4 -4
  43. data/lib/bandwidth-sdk/api/calls_api.rb +1 -1
  44. data/lib/bandwidth-sdk/api/conferences_api.rb +1 -1
  45. data/lib/bandwidth-sdk/api/media_api.rb +1 -1
  46. data/lib/bandwidth-sdk/api/messages_api.rb +1 -1
  47. data/lib/bandwidth-sdk/api/mfa_api.rb +1 -1
  48. data/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +1 -1
  49. data/lib/bandwidth-sdk/api/recordings_api.rb +1 -1
  50. data/lib/bandwidth-sdk/api/statistics_api.rb +1 -1
  51. data/lib/bandwidth-sdk/api/transcriptions_api.rb +3 -3
  52. data/lib/bandwidth-sdk/api_client.rb +44 -41
  53. data/lib/bandwidth-sdk/api_error.rb +1 -1
  54. data/lib/bandwidth-sdk/configuration.rb +11 -1
  55. data/lib/bandwidth-sdk/models/account_statistics.rb +2 -2
  56. data/lib/bandwidth-sdk/models/answer_callback.rb +3 -3
  57. data/lib/bandwidth-sdk/models/bridge_complete_callback.rb +3 -3
  58. data/lib/bandwidth-sdk/models/bridge_target_complete_callback.rb +3 -3
  59. data/lib/bandwidth-sdk/models/bxml/root.rb +0 -6
  60. data/lib/bandwidth-sdk/models/bxml/verbs/gather.rb +0 -6
  61. data/lib/bandwidth-sdk/models/bxml/verbs/start_stream.rb +0 -6
  62. data/lib/bandwidth-sdk/models/bxml/verbs/start_transcription.rb +0 -6
  63. data/lib/bandwidth-sdk/models/bxml/verbs/transfer.rb +0 -6
  64. data/lib/bandwidth-sdk/models/call_direction_enum.rb +1 -1
  65. data/lib/bandwidth-sdk/models/call_recording_metadata.rb +4 -4
  66. data/lib/bandwidth-sdk/models/call_state.rb +2 -2
  67. data/lib/bandwidth-sdk/models/call_state_enum.rb +1 -1
  68. data/lib/bandwidth-sdk/models/call_transcription.rb +11 -37
  69. data/lib/bandwidth-sdk/models/call_transcription_detected_language_enum.rb +41 -0
  70. data/lib/bandwidth-sdk/models/call_transcription_metadata.rb +2 -2
  71. data/lib/bandwidth-sdk/models/call_transcription_response.rb +2 -2
  72. data/lib/bandwidth-sdk/models/call_transcription_track_enum.rb +40 -0
  73. data/lib/bandwidth-sdk/models/callback_method_enum.rb +1 -1
  74. data/lib/bandwidth-sdk/models/code_request.rb +2 -2
  75. data/lib/bandwidth-sdk/models/conference.rb +2 -2
  76. data/lib/bandwidth-sdk/models/conference_completed_callback.rb +2 -2
  77. data/lib/bandwidth-sdk/models/conference_created_callback.rb +2 -2
  78. data/lib/bandwidth-sdk/models/conference_member.rb +2 -2
  79. data/lib/bandwidth-sdk/models/conference_member_exit_callback.rb +3 -3
  80. data/lib/bandwidth-sdk/models/conference_member_join_callback.rb +3 -3
  81. data/lib/bandwidth-sdk/models/conference_recording_available_callback.rb +2 -2
  82. data/lib/bandwidth-sdk/models/conference_recording_metadata.rb +2 -2
  83. data/lib/bandwidth-sdk/models/conference_redirect_callback.rb +2 -2
  84. data/lib/bandwidth-sdk/models/conference_state_enum.rb +1 -1
  85. data/lib/bandwidth-sdk/models/create_call.rb +16 -5
  86. data/lib/bandwidth-sdk/models/create_call_response.rb +2 -2
  87. data/lib/bandwidth-sdk/models/create_lookup_response.rb +2 -2
  88. data/lib/bandwidth-sdk/models/create_message_request_error.rb +2 -2
  89. data/lib/bandwidth-sdk/models/deferred_result.rb +2 -2
  90. data/lib/bandwidth-sdk/models/disconnect_callback.rb +3 -3
  91. data/lib/bandwidth-sdk/models/diversion.rb +2 -2
  92. data/lib/bandwidth-sdk/models/dtmf_callback.rb +4 -4
  93. data/lib/bandwidth-sdk/models/field_error.rb +2 -2
  94. data/lib/bandwidth-sdk/models/file_format_enum.rb +1 -1
  95. data/lib/bandwidth-sdk/models/gather_callback.rb +4 -4
  96. data/lib/bandwidth-sdk/models/inbound_message_callback.rb +2 -2
  97. data/lib/bandwidth-sdk/models/inbound_message_callback_message.rb +2 -2
  98. data/lib/bandwidth-sdk/models/initiate_callback.rb +3 -3
  99. data/lib/bandwidth-sdk/models/list_message_direction_enum.rb +1 -1
  100. data/lib/bandwidth-sdk/models/list_message_item.rb +2 -2
  101. data/lib/bandwidth-sdk/models/lookup_request.rb +2 -2
  102. data/lib/bandwidth-sdk/models/lookup_result.rb +2 -2
  103. data/lib/bandwidth-sdk/models/lookup_status.rb +2 -2
  104. data/lib/bandwidth-sdk/models/lookup_status_enum.rb +1 -1
  105. data/lib/bandwidth-sdk/models/machine_detection_complete_callback.rb +3 -3
  106. data/lib/bandwidth-sdk/models/machine_detection_configuration.rb +3 -3
  107. data/lib/bandwidth-sdk/models/machine_detection_mode_enum.rb +1 -1
  108. data/lib/bandwidth-sdk/models/machine_detection_result.rb +2 -2
  109. data/lib/bandwidth-sdk/models/media.rb +2 -2
  110. data/lib/bandwidth-sdk/models/message.rb +2 -2
  111. data/lib/bandwidth-sdk/models/message_delivered_callback.rb +2 -2
  112. data/lib/bandwidth-sdk/models/message_delivered_callback_message.rb +2 -2
  113. data/lib/bandwidth-sdk/models/message_direction_enum.rb +1 -1
  114. data/lib/bandwidth-sdk/models/message_failed_callback.rb +2 -2
  115. data/lib/bandwidth-sdk/models/message_failed_callback_message.rb +2 -2
  116. data/lib/bandwidth-sdk/models/message_request.rb +2 -2
  117. data/lib/bandwidth-sdk/models/message_sending_callback.rb +2 -2
  118. data/lib/bandwidth-sdk/models/message_sending_callback_message.rb +2 -2
  119. data/lib/bandwidth-sdk/models/message_status_enum.rb +1 -1
  120. data/lib/bandwidth-sdk/models/message_type_enum.rb +1 -1
  121. data/lib/bandwidth-sdk/models/messages_list.rb +2 -2
  122. data/lib/bandwidth-sdk/models/messaging_code_response.rb +2 -2
  123. data/lib/bandwidth-sdk/models/messaging_request_error.rb +2 -2
  124. data/lib/bandwidth-sdk/models/mfa_forbidden_request_error.rb +2 -2
  125. data/lib/bandwidth-sdk/models/mfa_request_error.rb +2 -2
  126. data/lib/bandwidth-sdk/models/mfa_unauthorized_request_error.rb +2 -2
  127. data/lib/bandwidth-sdk/models/page_info.rb +2 -2
  128. data/lib/bandwidth-sdk/models/priority_enum.rb +1 -1
  129. data/lib/bandwidth-sdk/models/recording_available_callback.rb +4 -4
  130. data/lib/bandwidth-sdk/models/recording_complete_callback.rb +4 -4
  131. data/lib/bandwidth-sdk/models/recording_state_enum.rb +1 -1
  132. data/lib/bandwidth-sdk/models/recording_transcription_metadata.rb +3 -3
  133. data/lib/bandwidth-sdk/models/recording_transcriptions.rb +2 -2
  134. data/lib/bandwidth-sdk/models/redirect_callback.rb +4 -4
  135. data/lib/bandwidth-sdk/models/redirect_method_enum.rb +1 -1
  136. data/lib/bandwidth-sdk/models/stir_shaken.rb +2 -2
  137. data/lib/bandwidth-sdk/models/tag.rb +2 -2
  138. data/lib/bandwidth-sdk/models/tn_lookup_request_error.rb +2 -2
  139. data/lib/bandwidth-sdk/models/transcribe_recording.rb +2 -2
  140. data/lib/bandwidth-sdk/models/transcription.rb +2 -2
  141. data/lib/bandwidth-sdk/models/transcription_available_callback.rb +4 -4
  142. data/lib/bandwidth-sdk/models/transfer_answer_callback.rb +4 -4
  143. data/lib/bandwidth-sdk/models/transfer_complete_callback.rb +4 -4
  144. data/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb +4 -4
  145. data/lib/bandwidth-sdk/models/update_call.rb +2 -2
  146. data/lib/bandwidth-sdk/models/update_call_recording.rb +2 -2
  147. data/lib/bandwidth-sdk/models/update_conference.rb +2 -2
  148. data/lib/bandwidth-sdk/models/update_conference_member.rb +2 -2
  149. data/lib/bandwidth-sdk/models/verify_code_request.rb +2 -2
  150. data/lib/bandwidth-sdk/models/verify_code_response.rb +2 -2
  151. data/lib/bandwidth-sdk/models/voice_api_error.rb +2 -2
  152. data/lib/bandwidth-sdk/models/voice_code_response.rb +2 -2
  153. data/lib/bandwidth-sdk/version.rb +2 -2
  154. data/lib/bandwidth-sdk.rb +3 -1
  155. data/openapitools.json +1 -1
  156. data/spec/call_utils.rb +1 -1
  157. data/spec/{integration/calls_api_integration_spec.rb → smoke/calls_api_spec.rb} +3 -6
  158. data/spec/{integration/conferences_api_integration_spec.rb → smoke/conferences_api_spec.rb} +0 -5
  159. data/spec/{integration/media_api_integration_spec.rb → smoke/media_api_spec.rb} +0 -5
  160. data/spec/{integration/messages_api_integration_spec.rb → smoke/messages_api_spec.rb} +0 -5
  161. data/spec/{integration/mfa_api_integration_spec.rb → smoke/mfa_api_spec.rb} +0 -5
  162. data/spec/{integration/phone_number_lookup_api_integration_spec.rb → smoke/phone_number_lookup_api_spec.rb} +0 -5
  163. data/spec/{integration/recordings_api_integration_spec.rb → smoke/recordings_api_spec.rb} +0 -5
  164. data/spec/{integration/statistics_api_integration_spec.rb → smoke/statistics_api_spec.rb} +0 -5
  165. data/spec/{integration/transcriptions_api_integration_spec.rb → smoke/transcriptions_api_spec.rb} +0 -5
  166. data/spec/spec_helper.rb +13 -6
  167. data/spec/unit/api/calls_api_spec.rb +233 -0
  168. data/spec/unit/api/conferences_api_spec.rb +330 -0
  169. data/spec/{api → unit/api}/media_api_spec.rb +17 -32
  170. data/spec/unit/api/messages_api_spec.rb +103 -0
  171. data/spec/{api → unit/api}/mfa_api_spec.rb +8 -24
  172. data/spec/unit/api/phone_number_lookup_api_spec.rb +86 -0
  173. data/spec/{api → unit/api}/recordings_api_spec.rb +83 -110
  174. data/spec/unit/api/statistics_api_spec.rb +37 -0
  175. data/spec/{api → unit/api}/transcriptions_api_spec.rb +18 -37
  176. data/spec/{api_client_spec.rb → unit/client/api_client_spec.rb} +4 -4
  177. metadata +136 -118
  178. data/spec/api/calls_api_spec.rb +0 -261
  179. data/spec/api/conferences_api_spec.rb +0 -393
  180. data/spec/api/messages_api_spec.rb +0 -193
  181. data/spec/api/phone_number_lookup_api_spec.rb +0 -100
  182. data/spec/api/statistics_api_spec.rb +0 -45
  183. /data/spec/{api_error_spec.rb → unit/client/api_error_spec.rb} +0 -0
  184. /data/spec/{configuration_spec.rb → unit/client/configuration_spec.rb} +0 -0
  185. /data/spec/{models → unit/models}/bxml/bxml_spec.rb +0 -0
  186. /data/spec/{models → unit/models}/bxml/nestable_verb_spec.rb +0 -0
  187. /data/spec/{models → unit/models}/bxml/response_spec.rb +0 -0
  188. /data/spec/{models → unit/models}/bxml/verb_spec.rb +0 -0
  189. /data/spec/{models → unit/models}/bxml/verbs/bridge_spec.rb +0 -0
  190. /data/spec/{models → unit/models}/bxml/verbs/conference_spec.rb +0 -0
  191. /data/spec/{models → unit/models}/bxml/verbs/custom_param_spec.rb +0 -0
  192. /data/spec/{models → unit/models}/bxml/verbs/forward_spec.rb +0 -0
  193. /data/spec/{models → unit/models}/bxml/verbs/gather_spec.rb +0 -0
  194. /data/spec/{models → unit/models}/bxml/verbs/hangup_spec.rb +0 -0
  195. /data/spec/{models → unit/models}/bxml/verbs/pause_recording_spec.rb +0 -0
  196. /data/spec/{models → unit/models}/bxml/verbs/pause_spec.rb +0 -0
  197. /data/spec/{models → unit/models}/bxml/verbs/phone_number_spec.rb +0 -0
  198. /data/spec/{models → unit/models}/bxml/verbs/play_audio_spec.rb +0 -0
  199. /data/spec/{models → unit/models}/bxml/verbs/record_spec.rb +0 -0
  200. /data/spec/{models → unit/models}/bxml/verbs/redirect_spec.rb +0 -0
  201. /data/spec/{models → unit/models}/bxml/verbs/resume_recording_spec.rb +0 -0
  202. /data/spec/{models → unit/models}/bxml/verbs/ring_spec.rb +0 -0
  203. /data/spec/{models → unit/models}/bxml/verbs/send_dtmf_spec.rb +0 -0
  204. /data/spec/{models → unit/models}/bxml/verbs/sip_uri_spec.rb +0 -0
  205. /data/spec/{models → unit/models}/bxml/verbs/speak_sentence_spec.rb +0 -0
  206. /data/spec/{models → unit/models}/bxml/verbs/start_gather_spec.rb +0 -0
  207. /data/spec/{models → unit/models}/bxml/verbs/start_recording_spec.rb +0 -0
  208. /data/spec/{models → unit/models}/bxml/verbs/start_stream_spec.rb +0 -0
  209. /data/spec/{models → unit/models}/bxml/verbs/start_transcription_spec.rb +0 -0
  210. /data/spec/{models → unit/models}/bxml/verbs/stop_gather_spec.rb +0 -0
  211. /data/spec/{models → unit/models}/bxml/verbs/stop_recording_spec.rb +0 -0
  212. /data/spec/{models → unit/models}/bxml/verbs/stop_stream_spec.rb +0 -0
  213. /data/spec/{models → unit/models}/bxml/verbs/stop_transcription_spec.rb +0 -0
  214. /data/spec/{models → unit/models}/bxml/verbs/stream_param_spec.rb +0 -0
  215. /data/spec/{models → unit/models}/bxml/verbs/tag_spec.rb +0 -0
  216. /data/spec/{models → unit/models}/bxml/verbs/transfer_spec.rb +0 -0
  217. /data/spec/{models → unit/models}/call_state_enum_spec.rb +0 -0
  218. /data/spec/{models → unit/models}/call_state_spec.rb +0 -0
  219. /data/spec/{models → unit/models}/deferred_result_spec.rb +0 -0
  220. /data/spec/{models → unit/models}/message_spec.rb +0 -0
  221. /data/spec/{models → unit/models}/verify_code_request_spec.rb +0 -0
@@ -3,6 +3,7 @@ require_relative '../call_utils'
3
3
  # Integration Tests for Bandwidth::CallsApi
4
4
  describe 'CallsApi Integration Tests' do
5
5
  # call info
6
+ let(:privacy) { false }
6
7
  let(:display_name) { 'Ruby SDK' }
7
8
  let(:answer_method) { Bandwidth::CallbackMethodEnum::POST }
8
9
  let(:answer_url) { BASE_CALLBACK_URL + '/callbacks/answer' }
@@ -15,7 +16,6 @@ describe 'CallsApi Integration Tests' do
15
16
  let(:callback_timeout) { 15.0 }
16
17
 
17
18
  before(:all) do
18
- WebMock.allow_net_connect!
19
19
  Bandwidth.configure do |config|
20
20
  config.username = BW_USERNAME
21
21
  config.password = BW_PASSWORD
@@ -26,10 +26,6 @@ describe 'CallsApi Integration Tests' do
26
26
  $call_info_id = ''
27
27
  end
28
28
 
29
- after(:all) do
30
- WebMock.disable_net_connect!
31
- end
32
-
33
29
  # Create Call
34
30
  describe 'create_call' do
35
31
  it 'creates a call with amd' do
@@ -48,6 +44,7 @@ describe 'CallsApi Integration Tests' do
48
44
  application_id: BW_VOICE_APPLICATION_ID,
49
45
  to: USER_NUMBER,
50
46
  from: BW_NUMBER,
47
+ privacy: privacy,
51
48
  display_name: display_name,
52
49
  answer_url: answer_url,
53
50
  answer_method: answer_method,
@@ -114,7 +111,7 @@ describe 'CallsApi Integration Tests' do
114
111
 
115
112
  # Update Call
116
113
  describe 'update_call' do
117
- it 'creates and updates a call' do
114
+ it 'creates and updates a call' do
118
115
  update_call_body = Bandwidth::UpdateCall.new(
119
116
  state: Bandwidth::CallStateEnum::ACTIVE,
120
117
  redirect_url: MANTECA_BASE_URL + '/bxml/pause'
@@ -3,7 +3,6 @@ require_relative '../call_utils'
3
3
  # Integration Tests for Bandwidth::ConferencesApi
4
4
  describe 'ConferencesApi Integration Tests' do
5
5
  before(:all) do
6
- WebMock.allow_net_connect!
7
6
  Bandwidth.configure do |config|
8
7
  config.username = BW_USERNAME
9
8
  config.password = BW_PASSWORD
@@ -18,10 +17,6 @@ describe 'ConferencesApi Integration Tests' do
18
17
  $conference_id = ''
19
18
  $recording_id = ''
20
19
  end
21
-
22
- after(:all) do
23
- WebMock.disable_net_connect!
24
- end
25
20
 
26
21
  # Get Conferences
27
22
  describe 'list_conferences' do
@@ -6,7 +6,6 @@ describe 'MediaApi Integration Tests' do
6
6
  let(:media_file_md5) { Digest::MD5.hexdigest(media_file_data) }
7
7
 
8
8
  before(:all) do
9
- WebMock.allow_net_connect!
10
9
  Bandwidth.configure do |config|
11
10
  config.username = BW_USERNAME
12
11
  config.password = BW_PASSWORD
@@ -19,10 +18,6 @@ describe 'MediaApi Integration Tests' do
19
18
  @media_file_name = 'ruby_media_file' + SecureRandom.uuid
20
19
  end
21
20
 
22
- after(:all) do
23
- WebMock.disable_net_connect!
24
- end
25
-
26
21
  # Upload Media
27
22
  describe 'upload_media' do
28
23
  it 'uploads binary media' do
@@ -10,7 +10,6 @@ describe 'MessagesApi Integration Tests' do
10
10
  let(:list_message_direction) { Bandwidth::ListMessageDirectionEnum::OUTBOUND }
11
11
 
12
12
  before(:all) do
13
- WebMock.allow_net_connect!
14
13
  Bandwidth.configure do |config|
15
14
  config.username = BW_USERNAME
16
15
  config.password = BW_PASSWORD
@@ -21,10 +20,6 @@ describe 'MessagesApi Integration Tests' do
21
20
  @expiration_time = (Time.now + 60).round.to_datetime.rfc3339
22
21
  end
23
22
 
24
- after(:all) do
25
- WebMock.disable_net_connect!
26
- end
27
-
28
23
  # Create Message
29
24
  describe 'create_message' do
30
25
  it 'creates an mms message' do
@@ -5,7 +5,6 @@ describe 'MFAApi Integration Tests' do
5
5
  let(:digits) { 6 }
6
6
 
7
7
  before(:all) do
8
- WebMock.allow_net_connect!
9
8
  Bandwidth.configure do |config|
10
9
  config.username = BW_USERNAME
11
10
  config.password = BW_PASSWORD
@@ -13,10 +12,6 @@ describe 'MFAApi Integration Tests' do
13
12
  @mfa_api_instance = Bandwidth::MFAApi.new
14
13
  end
15
14
 
16
- after(:all) do
17
- WebMock.disable_net_connect!
18
- end
19
-
20
15
  # Messaging Authentication Code
21
16
  describe 'generate_messaging_code' do
22
17
  it 'generates messaging mfa code' do
@@ -1,7 +1,6 @@
1
1
  # Integration Tests for Bandwidth::PhoneNumberLookupApi
2
2
  describe 'PhoneNumberLookupApi Integration Tests' do
3
3
  before(:all) do
4
- WebMock.allow_net_connect!
5
4
  Bandwidth.configure do |config|
6
5
  config.username = BW_USERNAME
7
6
  config.password = BW_PASSWORD
@@ -12,10 +11,6 @@ describe 'PhoneNumberLookupApi Integration Tests' do
12
11
  $lookup_request_id = ''
13
12
  end
14
13
 
15
- after(:all) do
16
- WebMock.disable_net_connect!
17
- end
18
-
19
14
  # Create Lookup
20
15
  describe 'create_lookup' do
21
16
  it 'creates a tn lookup request' do
@@ -3,7 +3,6 @@ require_relative '../call_utils'
3
3
  # Integration Tests for Bandwidth::RecordingsApi
4
4
  describe 'RecordingsApi Integration Tests' do
5
5
  before(:all) do
6
- WebMock.allow_net_connect!
7
6
  Bandwidth.configure do |config|
8
7
  config.username = BW_USERNAME
9
8
  config.password = BW_PASSWORD
@@ -17,10 +16,6 @@ describe 'RecordingsApi Integration Tests' do
17
16
  $manteca_call_id = create_manteca_call($manteca_test_id, '/bxml/startLongRecording', @calls_api_instance)
18
17
  $recording_id = ''
19
18
  end
20
-
21
- after(:all) do
22
- WebMock.disable_net_connect!
23
- end
24
19
 
25
20
  # Update Recording
26
21
  describe 'update_call_recording_state' do
@@ -1,7 +1,6 @@
1
1
  # Integration Tests for Bandwidth::StatisticsApi
2
2
  describe 'StatisticsApi Integration Tests' do
3
3
  before(:all) do
4
- WebMock.allow_net_connect!
5
4
  Bandwidth.configure do |config|
6
5
  config.username = BW_USERNAME
7
6
  config.password = BW_PASSWORD
@@ -9,10 +8,6 @@ describe 'StatisticsApi Integration Tests' do
9
8
  @statistics_api_instance = Bandwidth::StatisticsApi.new
10
9
  end
11
10
 
12
- after(:all) do
13
- WebMock.disable_net_connect!
14
- end
15
-
16
11
  # Get Account Statistics
17
12
  describe 'get_statistics' do
18
13
  it 'gets account statistics' do
@@ -3,7 +3,6 @@ require_relative '../call_utils'
3
3
  # Integration Tests for Bandwidth::TranscriptionsApi
4
4
  describe 'TranscriptionsApi Integration Tests' do
5
5
  before(:all) do
6
- WebMock.allow_net_connect!
7
6
  Bandwidth.configure do |config|
8
7
  config.username = BW_USERNAME
9
8
  config.password = BW_PASSWORD
@@ -17,10 +16,6 @@ describe 'TranscriptionsApi Integration Tests' do
17
16
  $transcription_id = ''
18
17
  end
19
18
 
20
- after(:all) do
21
- WebMock.disable_net_connect!
22
- end
23
-
24
19
  # Create Call Transcription
25
20
  describe 'create_call_transcription' do
26
21
  it 'creates a call transcription' do
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # Test Coverage Configuration
2
2
  require 'simplecov'
3
3
  SimpleCov.start do
4
- add_filter 'spec/integration'
4
+ add_filter 'spec/smoke'
5
5
  add_filter 'spec/call_utils.rb'
6
6
  add_filter do |source_file|
7
7
  if !source_file.filename.include? 'bandwidth-sdk/models' then
@@ -9,7 +9,7 @@ SimpleCov.start do
9
9
  else
10
10
  !(['/models/call_state_enum.rb',
11
11
  '/models/call_state.rb',
12
- '/models/deferred_result.rb',
12
+ '/models/deferred_result.rb',
13
13
  '/models/message.rb',
14
14
  '/models/verify_code_request.rb'
15
15
  ].any? { |name| source_file.filename.include?(name) })
@@ -27,9 +27,6 @@ require 'bandwidth-sdk'
27
27
  # load call utils every time. This prevents an error from occuring when running only unit tests
28
28
  require_relative './call_utils'
29
29
 
30
- # use webmock to stub HTTP requests
31
- require 'webmock/rspec'
32
-
33
30
  # The following was generated by the `rspec --init` command. Conventionally, all
34
31
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
35
32
  # The generated `.rspec` file contains `--require spec_helper` which will cause
@@ -89,8 +86,18 @@ RSpec.configure do |config|
89
86
  config.password = BW_PASSWORD
90
87
  end
91
88
  calls_api = Bandwidth::CallsApi.new
92
- # cleanup_calls($active_calls, calls_api) # left out due to voice API issues
89
+ cleanup_calls($active_calls, calls_api)
93
90
  }
91
+
92
+ RSpec::Matchers.define(:be_one_of) do |expected|
93
+ match do |actual|
94
+ expected.include?(actual)
95
+ end
96
+
97
+ failure_message do |actual|
98
+ "expected one of #{expected}, got #{actual}"
99
+ end
100
+ end
94
101
 
95
102
  # rspec-expectations config goes here. You can use an alternate
96
103
  # assertion/expectation library such as wrong or the stdlib/minitest
@@ -0,0 +1,233 @@
1
+ # Unit tests for Bandwidth::CallsApi
2
+ describe 'CallsApi' do
3
+ let(:call_id) { 'c-1234' }
4
+
5
+ before(:all) do
6
+ Bandwidth.configure do |config|
7
+ config.debugging = true
8
+ config.username = BW_USERNAME
9
+ config.password = BW_PASSWORD
10
+ config.ignore_operation_servers = true
11
+ config.host = '127.0.0.1:4010'
12
+ end
13
+ @calls_api_instance = Bandwidth::CallsApi.new
14
+ end
15
+
16
+ describe 'test an instance of CallsApi' do
17
+ it 'should create an instance of CallsApi' do
18
+ expect(@calls_api_instance).to be_instance_of(Bandwidth::CallsApi)
19
+ end
20
+ end
21
+
22
+ # Create Call
23
+ describe '#create_call' do
24
+ it 'creates a call with amd' do
25
+ amd_config = Bandwidth::MachineDetectionConfiguration.new(
26
+ mode: Bandwidth::MachineDetectionModeEnum::ASYNC,
27
+ detection_timeout: 15.0,
28
+ silence_timeout: 10.0,
29
+ speech_threshold: 10.0,
30
+ speech_end_threshold: 5.0,
31
+ machine_speech_end_threshold: 5.0,
32
+ delay_result: false,
33
+ callback_url: 'https://myServer.com/bandwidth/webhooks/machineDetectionComplete',
34
+ callback_method: Bandwidth::CallbackMethodEnum::POST,
35
+ username: 'mySecretUsername',
36
+ password: 'mySecretPassword1!',
37
+ fallback_url: 'https://myFallbackServer.com/bandwidth/webhooks/machineDetectionComplete',
38
+ fallback_method: Bandwidth::CallbackMethodEnum::POST,
39
+ fallback_username: 'mySecretUsername',
40
+ fallback_password: 'mySecretPassword1!',
41
+ )
42
+
43
+ call_body = Bandwidth::CreateCall.new(
44
+ to: USER_NUMBER,
45
+ from: BW_NUMBER,
46
+ application_id: BW_VOICE_APPLICATION_ID,
47
+ answer_url: BASE_CALLBACK_URL,
48
+ answer_method: Bandwidth::CallbackMethodEnum::POST,
49
+ username: 'mySecretUsername',
50
+ password: 'mySecretPassword1!',
51
+ answer_fallback_url: 'https://www.myFallbackServer.com/webhooks/answer',
52
+ answer_fallback_method: Bandwidth::CallbackMethodEnum::POST,
53
+ fallback_username: 'mySecretUsername',
54
+ fallback_password: 'mySecretPassword1!',
55
+ disconnect_url: 'https://myServer.com/bandwidth/webhooks/disconnectUrl',
56
+ disconnect_method: Bandwidth::CallbackMethodEnum::POST,
57
+ call_timeout: 30.0,
58
+ callback_timeout: 15.0,
59
+ machine_detection: amd_config,
60
+ priority: 5,
61
+ tag: 'tag_example',
62
+ )
63
+
64
+ data, status_code = @calls_api_instance.create_call_with_http_info(BW_ACCOUNT_ID, call_body)
65
+
66
+ expect(status_code).to eq(201)
67
+ expect(data).to be_instance_of(Bandwidth::CreateCallResponse)
68
+ expect(data.application_id.length).to eq(36)
69
+ expect(data.account_id.length).to eq(7)
70
+ expect(data.call_id.length).to eq(47)
71
+ expect(data.to.length).to eq(12)
72
+ expect(data.from.length).to eq(12)
73
+ expect(data.enqueued_time).to be_instance_of(Time)
74
+ expect(data.call_url).to start_with('http')
75
+ expect(data.call_timeout).to be_instance_of(Float)
76
+ expect(data.callback_timeout).to be_instance_of(Float)
77
+ expect(data.tag).to be_instance_of(String)
78
+ expect(data.answer_method).to be_one_of(Bandwidth::CallbackMethodEnum.all_vars)
79
+ expect(data.answer_url).to start_with('http')
80
+ expect(data.answer_fallback_method).to be_one_of(Bandwidth::CallbackMethodEnum.all_vars)
81
+ expect(data.answer_fallback_url).to start_with('http')
82
+ expect(data.disconnect_method).to be_one_of(Bandwidth::CallbackMethodEnum.all_vars)
83
+ expect(data.disconnect_url).to start_with('http')
84
+ expect(data.username).to be_instance_of(String)
85
+ expect(data.password).to be_instance_of(String)
86
+ expect(data.fallback_username).to be_instance_of(String)
87
+ expect(data.fallback_password).to be_instance_of(String)
88
+ expect(data.priority).to be_instance_of(Integer)
89
+ end
90
+
91
+ it 'causes an ArgumentError for a missing account_id' do
92
+ expect {
93
+ @calls_api_instance.create_call(nil, {})
94
+ }.to raise_error(ArgumentError)
95
+ end
96
+
97
+ it 'causes an ArgumentError for a missing create_call' do
98
+ expect {
99
+ @calls_api_instance.create_call(BW_ACCOUNT_ID, nil)
100
+ }.to raise_error(ArgumentError)
101
+ end
102
+ end
103
+
104
+ # Get Calls
105
+ describe '#list_calls' do
106
+ it 'gets a list of calls' do
107
+ data, status_code = @calls_api_instance.list_calls_with_http_info(BW_ACCOUNT_ID)
108
+
109
+ expect(status_code).to eq(200)
110
+ expect(data).to be_instance_of(Array)
111
+ expect(data[0]).to be_instance_of(Bandwidth::CallState)
112
+ expect(data[0].application_id.length).to eq(36)
113
+ expect(data[0].account_id.length).to eq(7)
114
+ expect(data[0].call_id.length).to eq(47)
115
+ expect(data[0].parent_call_id.length).to eq(47)
116
+ expect(data[0].to.length).to eq(12)
117
+ expect(data[0].from.length).to eq(12)
118
+ expect(data[0].direction).to be_one_of(Bandwidth::CallDirectionEnum.all_vars)
119
+ expect(data[0].state).to be_instance_of(String)
120
+ expect(data[0].stir_shaken).to be_instance_of(Hash)
121
+ expect(data[0].identity).to be_instance_of(String)
122
+ expect(data[0].enqueued_time).to be_instance_of(Time)
123
+ expect(data[0].start_time).to be_instance_of(Time)
124
+ expect(data[0].answer_time).to be_instance_of(Time)
125
+ expect(data[0].end_time).to be_instance_of(Time)
126
+ expect(data[0].disconnect_cause).to be_instance_of(String)
127
+ expect(data[0]).to respond_to(:error_message)
128
+ expect(data[0]).to respond_to(:error_id)
129
+ expect(data[0].last_update).to be_instance_of(Time)
130
+ end
131
+ end
132
+
133
+ # # Get Call State Information
134
+ describe '#get_call_state' do
135
+ it 'gets the call state' do
136
+ data, status_code = @calls_api_instance.get_call_state_with_http_info(BW_ACCOUNT_ID, call_id)
137
+
138
+ expect(status_code).to eq(200)
139
+ expect(data).to be_instance_of(Bandwidth::CallState)
140
+ expect(data.application_id.length).to eq(36)
141
+ expect(data.account_id.length).to eq(7)
142
+ expect(data.call_id.length).to eq(47)
143
+ expect(data.parent_call_id.length).to eq(47)
144
+ expect(data.to.length).to eq(12)
145
+ expect(data.from.length).to eq(12)
146
+ expect(data.direction).to be_one_of(Bandwidth::CallDirectionEnum.all_vars)
147
+ expect(data.state).to be_instance_of(String)
148
+ expect(data.stir_shaken).to be_instance_of(Hash)
149
+ expect(data.identity).to be_instance_of(String)
150
+ expect(data.enqueued_time).to be_instance_of(Time)
151
+ expect(data.start_time).to be_instance_of(Time)
152
+ expect(data.answer_time).to be_instance_of(Time)
153
+ expect(data.end_time).to be_instance_of(Time)
154
+ expect(data.disconnect_cause).to be_instance_of(String)
155
+ expect(data).to respond_to(:error_message)
156
+ expect(data).to respond_to(:error_id)
157
+ expect(data.last_update).to be_instance_of(Time)
158
+ end
159
+
160
+ it 'causes an ArgumentError for a missing account_id' do
161
+ expect {
162
+ @calls_api_instance.get_call_state(nil, '')
163
+ }.to raise_error(ArgumentError)
164
+ end
165
+
166
+ it 'causes an ArgumentError for a missing call_id' do
167
+ expect {
168
+ @calls_api_instance.get_call_state(BW_ACCOUNT_ID, nil)
169
+ }.to raise_error(ArgumentError)
170
+ end
171
+ end
172
+
173
+ # # Update Call
174
+ describe '#update_call' do
175
+ it 'creates and updates a call' do
176
+ update_call_body = Bandwidth::UpdateCall.new(
177
+ state: Bandwidth::CallStateEnum::ACTIVE,
178
+ redirect_url: MANTECA_BASE_URL + '/bxml/pause'
179
+ )
180
+
181
+ _data, status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, call_id, update_call_body)
182
+
183
+ expect(status_code).to eq(200)
184
+ end
185
+
186
+ it 'causes an ArgumentError for a missing account_id' do
187
+ expect {
188
+ @calls_api_instance.update_call(nil, '', {})
189
+ }.to raise_error(ArgumentError)
190
+ end
191
+
192
+ it 'causes an ArgumentError for a missing call_id' do
193
+ expect {
194
+ @calls_api_instance.update_call(BW_ACCOUNT_ID, nil, {})
195
+ }.to raise_error(ArgumentError)
196
+ end
197
+
198
+ it 'causes an ArgumentError for a missing update_call' do
199
+ expect {
200
+ @calls_api_instance.update_call(BW_ACCOUNT_ID, '', nil)
201
+ }.to raise_error(ArgumentError)
202
+ end
203
+ end
204
+
205
+ # Update Call BXML
206
+ describe '#update_call_bxml' do
207
+ it 'updates a call using bxml' do
208
+ update_bxml = "<?xml version='1.0' encoding='UTF-8'?><Bxml><SpeakSentence locale='en_US' gender='female' voice='susan'>This is a test bxml response</SpeakSentence><Pause duration='3'/></Bxml>"
209
+
210
+ _data, status_code = @calls_api_instance.update_call_bxml_with_http_info(BW_ACCOUNT_ID, call_id, update_bxml)
211
+
212
+ expect(status_code).to eq(204)
213
+ end
214
+
215
+ it 'causes an ArgumentError for a missing account_id' do
216
+ expect {
217
+ @calls_api_instance.update_call_bxml(nil, '', {})
218
+ }.to raise_error(ArgumentError)
219
+ end
220
+
221
+ it 'causes an ArgumentError for a missing call_id' do
222
+ expect {
223
+ @calls_api_instance.update_call_bxml(BW_ACCOUNT_ID, nil, {})
224
+ }.to raise_error(ArgumentError)
225
+ end
226
+
227
+ it 'causes an ArgumentError for a missing body' do
228
+ expect {
229
+ @calls_api_instance.update_call_bxml(BW_ACCOUNT_ID, '', nil)
230
+ }.to raise_error(ArgumentError)
231
+ end
232
+ end
233
+ end