bandwidth-sdk 11.0.0.pre.beta.1.1 → 11.0.0.pre.beta.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (380) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +44 -20
  4. data/README.md +7 -3
  5. data/Rakefile +10 -2
  6. data/bandwidth-sdk.gemspec +12 -12
  7. data/bandwidth.yml +401 -352
  8. data/coverage/.last_run.json +5 -0
  9. data/coverage/.resultset.json +9792 -0
  10. data/coverage/.resultset.json.lock +0 -0
  11. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
  12. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
  13. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
  14. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
  15. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
  16. data/coverage/assets/0.12.3/application.css +1 -0
  17. data/coverage/assets/0.12.3/application.js +7 -0
  18. data/coverage/assets/0.12.3/colorbox/border.png +0 -0
  19. data/coverage/assets/0.12.3/colorbox/controls.png +0 -0
  20. data/coverage/assets/0.12.3/colorbox/loading.gif +0 -0
  21. data/coverage/assets/0.12.3/colorbox/loading_background.png +0 -0
  22. data/coverage/assets/0.12.3/favicon_green.png +0 -0
  23. data/coverage/assets/0.12.3/favicon_red.png +0 -0
  24. data/coverage/assets/0.12.3/favicon_yellow.png +0 -0
  25. data/coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  26. data/coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  27. data/coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  28. data/coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  29. data/coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  30. data/coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  31. data/coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  32. data/coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  33. data/coverage/assets/0.12.3/images/ui-icons_222222_256x240.png +0 -0
  34. data/coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png +0 -0
  35. data/coverage/assets/0.12.3/images/ui-icons_454545_256x240.png +0 -0
  36. data/coverage/assets/0.12.3/images/ui-icons_888888_256x240.png +0 -0
  37. data/coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png +0 -0
  38. data/coverage/assets/0.12.3/loading.gif +0 -0
  39. data/coverage/assets/0.12.3/magnify.png +0 -0
  40. data/coverage/index.html +108612 -0
  41. data/custom_templates/Gemfile.mustache +11 -0
  42. data/custom_templates/README.mustache +170 -0
  43. data/custom_templates/gem.mustache +99 -0
  44. data/custom_templates/gemspec.mustache +37 -0
  45. data/custom_templates/version.mustache +7 -0
  46. data/docs/AnswerCallback.md +3 -3
  47. data/docs/BridgeCompleteCallback.md +2 -2
  48. data/docs/BridgeTargetCompleteCallback.md +2 -2
  49. data/docs/CallState.md +2 -2
  50. data/docs/CallsApi.md +15 -15
  51. data/docs/Conference.md +4 -4
  52. data/docs/ConferenceCompletedCallback.md +2 -2
  53. data/docs/ConferenceCreatedCallback.md +2 -2
  54. data/docs/ConferenceMemberExitCallback.md +2 -2
  55. data/docs/ConferenceMemberJoinCallback.md +2 -2
  56. data/docs/ConferenceRecordingAvailableCallback.md +2 -2
  57. data/docs/ConferenceRedirectCallback.md +2 -2
  58. data/docs/ConferencesApi.md +42 -42
  59. data/docs/CreateCall.md +11 -11
  60. data/docs/CreateCallResponse.md +11 -11
  61. data/docs/DisconnectCallback.md +2 -2
  62. data/docs/DtmfCallback.md +2 -2
  63. data/docs/GatherCallback.md +2 -2
  64. data/docs/InitiateCallback.md +2 -2
  65. data/docs/ListMessageItem.md +5 -3
  66. data/docs/MFAApi.md +6 -6
  67. data/docs/MachineDetectionCompleteCallback.md +3 -3
  68. data/docs/MachineDetectionConfiguration.md +2 -2
  69. data/docs/MachineDetectionResult.md +20 -0
  70. data/docs/Message.md +2 -2
  71. data/docs/MessageDeliveredCallbackMessage.md +1 -1
  72. data/docs/MessageFailedCallbackMessage.md +1 -1
  73. data/docs/MessageRequest.md +1 -1
  74. data/docs/MessageSendingCallbackMessage.md +1 -1
  75. data/docs/MessagesApi.md +5 -1
  76. data/docs/MessagesList.md +1 -1
  77. data/docs/PhoneNumberLookupApi.md +4 -4
  78. data/docs/RecordingAvailableCallback.md +2 -2
  79. data/docs/RecordingCompleteCallback.md +2 -2
  80. data/docs/RecordingsApi.md +52 -52
  81. data/docs/RedirectCallback.md +2 -2
  82. data/docs/StatisticsApi.md +2 -2
  83. data/docs/TranscribeRecording.md +4 -2
  84. data/docs/TranscriptionAvailableCallback.md +2 -2
  85. data/docs/TransferAnswerCallback.md +2 -2
  86. data/docs/TransferCompleteCallback.md +2 -2
  87. data/docs/TransferDisconnectCallback.md +2 -2
  88. data/docs/UpdateCall.md +3 -3
  89. data/docs/UpdateConference.md +3 -3
  90. data/lib/bandwidth-sdk/api/calls_api.rb +18 -18
  91. data/lib/bandwidth-sdk/api/conferences_api.rb +46 -46
  92. data/lib/bandwidth-sdk/api/media_api.rb +2 -2
  93. data/lib/bandwidth-sdk/api/messages_api.rb +8 -2
  94. data/lib/bandwidth-sdk/api/mfa_api.rb +10 -10
  95. data/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +6 -6
  96. data/lib/bandwidth-sdk/api/recordings_api.rb +55 -55
  97. data/lib/bandwidth-sdk/api/statistics_api.rb +3 -3
  98. data/lib/bandwidth-sdk/api_client.rb +1 -1
  99. data/lib/bandwidth-sdk/api_error.rb +2 -2
  100. data/lib/bandwidth-sdk/configuration.rb +3 -3
  101. data/lib/bandwidth-sdk/models/account_statistics.rb +2 -4
  102. data/lib/bandwidth-sdk/models/answer_callback.rb +4 -7
  103. data/lib/bandwidth-sdk/models/bridge_complete_callback.rb +3 -5
  104. data/lib/bandwidth-sdk/models/bridge_target_complete_callback.rb +3 -5
  105. data/lib/bandwidth-sdk/models/bxml/bxml.rb +2 -4
  106. data/lib/bandwidth-sdk/models/bxml/nestable_verb.rb +3 -7
  107. data/lib/bandwidth-sdk/models/bxml/response.rb +2 -4
  108. data/lib/bandwidth-sdk/models/bxml/root.rb +3 -3
  109. data/lib/bandwidth-sdk/models/bxml/verb.rb +4 -5
  110. data/lib/bandwidth-sdk/models/bxml/verbs/bridge.rb +2 -4
  111. data/lib/bandwidth-sdk/models/bxml/verbs/conference.rb +2 -5
  112. data/lib/bandwidth-sdk/models/bxml/verbs/custom_param.rb +16 -0
  113. data/lib/bandwidth-sdk/models/bxml/verbs/forward.rb +2 -4
  114. data/lib/bandwidth-sdk/models/bxml/verbs/gather.rb +3 -5
  115. data/lib/bandwidth-sdk/models/bxml/verbs/hangup.rb +2 -4
  116. data/lib/bandwidth-sdk/models/bxml/verbs/pause.rb +2 -4
  117. data/lib/bandwidth-sdk/models/bxml/verbs/pause_recording.rb +2 -4
  118. data/lib/bandwidth-sdk/models/bxml/verbs/phone_number.rb +2 -4
  119. data/lib/bandwidth-sdk/models/bxml/verbs/play_audio.rb +2 -4
  120. data/lib/bandwidth-sdk/models/bxml/verbs/record.rb +2 -4
  121. data/lib/bandwidth-sdk/models/bxml/verbs/redirect.rb +2 -4
  122. data/lib/bandwidth-sdk/models/bxml/verbs/resume_recording.rb +2 -4
  123. data/lib/bandwidth-sdk/models/bxml/verbs/ring.rb +2 -4
  124. data/lib/bandwidth-sdk/models/bxml/verbs/send_dtmf.rb +2 -4
  125. data/lib/bandwidth-sdk/models/bxml/verbs/sip_uri.rb +2 -4
  126. data/lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb +3 -5
  127. data/lib/bandwidth-sdk/models/bxml/verbs/start_gather.rb +2 -4
  128. data/lib/bandwidth-sdk/models/bxml/verbs/start_recording.rb +2 -4
  129. data/lib/bandwidth-sdk/models/bxml/verbs/start_stream.rb +2 -4
  130. data/lib/bandwidth-sdk/models/bxml/verbs/start_transcription.rb +29 -0
  131. data/lib/bandwidth-sdk/models/bxml/verbs/stop_gather.rb +2 -4
  132. data/lib/bandwidth-sdk/models/bxml/verbs/stop_recording.rb +2 -4
  133. data/lib/bandwidth-sdk/models/bxml/verbs/stop_stream.rb +2 -4
  134. data/lib/bandwidth-sdk/models/bxml/verbs/stop_transcription.rb +15 -0
  135. data/lib/bandwidth-sdk/models/bxml/verbs/stream_param.rb +2 -4
  136. data/lib/bandwidth-sdk/models/bxml/verbs/tag.rb +2 -4
  137. data/lib/bandwidth-sdk/models/bxml/verbs/transfer.rb +2 -4
  138. data/lib/bandwidth-sdk/models/call_direction_enum.rb +3 -3
  139. data/lib/bandwidth-sdk/models/call_recording_metadata.rb +2 -4
  140. data/lib/bandwidth-sdk/models/call_state.rb +4 -6
  141. data/lib/bandwidth-sdk/models/call_state_enum.rb +3 -3
  142. data/lib/bandwidth-sdk/models/callback_method_enum.rb +3 -3
  143. data/lib/bandwidth-sdk/models/code_request.rb +2 -4
  144. data/lib/bandwidth-sdk/models/conference.rb +5 -7
  145. data/lib/bandwidth-sdk/models/conference_completed_callback.rb +3 -5
  146. data/lib/bandwidth-sdk/models/conference_created_callback.rb +3 -5
  147. data/lib/bandwidth-sdk/models/conference_member.rb +2 -4
  148. data/lib/bandwidth-sdk/models/conference_member_exit_callback.rb +3 -5
  149. data/lib/bandwidth-sdk/models/conference_member_join_callback.rb +3 -5
  150. data/lib/bandwidth-sdk/models/conference_recording_available_callback.rb +3 -5
  151. data/lib/bandwidth-sdk/models/conference_recording_metadata.rb +2 -4
  152. data/lib/bandwidth-sdk/models/conference_redirect_callback.rb +3 -5
  153. data/lib/bandwidth-sdk/models/conference_state_enum.rb +3 -3
  154. data/lib/bandwidth-sdk/models/create_call.rb +14 -7
  155. data/lib/bandwidth-sdk/models/create_call_response.rb +10 -12
  156. data/lib/bandwidth-sdk/models/create_lookup_response.rb +2 -4
  157. data/lib/bandwidth-sdk/models/create_message_request_error.rb +2 -4
  158. data/lib/bandwidth-sdk/models/deferred_result.rb +2 -4
  159. data/lib/bandwidth-sdk/models/disconenct_callback.rb +1 -3
  160. data/lib/bandwidth-sdk/models/disconnect_callback.rb +3 -5
  161. data/lib/bandwidth-sdk/models/diversion.rb +2 -4
  162. data/lib/bandwidth-sdk/models/dtmf_callback.rb +3 -5
  163. data/lib/bandwidth-sdk/models/field_error.rb +2 -4
  164. data/lib/bandwidth-sdk/models/file_format_enum.rb +3 -3
  165. data/lib/bandwidth-sdk/models/gather_callback.rb +3 -5
  166. data/lib/bandwidth-sdk/models/inbound_message_callback.rb +2 -4
  167. data/lib/bandwidth-sdk/models/inbound_message_callback_message.rb +3 -4
  168. data/lib/bandwidth-sdk/models/initiate_callback.rb +3 -5
  169. data/lib/bandwidth-sdk/models/list_message_direction_enum.rb +3 -3
  170. data/lib/bandwidth-sdk/models/list_message_item.rb +19 -10
  171. data/lib/bandwidth-sdk/models/lookup_request.rb +2 -4
  172. data/lib/bandwidth-sdk/models/lookup_result.rb +2 -4
  173. data/lib/bandwidth-sdk/models/lookup_status.rb +2 -4
  174. data/lib/bandwidth-sdk/models/lookup_status_enum.rb +5 -5
  175. data/lib/bandwidth-sdk/models/machine_detection_complete_callback.rb +4 -7
  176. data/lib/bandwidth-sdk/models/machine_detection_configuration.rb +2 -4
  177. data/lib/bandwidth-sdk/models/machine_detection_mode_enum.rb +3 -3
  178. data/lib/bandwidth-sdk/models/machine_detection_result.rb +229 -0
  179. data/lib/bandwidth-sdk/models/media.rb +2 -4
  180. data/lib/bandwidth-sdk/models/message.rb +3 -5
  181. data/lib/bandwidth-sdk/models/message_delivered_callback.rb +2 -4
  182. data/lib/bandwidth-sdk/models/message_delivered_callback_message.rb +3 -4
  183. data/lib/bandwidth-sdk/models/message_direction_enum.rb +3 -3
  184. data/lib/bandwidth-sdk/models/message_failed_callback.rb +2 -4
  185. data/lib/bandwidth-sdk/models/message_failed_callback_message.rb +3 -4
  186. data/lib/bandwidth-sdk/models/message_request.rb +3 -5
  187. data/lib/bandwidth-sdk/models/message_sending_callback.rb +2 -4
  188. data/lib/bandwidth-sdk/models/message_sending_callback_message.rb +3 -4
  189. data/lib/bandwidth-sdk/models/message_status_enum.rb +9 -9
  190. data/lib/bandwidth-sdk/models/message_type_enum.rb +3 -3
  191. data/lib/bandwidth-sdk/models/messages_list.rb +3 -5
  192. data/lib/bandwidth-sdk/models/messaging_code_response.rb +2 -4
  193. data/lib/bandwidth-sdk/models/messaging_request_error.rb +2 -4
  194. data/lib/bandwidth-sdk/models/mfa_forbidden_request_error.rb +2 -4
  195. data/lib/bandwidth-sdk/models/mfa_request_error.rb +2 -4
  196. data/lib/bandwidth-sdk/models/mfa_unauthorized_request_error.rb +2 -4
  197. data/lib/bandwidth-sdk/models/page_info.rb +2 -4
  198. data/lib/bandwidth-sdk/models/priority_enum.rb +3 -3
  199. data/lib/bandwidth-sdk/models/recording_available_callback.rb +3 -5
  200. data/lib/bandwidth-sdk/models/recording_complete_callback.rb +3 -5
  201. data/lib/bandwidth-sdk/models/recording_state_enum.rb +3 -3
  202. data/lib/bandwidth-sdk/models/redirect_callback.rb +3 -5
  203. data/lib/bandwidth-sdk/models/redirect_method_enum.rb +3 -3
  204. data/lib/bandwidth-sdk/models/stir_shaken.rb +2 -4
  205. data/lib/bandwidth-sdk/models/tag.rb +2 -4
  206. data/lib/bandwidth-sdk/models/tn_lookup_request_error.rb +2 -4
  207. data/lib/bandwidth-sdk/models/transcribe_recording.rb +20 -9
  208. data/lib/bandwidth-sdk/models/transcription.rb +2 -4
  209. data/lib/bandwidth-sdk/models/transcription_available_callback.rb +3 -5
  210. data/lib/bandwidth-sdk/models/transcription_list.rb +2 -4
  211. data/lib/bandwidth-sdk/models/transcription_metadata.rb +2 -4
  212. data/lib/bandwidth-sdk/models/transfer_answer_callback.rb +3 -5
  213. data/lib/bandwidth-sdk/models/transfer_complete_callback.rb +3 -5
  214. data/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb +3 -5
  215. data/lib/bandwidth-sdk/models/update_call.rb +12 -5
  216. data/lib/bandwidth-sdk/models/update_call_recording.rb +2 -4
  217. data/lib/bandwidth-sdk/models/update_conference.rb +3 -5
  218. data/lib/bandwidth-sdk/models/update_conference_member.rb +2 -4
  219. data/lib/bandwidth-sdk/models/verify_code_request.rb +2 -4
  220. data/lib/bandwidth-sdk/models/verify_code_response.rb +2 -4
  221. data/lib/bandwidth-sdk/models/voice_api_error.rb +2 -4
  222. data/lib/bandwidth-sdk/models/voice_code_response.rb +2 -4
  223. data/lib/bandwidth-sdk/version.rb +2 -2
  224. data/lib/bandwidth-sdk.rb +5 -1
  225. data/openapi-config.yml +1 -0
  226. data/openapitools.json +7 -0
  227. data/spec/api/calls_api_spec.rb +228 -0
  228. data/spec/api/conferences_api_spec.rb +393 -0
  229. data/spec/api/media_api_spec.rb +129 -0
  230. data/spec/api/messages_api_spec.rb +193 -0
  231. data/spec/api/mfa_api_spec.rb +130 -0
  232. data/spec/api/phone_number_lookup_api_spec.rb +100 -0
  233. data/spec/api/recordings_api_spec.rb +395 -0
  234. data/spec/api/statistics_api_spec.rb +45 -0
  235. data/spec/api_client_spec.rb +377 -0
  236. data/spec/api_error_spec.rb +23 -0
  237. data/spec/call_utils.rb +28 -28
  238. data/spec/configuration_spec.rb +178 -0
  239. data/spec/integration/calls_api_integration_spec.rb +88 -69
  240. data/spec/integration/conferences_api_integration_spec.rb +74 -68
  241. data/spec/integration/media_api_integration_spec.rb +38 -32
  242. data/spec/integration/messages_api_integration_spec.rb +63 -50
  243. data/spec/integration/mfa_api_integration_spec.rb +41 -33
  244. data/spec/integration/phone_number_lookup_api_integration_spec.rb +26 -22
  245. data/spec/integration/recordings_api_integration_spec.rb +84 -77
  246. data/spec/integration/statistics_api_integration_spec.rb +15 -14
  247. data/spec/{unit/models → models}/bxml/bxml_spec.rb +0 -2
  248. data/spec/{unit/models → models}/bxml/nestable_verb_spec.rb +1 -3
  249. data/spec/{unit/models → models}/bxml/response_spec.rb +0 -2
  250. data/spec/{unit/models → models}/bxml/verb_spec.rb +1 -14
  251. data/spec/{unit/models → models}/bxml/verbs/bridge_spec.rb +0 -2
  252. data/spec/{unit/models → models}/bxml/verbs/conference_spec.rb +0 -2
  253. data/spec/models/bxml/verbs/custom_param_spec.rb +36 -0
  254. data/spec/{unit/models → models}/bxml/verbs/forward_spec.rb +0 -2
  255. data/spec/{unit/models → models}/bxml/verbs/gather_spec.rb +0 -2
  256. data/spec/{unit/models → models}/bxml/verbs/hangup_spec.rb +0 -2
  257. data/spec/{unit/models → models}/bxml/verbs/pause_recording_spec.rb +0 -2
  258. data/spec/{unit/models → models}/bxml/verbs/pause_spec.rb +0 -2
  259. data/spec/{unit/models → models}/bxml/verbs/phone_number_spec.rb +0 -2
  260. data/spec/{unit/models → models}/bxml/verbs/play_audio_spec.rb +0 -2
  261. data/spec/{unit/models → models}/bxml/verbs/record_spec.rb +0 -2
  262. data/spec/{unit/models → models}/bxml/verbs/redirect_spec.rb +0 -2
  263. data/spec/{unit/models → models}/bxml/verbs/resume_recording_spec.rb +0 -2
  264. data/spec/{unit/models → models}/bxml/verbs/ring_spec.rb +0 -2
  265. data/spec/{unit/models → models}/bxml/verbs/send_dtmf_spec.rb +0 -2
  266. data/spec/{unit/models → models}/bxml/verbs/sip_uri_spec.rb +0 -2
  267. data/spec/{unit/models → models}/bxml/verbs/speak_sentence_spec.rb +0 -2
  268. data/spec/{unit/models → models}/bxml/verbs/start_gather_spec.rb +0 -2
  269. data/spec/{unit/models → models}/bxml/verbs/start_recording_spec.rb +0 -2
  270. data/spec/{unit/models → models}/bxml/verbs/start_stream_spec.rb +2 -4
  271. data/spec/models/bxml/verbs/start_transcription_spec.rb +74 -0
  272. data/spec/{unit/models → models}/bxml/verbs/stop_gather_spec.rb +0 -2
  273. data/spec/{unit/models → models}/bxml/verbs/stop_recording_spec.rb +0 -2
  274. data/spec/{unit/models → models}/bxml/verbs/stop_stream_spec.rb +0 -2
  275. data/spec/models/bxml/verbs/stop_transcription_spec.rb +34 -0
  276. data/spec/{unit/models → models}/bxml/verbs/stream_param_spec.rb +0 -2
  277. data/spec/{unit/models → models}/bxml/verbs/tag_spec.rb +0 -2
  278. data/spec/{unit/models → models}/bxml/verbs/transfer_spec.rb +0 -2
  279. data/spec/models/call_state_enum_spec.rb +16 -0
  280. data/spec/models/call_state_spec.rb +181 -0
  281. data/spec/models/deferred_result_spec.rb +87 -0
  282. data/spec/models/message_spec.rb +145 -0
  283. data/spec/models/verify_code_request_spec.rb +134 -0
  284. data/spec/spec_helper.rb +48 -31
  285. metadata +148 -256
  286. data/spec/unit/api/calls_api_spec.rb +0 -89
  287. data/spec/unit/api/conferences_api_spec.rb +0 -163
  288. data/spec/unit/api/media_api_spec.rb +0 -90
  289. data/spec/unit/api/messages_api_spec.rb +0 -73
  290. data/spec/unit/api/mfa_api_spec.rb +0 -74
  291. data/spec/unit/api/phone_number_lookup_api_spec.rb +0 -61
  292. data/spec/unit/api/recordings_api_spec.rb +0 -177
  293. data/spec/unit/api/statistics_api_spec.rb +0 -47
  294. data/spec/unit/models/account_statistics_spec.rb +0 -40
  295. data/spec/unit/models/answer_callback_spec.rb +0 -112
  296. data/spec/unit/models/bridge_complete_callback_spec.rb +0 -124
  297. data/spec/unit/models/bridge_target_complete_callback_spec.rb +0 -106
  298. data/spec/unit/models/call_direction_enum_spec.rb +0 -28
  299. data/spec/unit/models/call_recording_metadata_spec.rb +0 -136
  300. data/spec/unit/models/call_state_enum_spec.rb +0 -28
  301. data/spec/unit/models/call_state_spec.rb +0 -136
  302. data/spec/unit/models/callback_method_enum_spec.rb +0 -28
  303. data/spec/unit/models/code_request_spec.rb +0 -64
  304. data/spec/unit/models/conference_completed_callback_spec.rb +0 -58
  305. data/spec/unit/models/conference_created_callback_spec.rb +0 -58
  306. data/spec/unit/models/conference_member_exit_callback_spec.rb +0 -76
  307. data/spec/unit/models/conference_member_join_callback_spec.rb +0 -76
  308. data/spec/unit/models/conference_member_spec.rb +0 -64
  309. data/spec/unit/models/conference_recording_available_callback_spec.rb +0 -112
  310. data/spec/unit/models/conference_recording_metadata_spec.rb +0 -94
  311. data/spec/unit/models/conference_redirect_callback_spec.rb +0 -58
  312. data/spec/unit/models/conference_spec.rb +0 -76
  313. data/spec/unit/models/conference_state_enum_spec.rb +0 -28
  314. data/spec/unit/models/create_call_response_spec.rb +0 -154
  315. data/spec/unit/models/create_call_spec.rb +0 -142
  316. data/spec/unit/models/create_lookup_response_spec.rb +0 -40
  317. data/spec/unit/models/create_message_request_error_spec.rb +0 -46
  318. data/spec/unit/models/deferred_result_spec.rb +0 -40
  319. data/spec/unit/models/disconnect_callback_spec.rb +0 -130
  320. data/spec/unit/models/diversion_spec.rb +0 -70
  321. data/spec/unit/models/dtmf_callback_spec.rb +0 -130
  322. data/spec/unit/models/field_error_spec.rb +0 -40
  323. data/spec/unit/models/file_format_enum_spec.rb +0 -28
  324. data/spec/unit/models/gather_callback_spec.rb +0 -136
  325. data/spec/unit/models/inbound_message_callback_message_spec.rb +0 -100
  326. data/spec/unit/models/inbound_message_callback_spec.rb +0 -58
  327. data/spec/unit/models/initiate_callback_spec.rb +0 -100
  328. data/spec/unit/models/list_message_direction_enum_spec.rb +0 -28
  329. data/spec/unit/models/list_message_item_spec.rb +0 -124
  330. data/spec/unit/models/lookup_request_spec.rb +0 -34
  331. data/spec/unit/models/lookup_result_spec.rb +0 -82
  332. data/spec/unit/models/lookup_status_enum_spec.rb +0 -28
  333. data/spec/unit/models/lookup_status_spec.rb +0 -52
  334. data/spec/unit/models/machine_detection_complete_callback_spec.rb +0 -112
  335. data/spec/unit/models/machine_detection_configuration_spec.rb +0 -118
  336. data/spec/unit/models/machine_detection_mode_enum_spec.rb +0 -28
  337. data/spec/unit/models/media_spec.rb +0 -46
  338. data/spec/unit/models/message_delivered_callback_message_spec.rb +0 -100
  339. data/spec/unit/models/message_delivered_callback_spec.rb +0 -58
  340. data/spec/unit/models/message_direction_enum_spec.rb +0 -28
  341. data/spec/unit/models/message_failed_callback_message_spec.rb +0 -100
  342. data/spec/unit/models/message_failed_callback_spec.rb +0 -64
  343. data/spec/unit/models/message_request_spec.rb +0 -76
  344. data/spec/unit/models/message_sending_callback_message_spec.rb +0 -100
  345. data/spec/unit/models/message_sending_callback_spec.rb +0 -58
  346. data/spec/unit/models/message_spec.rb +0 -106
  347. data/spec/unit/models/message_status_enum_spec.rb +0 -28
  348. data/spec/unit/models/message_type_enum_spec.rb +0 -28
  349. data/spec/unit/models/messages_list_spec.rb +0 -46
  350. data/spec/unit/models/messaging_code_response_spec.rb +0 -34
  351. data/spec/unit/models/messaging_request_error_spec.rb +0 -40
  352. data/spec/unit/models/mfa_forbidden_request_error_spec.rb +0 -34
  353. data/spec/unit/models/mfa_request_error_spec.rb +0 -40
  354. data/spec/unit/models/mfa_unauthorized_request_error_spec.rb +0 -34
  355. data/spec/unit/models/page_info_spec.rb +0 -52
  356. data/spec/unit/models/priority_enum_spec.rb +0 -28
  357. data/spec/unit/models/recording_available_callback_spec.rb +0 -160
  358. data/spec/unit/models/recording_complete_callback_spec.rb +0 -160
  359. data/spec/unit/models/recording_state_enum_spec.rb +0 -28
  360. data/spec/unit/models/redirect_callback_spec.rb +0 -124
  361. data/spec/unit/models/redirect_method_enum_spec.rb +0 -28
  362. data/spec/unit/models/stir_shaken_spec.rb +0 -46
  363. data/spec/unit/models/tag_spec.rb +0 -40
  364. data/spec/unit/models/tn_lookup_request_error_spec.rb +0 -34
  365. data/spec/unit/models/transcribe_recording_spec.rb +0 -64
  366. data/spec/unit/models/transcription_available_callback_spec.rb +0 -154
  367. data/spec/unit/models/transcription_list_spec.rb +0 -34
  368. data/spec/unit/models/transcription_metadata_spec.rb +0 -52
  369. data/spec/unit/models/transcription_spec.rb +0 -40
  370. data/spec/unit/models/transfer_answer_callback_spec.rb +0 -118
  371. data/spec/unit/models/transfer_complete_callback_spec.rb +0 -136
  372. data/spec/unit/models/transfer_disconnect_callback_spec.rb +0 -148
  373. data/spec/unit/models/update_call_recording_spec.rb +0 -34
  374. data/spec/unit/models/update_call_spec.rb +0 -88
  375. data/spec/unit/models/update_conference_member_spec.rb +0 -46
  376. data/spec/unit/models/update_conference_spec.rb +0 -82
  377. data/spec/unit/models/verify_code_request_spec.rb +0 -52
  378. data/spec/unit/models/verify_code_response_spec.rb +0 -34
  379. data/spec/unit/models/voice_api_error_spec.rb +0 -46
  380. data/spec/unit/models/voice_code_response_spec.rb +0 -34
@@ -0,0 +1,74 @@
1
+ # Unit tests for Bandwidth::Bxml::StartTranscription
2
+ describe 'Bandwidth::Bxml::StartTranscription' do
3
+ let(:initial_attributes) {
4
+ {
5
+ name: 'initial_name',
6
+ tracks: 'inbound',
7
+ transcription_event_url: 'https://initial.com',
8
+ transcription_event_method: 'POST',
9
+ username: 'initial_username',
10
+ password: 'initial_password',
11
+ destination: 'https://initial.com',
12
+ stabilized: true
13
+ }
14
+ }
15
+
16
+ let(:new_attributes) {
17
+ {
18
+ name: 'new_name',
19
+ tracks: 'outbound',
20
+ transcription_event_url: 'https://new.com',
21
+ transcription_event_method: 'GET',
22
+ username: 'new_username',
23
+ password: 'new_password',
24
+ destination: 'https://new.com',
25
+ stabilized: false
26
+ }
27
+ }
28
+
29
+ let (:custom_param_1) { Bandwidth::Bxml::CustomParam.new({ name: 'custom_param_name_1', value: 'custom_param_value_1' }) }
30
+ let (:custom_param_2) { Bandwidth::Bxml::CustomParam.new({ name: 'custom_param_name_2', value: 'custom_param_value_2' }) }
31
+
32
+ let(:instance) { Bandwidth::Bxml::StartTranscription.new([], initial_attributes) }
33
+ let(:instance_nested) { Bandwidth::Bxml::StartTranscription.new([custom_param_1], initial_attributes) }
34
+
35
+ describe 'test an instance of StartTranscription' do
36
+ it 'validates instance of StartTranscription' do
37
+ expect(instance).to be_instance_of(Bandwidth::Bxml::StartTranscription)
38
+ expect(instance).to be_a(Bandwidth::Bxml::Verb)
39
+ end
40
+
41
+ it 'tests the to_bxml method of the StartTranscription instance' do
42
+ expected = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\"/>\n"
43
+ expect(instance.to_bxml).to eq(expected)
44
+ end
45
+
46
+ it 'tests the set_attributes method of the StartTranscription instance' do
47
+ instance.set_attributes(new_attributes)
48
+ expected = "\n<StartTranscription name=\"new_name\" tracks=\"outbound\" transcriptionEventUrl=\"https://new.com\" transcriptionEventMethod=\"GET\" username=\"new_username\" password=\"new_password\" destination=\"https://new.com\" stabilized=\"false\"/>\n"
49
+ expect(instance.to_bxml).to eq(expected)
50
+ end
51
+ end
52
+
53
+ describe 'test an instance of StartTranscription with nested verbs' do
54
+ it 'validates instance of StartTranscription' do
55
+ expect(instance_nested).to be_instance_of(Bandwidth::Bxml::StartTranscription)
56
+ expect(instance_nested).to be_a(Bandwidth::Bxml::Verb)
57
+ end
58
+
59
+ it 'tests the to_bxml method of the nested StartTranscription instance' do
60
+ expected = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n</StartTranscription>\n"
61
+ expect(instance_nested.to_bxml).to eq(expected)
62
+ end
63
+
64
+ it 'tests the add_custom_param method of the nested StartTranscription instance' do
65
+ expected_single = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n</StartTranscription>\n"
66
+ instance_nested.add_custom_param(custom_param_2)
67
+ expect(instance_nested.to_bxml).to eq(expected_single)
68
+
69
+ expected_multiple = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n</StartTranscription>\n"
70
+ instance_nested.add_custom_param([custom_param_2, custom_param_2])
71
+ expect(instance_nested.to_bxml).to eq(expected_multiple)
72
+ end
73
+ end
74
+ end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  # Unit tests for Bandwidth::Bxml::StopGather
4
2
  describe 'Bandwidth::Bxml::StopGather' do
5
3
  let(:instance) { Bandwidth::Bxml::StopGather.new }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  # Unit tests for Bandwidth::Bxml::StopRecording
4
2
  describe 'Bandwidth::Bxml::StopRecording' do
5
3
  let(:instance) { Bandwidth::Bxml::StopRecording.new }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  # Unit tests for Bandwidth::Bxml::StopStream
4
2
  describe 'Bandwidth::Bxml::StopStream' do
5
3
  let(:initial_attributes) {
@@ -0,0 +1,34 @@
1
+ # Unit tests for Bandwidth::Bxml::StopTranscription
2
+ describe 'Bandwidth::Bxml::StopTranscription' do
3
+ let(:initial_attributes) {
4
+ {
5
+ name: 'initial_name'
6
+ }
7
+ }
8
+
9
+ let(:new_attributes) {
10
+ {
11
+ name: 'new_name'
12
+ }
13
+ }
14
+
15
+ let(:instance) { Bandwidth::Bxml::StopTranscription.new(initial_attributes) }
16
+
17
+ describe 'test an instance of StopTranscription' do
18
+ it 'validates instance of StopTranscription' do
19
+ expect(instance).to be_instance_of(Bandwidth::Bxml::StopTranscription)
20
+ expect(instance).to be_a(Bandwidth::Bxml::Verb)
21
+ end
22
+
23
+ it 'tests the to_bxml method of the StopTranscription instance' do
24
+ expected = "\n<StopTranscription name=\"initial_name\"/>\n"
25
+ expect(instance.to_bxml).to eq(expected)
26
+ end
27
+
28
+ it 'tests the set_attributes method of the StopTranscription instance' do
29
+ instance.set_attributes(new_attributes)
30
+ expected = "\n<StopTranscription name=\"new_name\"/>\n"
31
+ expect(instance.to_bxml).to eq(expected)
32
+ end
33
+ end
34
+ end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  # Unit tests for Bandwidth::Bxml::StreamParam
4
2
  describe 'Bandwidth::Bxml::StreamParam' do
5
3
  let(:initial_attributes) {
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  # Unit tests for Bandwidth::Bxml::Tag
4
2
  describe 'Bandwidth::Bxml::Tag' do
5
3
  let(:instance) { Bandwidth::Bxml::Tag.new('test_tag') }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  # Unit tests for Bandwidth::Bxml::Transfer
4
2
  describe 'Bandwidth::Bxml::Transfer' do
5
3
  let(:initial_attributes) {
@@ -0,0 +1,16 @@
1
+ # Unit tests for Bandwidth::CallStateEnum
2
+ describe Bandwidth::CallStateEnum do
3
+ let(:instance) { Bandwidth::CallStateEnum.new }
4
+
5
+ describe 'test an instance of CallStateEnum' do
6
+ it 'creates an instance of CallStateEnum' do
7
+ expect(instance).to be_instance_of(Bandwidth::CallStateEnum)
8
+ end
9
+
10
+ it 'raises an error for an invalid enum value' do
11
+ expect {
12
+ Bandwidth::CallStateEnum.build_from_hash('invalid')
13
+ }.to raise_error(RuntimeError)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,181 @@
1
+ # Unit tests for Bandwidth::CallState
2
+ describe Bandwidth::CallState do
3
+ let(:call_state_default) { Bandwidth::CallState.new }
4
+ let(:call_state_values) { Bandwidth::CallState.new({
5
+ application_id: '04e88489-df02-4e34-a0ee-27a91849555f',
6
+ account_id: '9900000',
7
+ call_id: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
8
+ parent_call_id: 'c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
9
+ to: '+19195551234',
10
+ from: '+19195554321',
11
+ direction: 'inbound',
12
+ state: 'disconnected',
13
+ stir_shaken: {
14
+ 'verstat': 'TN-Verification-Passed',
15
+ 'attestationIndicator': 'A',
16
+ 'originatingId': 'abc123'
17
+ },
18
+ identity: 'eyJhbGciOiJFUzI1NiI',
19
+ enqueued_time: '2022-06-16T13:15:07.160Z',
20
+ start_time: '2022-06-16T13:15:07.160Z',
21
+ answer_time: '2022-06-16T13:15:18.126Z',
22
+ end_time: '2022-06-16T13:15:18.314Z',
23
+ disconnect_cause: 'hangup',
24
+ error_message: nil,
25
+ error_id: nil,
26
+ last_update: '2022-06-16T13:15:18.314Z'
27
+ }) }
28
+
29
+ describe '#initialize' do
30
+ it 'causes an ArgumentError by passing an Array to the initialize method' do
31
+ expect {
32
+ Bandwidth::CallState.new([])
33
+ }.to raise_error(ArgumentError)
34
+ end
35
+
36
+ it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
37
+ expect {
38
+ Bandwidth::CallState.new({ invalid: true })
39
+ }.to raise_error(ArgumentError)
40
+ end
41
+ end
42
+
43
+ describe '#acceptable_attributes' do
44
+ it 'expects acceptable JSON attributes to be those in the attribute map' do
45
+ expect(Bandwidth::CallState.acceptable_attributes).to eq(Bandwidth::CallState.attribute_map.values)
46
+ end
47
+ end
48
+
49
+ describe 'EnumAttributeValidator' do
50
+ it 'validates string enum' do
51
+ validator = Bandwidth::CallState::EnumAttributeValidator.new(String, ['valid'])
52
+ expect(validator.valid?('valid')).to be true
53
+ expect(validator.valid?('invalid')).to be false
54
+ end
55
+
56
+ it 'validates integer enum' do
57
+ validator = Bandwidth::CallState::EnumAttributeValidator.new(Integer, [1])
58
+ expect(validator.valid?(1)).to be true
59
+ expect(validator.valid?('invalid')).to be false
60
+ end
61
+
62
+ it 'validates float enum' do
63
+ validator = Bandwidth::CallState::EnumAttributeValidator.new(Float, [1.0])
64
+ expect(validator.valid?(1.0)).to be true
65
+ expect(validator.valid?('invalid')).to be false
66
+ end
67
+ end
68
+
69
+ describe '#build_from_hash' do
70
+ it 'validates instance of CallState created by the build_from_hash method' do
71
+ call_state_from_hash = Bandwidth::CallState.build_from_hash({
72
+ applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
73
+ accountId: '9900000',
74
+ callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
75
+ parentCallId: 'c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
76
+ to: '+19195551234',
77
+ from: '+19195554321',
78
+ direction: 'inbound',
79
+ state: 'disconnected',
80
+ stirShaken: {
81
+ 'verstat': 'TN-Verification-Passed',
82
+ 'attestationIndicator': 'A',
83
+ 'originatingId': 'abc123'
84
+ },
85
+ identity: 'eyJhbGciOiJFUzI1NiI',
86
+ enqueuedTime: '2022-06-16T13:15:07.160Z',
87
+ startTime: '2022-06-16T13:15:07.160Z',
88
+ answerTime: '2022-06-16T13:15:18.126Z',
89
+ endTime: '2022-06-16T13:15:18.314Z',
90
+ disconnectCause: 'hangup',
91
+ errorMessage: nil,
92
+ errorId: nil,
93
+ lastUpdate: '2022-06-16T13:15:18.314Z'
94
+ })
95
+ expect(call_state_from_hash).to be_instance_of(Bandwidth::CallState)
96
+ expect(call_state_from_hash.application_id).to eq('04e88489-df02-4e34-a0ee-27a91849555f')
97
+ expect(call_state_from_hash.account_id).to eq('9900000')
98
+ expect(call_state_from_hash.call_id).to eq('c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
99
+ expect(call_state_from_hash.parent_call_id).to eq('c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85')
100
+ expect(call_state_from_hash.to).to eq('+19195551234')
101
+ expect(call_state_from_hash.from).to eq('+19195554321')
102
+ expect(call_state_from_hash.direction).to eq('inbound')
103
+ expect(call_state_from_hash.state).to eq('disconnected')
104
+ expect(call_state_from_hash.stir_shaken).to eq({
105
+ 'verstat' => 'TN-Verification-Passed',
106
+ 'attestationIndicator' => 'A',
107
+ 'originatingId' => 'abc123'
108
+ })
109
+ expect(call_state_from_hash.identity).to eq('eyJhbGciOiJFUzI1NiI')
110
+ expect(call_state_from_hash.enqueued_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
111
+ expect(call_state_from_hash.start_time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
112
+ expect(call_state_from_hash.answer_time).to eq(Time.parse('2022-06-16T13:15:18.126Z'))
113
+ expect(call_state_from_hash.end_time).to eq(Time.parse('2022-06-16T13:15:18.314Z'))
114
+ expect(call_state_from_hash.disconnect_cause).to eq('hangup')
115
+ expect(call_state_from_hash.error_message).to eq(nil)
116
+ expect(call_state_from_hash.error_id).to eq(nil)
117
+ expect(call_state_from_hash.last_update).to eq(Time.parse('2022-06-16T13:15:18.314Z'))
118
+ end
119
+ end
120
+
121
+ describe '#list_invalid_properties' do
122
+ it 'returns list of invalid properties' do
123
+ expect(call_state_default.list_invalid_properties).to eq([])
124
+ end
125
+ end
126
+
127
+ describe '#hash' do
128
+ it 'returns a hash code according to attributes' do
129
+ expect(call_state_default.hash).to be_instance_of(Integer)
130
+ end
131
+ end
132
+
133
+ describe '#to_s' do
134
+ it 'returns a string representation of the object' do
135
+ expect(call_state_default.to_s).to eq('{}')
136
+ end
137
+ end
138
+
139
+ describe '#valid?' do
140
+ it 'validates instances with and without attributes set' do
141
+ expect(call_state_default).to be_valid
142
+ expect(call_state_values).to be_valid
143
+ end
144
+ end
145
+
146
+ describe '#eq? #==' do
147
+ it 'returns true/false when comparing objects' do
148
+ expect(call_state_default.eql?(Bandwidth::CallState.new)).to be true
149
+ expect(call_state_default.eql?(call_state_values)).to be false
150
+ end
151
+ end
152
+
153
+ describe '#to_body #to_hash' do
154
+ it 'returns a hash representation of the object' do
155
+ expect(call_state_values.to_body).to eq({
156
+ applicationId: '04e88489-df02-4e34-a0ee-27a91849555f',
157
+ accountId: '9900000',
158
+ callId: 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
159
+ parentCallId: 'c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
160
+ to: '+19195551234',
161
+ from: '+19195554321',
162
+ direction: 'inbound',
163
+ state: 'disconnected',
164
+ stirShaken: {
165
+ 'verstat': 'TN-Verification-Passed',
166
+ 'attestationIndicator': 'A',
167
+ 'originatingId': 'abc123'
168
+ },
169
+ identity: 'eyJhbGciOiJFUzI1NiI',
170
+ enqueuedTime: '2022-06-16T13:15:07.160Z',
171
+ startTime: '2022-06-16T13:15:07.160Z',
172
+ answerTime: '2022-06-16T13:15:18.126Z',
173
+ endTime: '2022-06-16T13:15:18.314Z',
174
+ disconnectCause: 'hangup',
175
+ errorMessage: nil,
176
+ errorId: nil,
177
+ lastUpdate: '2022-06-16T13:15:18.314Z'
178
+ })
179
+ end
180
+ end
181
+ end
@@ -0,0 +1,87 @@
1
+ # Unit tests for Bandwidth::DeferredResult
2
+ describe Bandwidth::DeferredResult do
3
+ let(:deferred_result_default) { Bandwidth::DeferredResult.new }
4
+ let(:deferred_result_values) { Bandwidth::DeferredResult.new({
5
+ result: { key: 'value' },
6
+ set_or_expired: true
7
+ }) }
8
+
9
+ describe '#initialize' do
10
+ it 'causes an ArgumentError by passing an Array to the initialize method' do
11
+ expect {
12
+ Bandwidth::DeferredResult.new([])
13
+ }.to raise_error(ArgumentError)
14
+ end
15
+
16
+ it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
17
+ expect {
18
+ Bandwidth::DeferredResult.new({ invalid: true })
19
+ }.to raise_error(ArgumentError)
20
+ end
21
+ end
22
+
23
+ describe '#acceptable_attributes' do
24
+ it 'expects acceptable JSON attributes to be those in the attribute map' do
25
+ expect(Bandwidth::DeferredResult.acceptable_attributes).to eq(Bandwidth::DeferredResult.attribute_map.values)
26
+ end
27
+ end
28
+
29
+ describe '#openapi_nullable' do
30
+ it 'expects nullable attributes to be an empty set' do
31
+ expect(Bandwidth::DeferredResult.openapi_nullable).to eq(Set.new([]))
32
+ end
33
+ end
34
+
35
+ describe '#build_from_hash' do
36
+ it 'validates instance of DeferredResult created by the build_from_hash method' do
37
+ deferred_result_from_hash = Bandwidth::DeferredResult.build_from_hash({
38
+ result: { key: 'value' },
39
+ setOrExpired: true
40
+ })
41
+ expect(deferred_result_from_hash).to be_instance_of(Bandwidth::DeferredResult)
42
+ expect(deferred_result_from_hash.result).to eq({ key: 'value' })
43
+ expect(deferred_result_from_hash.set_or_expired).to be true
44
+ end
45
+ end
46
+
47
+ describe '#list_invalid_properties' do
48
+ it 'returns list of invalid properties' do
49
+ expect(deferred_result_default.list_invalid_properties).to eq([])
50
+ end
51
+ end
52
+
53
+ describe '#hash' do
54
+ it 'returns a hash code according to attributes' do
55
+ expect(deferred_result_default.hash).to be_instance_of(Integer)
56
+ end
57
+ end
58
+
59
+ describe '#to_s' do
60
+ it 'returns a string representation of the object' do
61
+ expect(deferred_result_values.to_s).to eq('{:result=>{:key=>"value"}, :setOrExpired=>true}')
62
+ end
63
+ end
64
+
65
+ describe '#valid?' do
66
+ it 'validates instances with and without attributes set' do
67
+ expect(deferred_result_default).to be_valid
68
+ expect(deferred_result_values).to be_valid
69
+ end
70
+ end
71
+
72
+ describe '#eq? #==' do
73
+ it 'returns true/false when comparing objects' do
74
+ expect(deferred_result_default.eql?(Bandwidth::DeferredResult.new)).to be true
75
+ expect(deferred_result_default.eql?(deferred_result_values)).to be false
76
+ end
77
+ end
78
+
79
+ describe '#to_body #to_hash' do
80
+ it 'returns a hash representation of the object' do
81
+ expect(deferred_result_values.to_body).to eq({
82
+ result: { key: 'value' },
83
+ setOrExpired: true
84
+ })
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,145 @@
1
+ # Unit tests for Bandwidth::Message
2
+ describe Bandwidth::Message do
3
+ let(:message_default) { Bandwidth::Message.new }
4
+ let(:message_values) { Bandwidth::Message.new({
5
+ id: '1589228074636lm4k2je7j7jklbn2',
6
+ owner: '+19195554321',
7
+ application_id: '93de2206-9669-4e07-948d-329f4b722ee2',
8
+ time: '2022-06-16T13:15:07.160Z',
9
+ segment_count: 2,
10
+ direction: 'in',
11
+ to: ['+19195551234'],
12
+ from: '+19195554321',
13
+ media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
14
+ text: 'Hello world',
15
+ tag: 'custom tag',
16
+ priority: 'default',
17
+ expiration: '2022-06-16T13:45:07.160Z'
18
+ }) }
19
+
20
+ describe '#initialize' do
21
+ it 'causes an ArgumentError by passing an Array to the initialize method' do
22
+ expect {
23
+ Bandwidth::Message.new([])
24
+ }.to raise_error(ArgumentError)
25
+ end
26
+
27
+ it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do
28
+ expect {
29
+ Bandwidth::Message.new({ invalid: true })
30
+ }.to raise_error(ArgumentError)
31
+ end
32
+ end
33
+
34
+ describe '#acceptable_attributes' do
35
+ it 'expects acceptable JSON attributes to be those in the attribute map' do
36
+ expect(Bandwidth::Message.acceptable_attributes).to eq(Bandwidth::Message.attribute_map.values)
37
+ end
38
+ end
39
+
40
+ describe 'EnumAttributeValidator' do
41
+ it 'validates string enum' do
42
+ validator = Bandwidth::Message::EnumAttributeValidator.new(String, ['valid'])
43
+ expect(validator.valid?('valid')).to be true
44
+ expect(validator.valid?('invalid')).to be false
45
+ end
46
+
47
+ it 'validates integer enum' do
48
+ validator = Bandwidth::Message::EnumAttributeValidator.new(Integer, [1])
49
+ expect(validator.valid?(1)).to be true
50
+ expect(validator.valid?('invalid')).to be false
51
+ end
52
+
53
+ it 'validates float enum' do
54
+ validator = Bandwidth::Message::EnumAttributeValidator.new(Float, [1.0])
55
+ expect(validator.valid?(1.0)).to be true
56
+ expect(validator.valid?('invalid')).to be false
57
+ end
58
+ end
59
+
60
+ describe '#build_from_hash' do
61
+ it 'validates instance of Message created by the build_from_hash method' do
62
+ message_from_hash = Bandwidth::Message.build_from_hash({
63
+ id: '1589228074636lm4k2je7j7jklbn2',
64
+ owner: '+19195554321',
65
+ applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
66
+ time: '2022-06-16T13:15:07.160Z',
67
+ segmentCount: 2,
68
+ direction: 'in',
69
+ to: ['+19195551234'],
70
+ from: '+19195554321',
71
+ media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
72
+ text: 'Hello world',
73
+ tag: 'custom tag',
74
+ priority: 'default',
75
+ expiration: '2022-06-16T13:45:07.160Z'
76
+ })
77
+ expect(message_from_hash).to be_instance_of(Bandwidth::Message)
78
+ expect(message_from_hash.id).to eq('1589228074636lm4k2je7j7jklbn2')
79
+ expect(message_from_hash.owner).to eq('+19195554321')
80
+ expect(message_from_hash.application_id).to eq('93de2206-9669-4e07-948d-329f4b722ee2')
81
+ expect(message_from_hash.time).to eq(Time.parse('2022-06-16T13:15:07.160Z'))
82
+ expect(message_from_hash.segment_count).to eq(2)
83
+ expect(message_from_hash.direction).to eq('in')
84
+ expect(message_from_hash.to).to eq(['+19195551234'])
85
+ expect(message_from_hash.from).to eq('+19195554321')
86
+ expect(message_from_hash.media).to eq(['https://dev.bandwidth.com/images/bandwidth-logo.png'])
87
+ expect(message_from_hash.text).to eq('Hello world')
88
+ expect(message_from_hash.tag).to eq('custom tag')
89
+ expect(message_from_hash.priority).to eq('default')
90
+ expect(message_from_hash.expiration).to eq(Time.parse('2022-06-16T13:45:07.160Z'))
91
+ end
92
+ end
93
+
94
+ describe '#list_invalid_properties' do
95
+ it 'returns list of invalid properties' do
96
+ expect(message_default.list_invalid_properties).to eq([])
97
+ end
98
+ end
99
+
100
+ describe '#hash' do
101
+ it 'returns a hash code according to attributes' do
102
+ expect(message_default.hash).to be_instance_of(Integer)
103
+ end
104
+ end
105
+
106
+ describe '#to_s' do
107
+ it 'returns a string representation of the object' do
108
+ expect(message_default.to_s).to eq('{}')
109
+ end
110
+ end
111
+
112
+ describe '#valid?' do
113
+ it 'validates instances with and without attributes set' do
114
+ expect(message_default).to be_valid
115
+ expect(message_values).to be_valid
116
+ end
117
+ end
118
+
119
+ describe '#eq? #==' do
120
+ it 'returns true/false when comparing objects' do
121
+ expect(message_default.eql?(Bandwidth::Message.new)).to be true
122
+ expect(message_default.eql?(message_values)).to be false
123
+ end
124
+ end
125
+
126
+ describe '#to_body #to_hash' do
127
+ it 'returns a hash representation of the object' do
128
+ expect(message_values.to_body).to eq({
129
+ id: '1589228074636lm4k2je7j7jklbn2',
130
+ owner: '+19195554321',
131
+ applicationId: '93de2206-9669-4e07-948d-329f4b722ee2',
132
+ time: '2022-06-16T13:15:07.160Z',
133
+ segmentCount: 2,
134
+ direction: 'in',
135
+ to: ['+19195551234'],
136
+ from: '+19195554321',
137
+ media: ['https://dev.bandwidth.com/images/bandwidth-logo.png'],
138
+ text: 'Hello world',
139
+ tag: 'custom tag',
140
+ priority: 'default',
141
+ expiration: '2022-06-16T13:45:07.160Z'
142
+ })
143
+ end
144
+ end
145
+ end