bandwidth-sdk 10.2.0 → 11.0.0.pre.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/Gemfile.lock +77 -0
- data/README.md +197 -139
- data/Rakefile +22 -0
- data/bandwidth-sdk.gemspec +40 -0
- data/bandwidth.yml +5544 -0
- data/docs/AccountStatistics.md +20 -0
- data/docs/AnswerCallback.md +44 -0
- data/docs/BridgeCompleteCallback.md +48 -0
- data/docs/BridgeTargetCompleteCallback.md +42 -0
- data/docs/CallDirectionEnum.md +15 -0
- data/docs/CallRecordingMetadata.md +52 -0
- data/docs/CallState.md +52 -0
- data/docs/CallStateEnum.md +15 -0
- data/docs/CallbackMethodEnum.md +15 -0
- data/docs/CallsApi.md +304 -0
- data/docs/CodeRequest.md +28 -0
- data/docs/Conference.md +32 -0
- data/docs/ConferenceCompletedCallback.md +26 -0
- data/docs/ConferenceCreatedCallback.md +26 -0
- data/docs/ConferenceMember.md +28 -0
- data/docs/ConferenceMemberExitCallback.md +32 -0
- data/docs/ConferenceMemberJoinCallback.md +32 -0
- data/docs/ConferenceRecordingAvailableCallback.md +44 -0
- data/docs/ConferenceRecordingMetadata.md +38 -0
- data/docs/ConferenceRedirectCallback.md +26 -0
- data/docs/ConferenceStateEnum.md +15 -0
- data/docs/ConferencesApi.md +688 -0
- data/docs/CreateCall.md +54 -0
- data/docs/CreateCallResponse.md +58 -0
- data/docs/CreateLookupResponse.md +20 -0
- data/docs/CreateMessageRequestError.md +22 -0
- data/docs/CreateParticipantRequest.md +24 -0
- data/docs/CreateParticipantResponse.md +20 -0
- data/docs/DeferredResult.md +20 -0
- data/docs/DeviceApiVersionEnum.md +15 -0
- data/docs/DisconenctCallback.md +50 -0
- data/docs/DisconnectCallback.md +50 -0
- data/docs/Diversion.md +30 -0
- data/docs/DtmfCallback.md +50 -0
- data/docs/FieldError.md +20 -0
- data/docs/FileFormatEnum.md +15 -0
- data/docs/ForbiddenRequest.md +18 -0
- data/docs/GatherCallback.md +52 -0
- data/docs/InboundMessageCallback.md +26 -0
- data/docs/InboundMessageCallbackMessage.md +40 -0
- data/docs/InitiateCallback.md +40 -0
- data/docs/ListMessageDirectionEnum.md +15 -0
- data/docs/ListMessageItem.md +48 -0
- data/docs/LookupRequest.md +18 -0
- data/docs/LookupResult.md +34 -0
- data/docs/LookupStatus.md +24 -0
- data/docs/LookupStatusEnum.md +15 -0
- data/docs/MFAApi.md +226 -0
- data/docs/MachineDetectionCompleteCallback.md +44 -0
- data/docs/MachineDetectionConfiguration.md +46 -0
- data/docs/MachineDetectionModeEnum.md +15 -0
- data/docs/Media.md +22 -0
- data/docs/MediaApi.md +307 -0
- data/docs/Message.md +40 -0
- data/docs/MessageDeliveredCallback.md +26 -0
- data/docs/MessageDeliveredCallbackMessage.md +40 -0
- data/docs/MessageDirectionEnum.md +15 -0
- data/docs/MessageFailedCallback.md +28 -0
- data/docs/MessageFailedCallbackMessage.md +40 -0
- data/docs/MessageRequest.md +32 -0
- data/docs/MessageSendingCallback.md +26 -0
- data/docs/MessageSendingCallbackMessage.md +40 -0
- data/docs/MessageStatusEnum.md +15 -0
- data/docs/MessageTypeEnum.md +15 -0
- data/docs/MessagesApi.md +179 -0
- data/docs/MessagesList.md +22 -0
- data/docs/MessagingCodeResponse.md +18 -0
- data/docs/MessagingRequestError.md +20 -0
- data/docs/MfaForbiddenRequestError.md +18 -0
- data/docs/MfaRequestError.md +20 -0
- data/docs/MfaUnauthorizedRequestError.md +18 -0
- data/docs/PageInfo.md +24 -0
- data/docs/Participant.md +30 -0
- data/docs/ParticipantSubscription.md +20 -0
- data/docs/ParticipantsApi.md +227 -0
- data/docs/PhoneNumberLookupApi.md +153 -0
- data/docs/PriorityEnum.md +15 -0
- data/docs/PublishPermissionsEnum.md +15 -0
- data/docs/RecordingAvailableCallback.md +60 -0
- data/docs/RecordingCompleteCallback.md +60 -0
- data/docs/RecordingStateEnum.md +15 -0
- data/docs/RecordingsApi.md +758 -0
- data/docs/RedirectCallback.md +48 -0
- data/docs/RedirectMethodEnum.md +15 -0
- data/docs/RequestError.md +20 -0
- data/docs/Session.md +20 -0
- data/docs/SessionsApi.md +605 -0
- data/docs/StatisticsApi.md +78 -0
- data/docs/StirShaken.md +22 -0
- data/docs/Subscriptions.md +20 -0
- data/docs/Tag.md +20 -0
- data/docs/TnLookupRequestError.md +18 -0
- data/docs/TranscribeRecording.md +28 -0
- data/docs/Transcription.md +20 -0
- data/docs/TranscriptionAvailableCallback.md +58 -0
- data/docs/TranscriptionList.md +18 -0
- data/docs/TranscriptionMetadata.md +24 -0
- data/docs/TransferAnswerCallback.md +46 -0
- data/docs/TransferCompleteCallback.md +52 -0
- data/docs/TransferDisconnectCallback.md +56 -0
- data/docs/UnauthorizedRequest.md +18 -0
- data/docs/UpdateCall.md +36 -0
- data/docs/UpdateCallRecording.md +18 -0
- data/docs/UpdateConference.md +34 -0
- data/docs/UpdateConferenceMember.md +22 -0
- data/docs/VerifyCodeRequest.md +24 -0
- data/docs/VerifyCodeResponse.md +18 -0
- data/docs/VoiceApiError.md +22 -0
- data/docs/VoiceCodeResponse.md +18 -0
- data/git_push.sh +57 -0
- data/lib/bandwidth-sdk/api/calls_api.rb +325 -0
- data/lib/bandwidth-sdk/api/conferences_api.rb +717 -0
- data/lib/bandwidth-sdk/api/media_api.rb +312 -0
- data/lib/bandwidth-sdk/api/messages_api.rb +198 -0
- data/lib/bandwidth-sdk/api/mfa_api.rb +244 -0
- data/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +165 -0
- data/lib/bandwidth-sdk/api/recordings_api.rb +782 -0
- data/lib/bandwidth-sdk/api/statistics_api.rb +85 -0
- data/lib/bandwidth-sdk/api_client.rb +428 -0
- data/lib/bandwidth-sdk/api_error.rb +58 -0
- data/lib/bandwidth-sdk/configuration.rb +589 -0
- data/lib/bandwidth-sdk/models/account_statistics.rb +230 -0
- data/lib/bandwidth-sdk/models/answer_callback.rb +376 -0
- data/lib/bandwidth-sdk/models/bridge_complete_callback.rb +397 -0
- data/lib/bandwidth-sdk/models/bridge_target_complete_callback.rb +365 -0
- data/lib/bandwidth-sdk/models/bxml/bxml.rb +13 -0
- data/lib/bandwidth-sdk/models/bxml/nestable_verb.rb +50 -0
- data/lib/bandwidth-sdk/models/bxml/response.rb +13 -0
- data/lib/bandwidth-sdk/models/bxml/root.rb +47 -0
- data/lib/bandwidth-sdk/models/bxml/verb.rb +51 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/bridge.rb +30 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/conference.rb +31 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/forward.rb +22 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/gather.rb +44 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/hangup.rb +12 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/pause.rb +17 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/pause_recording.rb +12 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/phone_number.rb +28 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/play_audio.rb +19 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/record.rb +34 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/redirect.rb +25 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/resume_recording.rb +12 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/ring.rb +18 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/send_dtmf.rb +19 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/sip_uri.rb +29 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb +27 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/start_gather.rb +21 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/start_recording.rb +26 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/start_stream.rb +30 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/stop_gather.rb +12 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/stop_recording.rb +12 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/stop_stream.rb +17 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/stream_param.rb +18 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/tag.rb +13 -0
- data/lib/bandwidth-sdk/models/bxml/verbs/transfer.rb +36 -0
- data/lib/bandwidth-sdk/models/call_direction_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/call_recording_metadata.rb +411 -0
- data/lib/bandwidth-sdk/models/call_state.rb +423 -0
- data/lib/bandwidth-sdk/models/call_state_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/callback_method_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/code_request.rb +427 -0
- data/lib/bandwidth-sdk/models/conference.rb +320 -0
- data/lib/bandwidth-sdk/models/conference_completed_callback.rb +262 -0
- data/lib/bandwidth-sdk/models/conference_created_callback.rb +262 -0
- data/lib/bandwidth-sdk/models/conference_member.rb +273 -0
- data/lib/bandwidth-sdk/models/conference_member_exit_callback.rb +292 -0
- data/lib/bandwidth-sdk/models/conference_member_join_callback.rb +292 -0
- data/lib/bandwidth-sdk/models/conference_recording_available_callback.rb +374 -0
- data/lib/bandwidth-sdk/models/conference_recording_metadata.rb +342 -0
- data/lib/bandwidth-sdk/models/conference_redirect_callback.rb +262 -0
- data/lib/bandwidth-sdk/models/conference_state_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/create_call.rb +651 -0
- data/lib/bandwidth-sdk/models/create_call_response.rb +552 -0
- data/lib/bandwidth-sdk/models/create_lookup_response.rb +252 -0
- data/lib/bandwidth-sdk/models/create_message_request_error.rb +249 -0
- data/lib/bandwidth-sdk/models/deferred_result.rb +228 -0
- data/lib/bandwidth-sdk/models/disconenct_callback.rb +407 -0
- data/lib/bandwidth-sdk/models/disconnect_callback.rb +407 -0
- data/lib/bandwidth-sdk/models/diversion.rb +280 -0
- data/lib/bandwidth-sdk/models/dtmf_callback.rb +405 -0
- data/lib/bandwidth-sdk/models/field_error.rb +230 -0
- data/lib/bandwidth-sdk/models/file_format_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/gather_callback.rb +415 -0
- data/lib/bandwidth-sdk/models/inbound_message_callback.rb +281 -0
- data/lib/bandwidth-sdk/models/inbound_message_callback_message.rb +399 -0
- data/lib/bandwidth-sdk/models/initiate_callback.rb +350 -0
- data/lib/bandwidth-sdk/models/list_message_direction_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/list_message_item.rb +394 -0
- data/lib/bandwidth-sdk/models/lookup_request.rb +227 -0
- data/lib/bandwidth-sdk/models/lookup_result.rb +301 -0
- data/lib/bandwidth-sdk/models/lookup_status.rb +276 -0
- data/lib/bandwidth-sdk/models/lookup_status_enum.rb +42 -0
- data/lib/bandwidth-sdk/models/machine_detection_complete_callback.rb +376 -0
- data/lib/bandwidth-sdk/models/machine_detection_configuration.rb +500 -0
- data/lib/bandwidth-sdk/models/machine_detection_mode_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/media.rb +237 -0
- data/lib/bandwidth-sdk/models/message.rb +366 -0
- data/lib/bandwidth-sdk/models/message_delivered_callback.rb +281 -0
- data/lib/bandwidth-sdk/models/message_delivered_callback_message.rb +404 -0
- data/lib/bandwidth-sdk/models/message_direction_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/message_failed_callback.rb +295 -0
- data/lib/bandwidth-sdk/models/message_failed_callback_message.rb +409 -0
- data/lib/bandwidth-sdk/models/message_request.rb +355 -0
- data/lib/bandwidth-sdk/models/message_sending_callback.rb +281 -0
- data/lib/bandwidth-sdk/models/message_sending_callback_message.rb +409 -0
- data/lib/bandwidth-sdk/models/message_status_enum.rb +46 -0
- data/lib/bandwidth-sdk/models/message_type_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/messages_list.rb +240 -0
- data/lib/bandwidth-sdk/models/messaging_code_response.rb +220 -0
- data/lib/bandwidth-sdk/models/messaging_request_error.rb +238 -0
- data/lib/bandwidth-sdk/models/mfa_forbidden_request_error.rb +220 -0
- data/lib/bandwidth-sdk/models/mfa_request_error.rb +230 -0
- data/lib/bandwidth-sdk/models/mfa_unauthorized_request_error.rb +220 -0
- data/lib/bandwidth-sdk/models/page_info.rb +250 -0
- data/lib/bandwidth-sdk/models/priority_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/recording_available_callback.rb +454 -0
- data/lib/bandwidth-sdk/models/recording_complete_callback.rb +455 -0
- data/lib/bandwidth-sdk/models/recording_state_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/redirect_callback.rb +395 -0
- data/lib/bandwidth-sdk/models/redirect_method_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/stir_shaken.rb +240 -0
- data/lib/bandwidth-sdk/models/tag.rb +228 -0
- data/lib/bandwidth-sdk/models/tn_lookup_request_error.rb +220 -0
- data/lib/bandwidth-sdk/models/transcribe_recording.rb +354 -0
- data/lib/bandwidth-sdk/models/transcription.rb +230 -0
- data/lib/bandwidth-sdk/models/transcription_available_callback.rb +443 -0
- data/lib/bandwidth-sdk/models/transcription_list.rb +221 -0
- data/lib/bandwidth-sdk/models/transcription_metadata.rb +251 -0
- data/lib/bandwidth-sdk/models/transfer_answer_callback.rb +385 -0
- data/lib/bandwidth-sdk/models/transfer_complete_callback.rb +417 -0
- data/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb +437 -0
- data/lib/bandwidth-sdk/models/update_call.rb +411 -0
- data/lib/bandwidth-sdk/models/update_call_recording.rb +246 -0
- data/lib/bandwidth-sdk/models/update_conference.rb +394 -0
- data/lib/bandwidth-sdk/models/update_conference_member.rb +243 -0
- data/lib/bandwidth-sdk/models/verify_code_request.rb +342 -0
- data/lib/bandwidth-sdk/models/verify_code_response.rb +220 -0
- data/lib/bandwidth-sdk/models/voice_api_error.rb +238 -0
- data/lib/bandwidth-sdk/models/voice_code_response.rb +220 -0
- data/lib/bandwidth-sdk/version.rb +15 -0
- data/lib/bandwidth-sdk.rb +166 -0
- data/openapi-config.yml +11 -0
- data/ruby-notes.md +64 -0
- data/spec/call_utils.rb +74 -0
- data/spec/fixtures/ruby_cat.jpeg +0 -0
- data/spec/integration/calls_api_integration_spec.rb +181 -0
- data/spec/integration/conferences_api_integration_spec.rb +163 -0
- data/spec/integration/media_api_integration_spec.rb +86 -0
- data/spec/integration/messages_api_integration_spec.rb +97 -0
- data/spec/integration/mfa_api_integration_spec.rb +109 -0
- data/spec/integration/phone_number_lookup_api_integration_spec.rb +92 -0
- data/spec/integration/recordings_api_integration_spec.rb +219 -0
- data/spec/integration/statistics_api_integration_spec.rb +57 -0
- data/spec/spec_helper.rb +154 -0
- data/spec/unit/api/calls_api_spec.rb +89 -0
- data/spec/unit/api/conferences_api_spec.rb +163 -0
- data/spec/unit/api/media_api_spec.rb +90 -0
- data/spec/unit/api/messages_api_spec.rb +73 -0
- data/spec/unit/api/mfa_api_spec.rb +74 -0
- data/spec/unit/api/phone_number_lookup_api_spec.rb +61 -0
- data/spec/unit/api/recordings_api_spec.rb +177 -0
- data/spec/unit/api/statistics_api_spec.rb +47 -0
- data/spec/unit/models/account_statistics_spec.rb +40 -0
- data/spec/unit/models/answer_callback_spec.rb +112 -0
- data/spec/unit/models/bridge_complete_callback_spec.rb +124 -0
- data/spec/unit/models/bridge_target_complete_callback_spec.rb +106 -0
- data/spec/unit/models/bxml/bxml_spec.rb +18 -0
- data/spec/unit/models/bxml/nestable_verb_spec.rb +13 -0
- data/spec/unit/models/bxml/response_spec.rb +18 -0
- data/spec/unit/models/bxml/verb_spec.rb +28 -0
- data/spec/unit/models/bxml/verbs/bridge_spec.rb +60 -0
- data/spec/unit/models/bxml/verbs/conference_spec.rb +60 -0
- data/spec/unit/models/bxml/verbs/forward_spec.rb +46 -0
- data/spec/unit/models/bxml/verbs/gather_spec.rb +88 -0
- data/spec/unit/models/bxml/verbs/hangup_spec.rb +18 -0
- data/spec/unit/models/bxml/verbs/pause_recording_spec.rb +18 -0
- data/spec/unit/models/bxml/verbs/pause_spec.rb +36 -0
- data/spec/unit/models/bxml/verbs/phone_number_spec.rb +56 -0
- data/spec/unit/models/bxml/verbs/play_audio_spec.rb +38 -0
- data/spec/unit/models/bxml/verbs/record_spec.rb +70 -0
- data/spec/unit/models/bxml/verbs/redirect_spec.rb +52 -0
- data/spec/unit/models/bxml/verbs/resume_recording_spec.rb +18 -0
- data/spec/unit/models/bxml/verbs/ring_spec.rb +38 -0
- data/spec/unit/models/bxml/verbs/send_dtmf_spec.rb +38 -0
- data/spec/unit/models/bxml/verbs/sip_uri_spec.rb +58 -0
- data/spec/unit/models/bxml/verbs/speak_sentence_spec.rb +40 -0
- data/spec/unit/models/bxml/verbs/start_gather_spec.rb +44 -0
- data/spec/unit/models/bxml/verbs/start_recording_spec.rb +54 -0
- data/spec/unit/models/bxml/verbs/start_stream_spec.rb +74 -0
- data/spec/unit/models/bxml/verbs/stop_gather_spec.rb +18 -0
- data/spec/unit/models/bxml/verbs/stop_recording_spec.rb +18 -0
- data/spec/unit/models/bxml/verbs/stop_stream_spec.rb +36 -0
- data/spec/unit/models/bxml/verbs/stream_param_spec.rb +38 -0
- data/spec/unit/models/bxml/verbs/tag_spec.rb +18 -0
- data/spec/unit/models/bxml/verbs/transfer_spec.rb +86 -0
- data/spec/unit/models/call_direction_enum_spec.rb +28 -0
- data/spec/unit/models/call_recording_metadata_spec.rb +136 -0
- data/spec/unit/models/call_state_enum_spec.rb +28 -0
- data/spec/unit/models/call_state_spec.rb +136 -0
- data/spec/unit/models/callback_method_enum_spec.rb +28 -0
- data/spec/unit/models/code_request_spec.rb +64 -0
- data/spec/unit/models/conference_completed_callback_spec.rb +58 -0
- data/spec/unit/models/conference_created_callback_spec.rb +58 -0
- data/spec/unit/models/conference_member_exit_callback_spec.rb +76 -0
- data/spec/unit/models/conference_member_join_callback_spec.rb +76 -0
- data/spec/unit/models/conference_member_spec.rb +64 -0
- data/spec/unit/models/conference_recording_available_callback_spec.rb +112 -0
- data/spec/unit/models/conference_recording_metadata_spec.rb +94 -0
- data/spec/unit/models/conference_redirect_callback_spec.rb +58 -0
- data/spec/unit/models/conference_spec.rb +76 -0
- data/spec/unit/models/conference_state_enum_spec.rb +28 -0
- data/spec/unit/models/create_call_response_spec.rb +154 -0
- data/spec/unit/models/create_call_spec.rb +142 -0
- data/spec/unit/models/create_lookup_response_spec.rb +40 -0
- data/spec/unit/models/create_message_request_error_spec.rb +46 -0
- data/spec/unit/models/deferred_result_spec.rb +40 -0
- data/spec/unit/models/disconnect_callback_spec.rb +130 -0
- data/spec/unit/models/diversion_spec.rb +70 -0
- data/spec/unit/models/dtmf_callback_spec.rb +130 -0
- data/spec/unit/models/field_error_spec.rb +40 -0
- data/spec/unit/models/file_format_enum_spec.rb +28 -0
- data/spec/unit/models/gather_callback_spec.rb +136 -0
- data/spec/unit/models/inbound_message_callback_message_spec.rb +100 -0
- data/spec/unit/models/inbound_message_callback_spec.rb +58 -0
- data/spec/unit/models/initiate_callback_spec.rb +100 -0
- data/spec/unit/models/list_message_direction_enum_spec.rb +28 -0
- data/spec/unit/models/list_message_item_spec.rb +124 -0
- data/spec/unit/models/lookup_request_spec.rb +34 -0
- data/spec/unit/models/lookup_result_spec.rb +82 -0
- data/spec/unit/models/lookup_status_enum_spec.rb +28 -0
- data/spec/unit/models/lookup_status_spec.rb +52 -0
- data/spec/unit/models/machine_detection_complete_callback_spec.rb +112 -0
- data/spec/unit/models/machine_detection_configuration_spec.rb +118 -0
- data/spec/unit/models/machine_detection_mode_enum_spec.rb +28 -0
- data/spec/unit/models/media_spec.rb +46 -0
- data/spec/unit/models/message_delivered_callback_message_spec.rb +100 -0
- data/spec/unit/models/message_delivered_callback_spec.rb +58 -0
- data/spec/unit/models/message_direction_enum_spec.rb +28 -0
- data/spec/unit/models/message_failed_callback_message_spec.rb +100 -0
- data/spec/unit/models/message_failed_callback_spec.rb +64 -0
- data/spec/unit/models/message_request_spec.rb +76 -0
- data/spec/unit/models/message_sending_callback_message_spec.rb +100 -0
- data/spec/unit/models/message_sending_callback_spec.rb +58 -0
- data/spec/unit/models/message_spec.rb +100 -0
- data/spec/unit/models/message_status_enum_spec.rb +28 -0
- data/spec/unit/models/message_type_enum_spec.rb +28 -0
- data/spec/unit/models/messages_list_spec.rb +46 -0
- data/spec/unit/models/messaging_code_response_spec.rb +34 -0
- data/spec/unit/models/messaging_request_error_spec.rb +40 -0
- data/spec/unit/models/mfa_forbidden_request_error_spec.rb +34 -0
- data/spec/unit/models/mfa_request_error_spec.rb +40 -0
- data/spec/unit/models/mfa_unauthorized_request_error_spec.rb +34 -0
- data/spec/unit/models/page_info_spec.rb +52 -0
- data/spec/unit/models/priority_enum_spec.rb +28 -0
- data/spec/unit/models/recording_available_callback_spec.rb +160 -0
- data/spec/unit/models/recording_complete_callback_spec.rb +160 -0
- data/spec/unit/models/recording_state_enum_spec.rb +28 -0
- data/spec/unit/models/redirect_callback_spec.rb +124 -0
- data/spec/unit/models/redirect_method_enum_spec.rb +28 -0
- data/spec/unit/models/stir_shaken_spec.rb +46 -0
- data/spec/unit/models/tag_spec.rb +40 -0
- data/spec/unit/models/tn_lookup_request_error_spec.rb +34 -0
- data/spec/unit/models/transcribe_recording_spec.rb +64 -0
- data/spec/unit/models/transcription_available_callback_spec.rb +154 -0
- data/spec/unit/models/transcription_list_spec.rb +34 -0
- data/spec/unit/models/transcription_metadata_spec.rb +52 -0
- data/spec/unit/models/transcription_spec.rb +40 -0
- data/spec/unit/models/transfer_answer_callback_spec.rb +118 -0
- data/spec/unit/models/transfer_complete_callback_spec.rb +136 -0
- data/spec/unit/models/transfer_disconnect_callback_spec.rb +148 -0
- data/spec/unit/models/update_call_recording_spec.rb +34 -0
- data/spec/unit/models/update_call_spec.rb +88 -0
- data/spec/unit/models/update_conference_member_spec.rb +46 -0
- data/spec/unit/models/update_conference_spec.rb +82 -0
- data/spec/unit/models/verify_code_request_spec.rb +52 -0
- data/spec/unit/models/verify_code_response_spec.rb +34 -0
- data/spec/unit/models/voice_api_error_spec.rb +46 -0
- data/spec/unit/models/voice_code_response_spec.rb +34 -0
- metadata +542 -281
- data/LICENSE +0 -28
- data/lib/bandwidth/api_helper.rb +0 -280
- data/lib/bandwidth/client.rb +0 -75
- data/lib/bandwidth/configuration.rb +0 -209
- data/lib/bandwidth/exceptions/api_exception.rb +0 -20
- data/lib/bandwidth/http/api_response.rb +0 -38
- data/lib/bandwidth/http/auth/messaging_basic_auth.rb +0 -22
- data/lib/bandwidth/http/auth/multi_factor_auth_basic_auth.rb +0 -22
- data/lib/bandwidth/http/auth/phone_number_lookup_basic_auth.rb +0 -22
- data/lib/bandwidth/http/auth/voice_basic_auth.rb +0 -22
- data/lib/bandwidth/http/auth/web_rtc_basic_auth.rb +0 -22
- data/lib/bandwidth/http/faraday_client.rb +0 -73
- data/lib/bandwidth/http/http_call_back.rb +0 -24
- data/lib/bandwidth/http/http_client.rb +0 -104
- data/lib/bandwidth/http/http_method_enum.rb +0 -13
- data/lib/bandwidth/http/http_request.rb +0 -50
- data/lib/bandwidth/http/http_response.rb +0 -29
- data/lib/bandwidth/messaging_lib/messaging/client.rb +0 -60
- data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +0 -491
- data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +0 -47
- data/lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb +0 -37
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb +0 -100
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +0 -164
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message_item.rb +0 -203
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb +0 -79
- data/lib/bandwidth/messaging_lib/messaging/models/deferred_result.rb +0 -60
- data/lib/bandwidth/messaging_lib/messaging/models/media.rb +0 -70
- data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +0 -111
- data/lib/bandwidth/messaging_lib/messaging/models/page_info.rb +0 -82
- data/lib/bandwidth/messaging_lib/messaging/models/priority_enum.rb +0 -19
- data/lib/bandwidth/messaging_lib/messaging/models/tag.rb +0 -60
- data/lib/bandwidth/messaging_lib/messaging.rb +0 -25
- data/lib/bandwidth/models/base_model.rb +0 -58
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/client.rb +0 -60
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/base_controller.rb +0 -47
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/mfa_controller.rb +0 -214
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/error_with_request_exception.rb +0 -37
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/forbidden_request_exception.rb +0 -32
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/unauthorized_request_exception.rb +0 -32
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb +0 -103
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_messaging_response.rb +0 -50
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_code_response.rb +0 -50
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb +0 -94
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_voice_response.rb +0 -50
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth.rb +0 -23
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/client.rb +0 -60
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb +0 -1553
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb +0 -47
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb +0 -32
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb +0 -50
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb +0 -61
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb +0 -95
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb +0 -132
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup.rb +0 -20
- data/lib/bandwidth/utilities/date_time_helper.rb +0 -156
- data/lib/bandwidth/utilities/file_wrapper.rb +0 -16
- data/lib/bandwidth/voice_lib/bxml/bxml.rb +0 -36
- data/lib/bandwidth/voice_lib/bxml/response.rb +0 -39
- data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +0 -28
- data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +0 -32
- data/lib/bandwidth/voice_lib/bxml/verbs/forward.rb +0 -18
- data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +0 -49
- data/lib/bandwidth/voice_lib/bxml/verbs/hangup.rb +0 -14
- data/lib/bandwidth/voice_lib/bxml/verbs/pause.rb +0 -15
- data/lib/bandwidth/voice_lib/bxml/verbs/pause_recording.rb +0 -14
- data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +0 -24
- data/lib/bandwidth/voice_lib/bxml/verbs/play_audio.rb +0 -17
- data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +0 -33
- data/lib/bandwidth/voice_lib/bxml/verbs/redirect.rb +0 -24
- data/lib/bandwidth/voice_lib/bxml/verbs/resume_recording.rb +0 -14
- data/lib/bandwidth/voice_lib/bxml/verbs/ring.rb +0 -16
- data/lib/bandwidth/voice_lib/bxml/verbs/send_dtmf.rb +0 -16
- data/lib/bandwidth/voice_lib/bxml/verbs/sip_uri.rb +0 -25
- data/lib/bandwidth/voice_lib/bxml/verbs/speak_sentence.rb +0 -18
- data/lib/bandwidth/voice_lib/bxml/verbs/start_gather.rb +0 -20
- data/lib/bandwidth/voice_lib/bxml/verbs/start_recording.rb +0 -25
- data/lib/bandwidth/voice_lib/bxml/verbs/start_stream.rb +0 -41
- data/lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb +0 -14
- data/lib/bandwidth/voice_lib/bxml/verbs/stop_recording.rb +0 -14
- data/lib/bandwidth/voice_lib/bxml/verbs/stop_stream.rb +0 -16
- data/lib/bandwidth/voice_lib/bxml/verbs/stream_param.rb +0 -17
- data/lib/bandwidth/voice_lib/bxml/verbs/tag.rb +0 -13
- data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +0 -48
- data/lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb +0 -26
- data/lib/bandwidth/voice_lib/voice/client.rb +0 -60
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +0 -1820
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +0 -47
- data/lib/bandwidth/voice_lib/voice/exceptions/api_error_exception.rb +0 -42
- data/lib/bandwidth/voice_lib/voice/models/answer_fallback_method_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/answer_method_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/call_callback.rb +0 -343
- data/lib/bandwidth/voice_lib/voice/models/call_recording_metadata.rb +0 -250
- data/lib/bandwidth/voice_lib/voice/models/call_state.rb +0 -301
- data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/conference_callback.rb +0 -211
- data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/conference_member_state.rb +0 -103
- data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata.rb +0 -173
- data/lib/bandwidth/voice_lib/voice/models/conference_state.rb +0 -153
- data/lib/bandwidth/voice_lib/voice/models/create_call_request.rb +0 -236
- data/lib/bandwidth/voice_lib/voice/models/create_call_response.rb +0 -266
- data/lib/bandwidth/voice_lib/voice/models/direction_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/disconnect_method_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/diversion.rb +0 -80
- data/lib/bandwidth/voice_lib/voice/models/fallback_method_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/file_format_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb +0 -231
- data/lib/bandwidth/voice_lib/voice/models/mode_enum.rb +0 -20
- data/lib/bandwidth/voice_lib/voice/models/modify_call_recording_request.rb +0 -48
- data/lib/bandwidth/voice_lib/voice/models/modify_call_request.rb +0 -156
- data/lib/bandwidth/voice_lib/voice/models/modify_conference_request.rb +0 -144
- data/lib/bandwidth/voice_lib/voice/models/redirect_fallback_method_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/redirect_method_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/state1_enum.rb +0 -20
- data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +0 -17
- data/lib/bandwidth/voice_lib/voice/models/transcribe_recording_request.rb +0 -108
- data/lib/bandwidth/voice_lib/voice/models/transcript.rb +0 -60
- data/lib/bandwidth/voice_lib/voice/models/transcription.rb +0 -80
- data/lib/bandwidth/voice_lib/voice/models/transcription_metadata.rb +0 -89
- data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +0 -59
- data/lib/bandwidth/voice_lib/voice.rb +0 -48
- data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +0 -18
- data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +0 -60
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +0 -703
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +0 -47
- data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +0 -37
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +0 -62
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/device_api_version_enum.rb +0 -17
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +0 -115
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +0 -48
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb +0 -17
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +0 -60
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +0 -71
- data/lib/bandwidth/web_rtc_lib/web_rtc.rb +0 -22
- data/lib/bandwidth.rb +0 -73
- data/test/controllers/controller_test_base.rb +0 -21
- data/test/http_response_catcher.rb +0 -19
- data/test/integration/test_integration.rb +0 -760
- data/test/test_helper.rb +0 -94
@@ -1,760 +0,0 @@
|
|
1
|
-
# test_integration.rb
|
2
|
-
#
|
3
|
-
# A simple integration test against Bandwidth's APIs
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
require 'securerandom'
|
7
|
-
require_relative '../../lib/bandwidth.rb'
|
8
|
-
|
9
|
-
include Bandwidth
|
10
|
-
include Bandwidth::Voice
|
11
|
-
include Bandwidth::Messaging
|
12
|
-
include Bandwidth::MultiFactorAuth
|
13
|
-
include Bandwidth::WebRtc
|
14
|
-
|
15
|
-
begin
|
16
|
-
BW_USERNAME = ENV.fetch("BW_USERNAME")
|
17
|
-
BW_PASSWORD = ENV.fetch("BW_PASSWORD")
|
18
|
-
BW_ACCOUNT_ID = ENV.fetch("BW_ACCOUNT_ID")
|
19
|
-
BW_VOICE_APPLICATION_ID = ENV.fetch("BW_VOICE_APPLICATION_ID")
|
20
|
-
BW_MESSAGING_APPLICATION_ID = ENV.fetch("BW_MESSAGING_APPLICATION_ID")
|
21
|
-
BASE_CALLBACK_URL = ENV.fetch("BASE_CALLBACK_URL")
|
22
|
-
BW_NUMBER = ENV.fetch("BW_NUMBER")
|
23
|
-
USER_NUMBER = ENV.fetch("USER_NUMBER")
|
24
|
-
rescue
|
25
|
-
puts "Environmental variables not found"
|
26
|
-
exit(-1)
|
27
|
-
end
|
28
|
-
|
29
|
-
class IntegrationTest < Test::Unit::TestCase
|
30
|
-
def setup
|
31
|
-
@bandwidth_client = Bandwidth::Client.new(
|
32
|
-
voice_basic_auth_user_name: BW_USERNAME,
|
33
|
-
voice_basic_auth_password: BW_PASSWORD,
|
34
|
-
messaging_basic_auth_user_name: BW_USERNAME,
|
35
|
-
messaging_basic_auth_password: BW_PASSWORD,
|
36
|
-
multi_factor_auth_basic_auth_user_name: BW_USERNAME,
|
37
|
-
multi_factor_auth_basic_auth_password: BW_PASSWORD,
|
38
|
-
phone_number_lookup_basic_auth_user_name: BW_USERNAME,
|
39
|
-
phone_number_lookup_basic_auth_password: BW_PASSWORD
|
40
|
-
)
|
41
|
-
|
42
|
-
@bandwidth_client_invalid_auth = Bandwidth::Client.new(
|
43
|
-
voice_basic_auth_user_name: "bad_username",
|
44
|
-
voice_basic_auth_password: "bad_password",
|
45
|
-
messaging_basic_auth_user_name: "bad_username",
|
46
|
-
messaging_basic_auth_password: "bad_password",
|
47
|
-
multi_factor_auth_basic_auth_user_name: "bad_username",
|
48
|
-
multi_factor_auth_basic_auth_password: "bad_password",
|
49
|
-
phone_number_lookup_basic_auth_user_name: "bad_username",
|
50
|
-
phone_number_lookup_basic_auth_password: "bad_password"
|
51
|
-
)
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_create_message
|
55
|
-
body = MessageRequest.new
|
56
|
-
body.application_id = BW_MESSAGING_APPLICATION_ID
|
57
|
-
body.to = [USER_NUMBER]
|
58
|
-
body.from = BW_NUMBER
|
59
|
-
body.text = "Ruby Integration"
|
60
|
-
response = @bandwidth_client.messaging_client.client.create_message(BW_ACCOUNT_ID, body)
|
61
|
-
assert(response.data.id.length > 0, "id value not set") #validate that _some_ id was returned
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_create_message_invalid_phone_number
|
65
|
-
body = MessageRequest.new
|
66
|
-
body.application_id = BW_MESSAGING_APPLICATION_ID
|
67
|
-
body.to = ["+1invalid"]
|
68
|
-
body.from = BW_NUMBER
|
69
|
-
body.text = "Ruby Integration"
|
70
|
-
begin
|
71
|
-
@bandwidth_client.messaging_client.client.create_message(BW_ACCOUNT_ID, body)
|
72
|
-
#workaround to make sure that if the above error is not raised, the build will fail
|
73
|
-
assert(false, "Expected exception not raised")
|
74
|
-
rescue MessagingException => e
|
75
|
-
assert(e.description.length > 0, "description value not set")
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_upload_download_media
|
80
|
-
#define constants for upload media and download media
|
81
|
-
media_id = "text-media-id-" + SecureRandom.uuid
|
82
|
-
media = "Hello world"
|
83
|
-
|
84
|
-
#media upload
|
85
|
-
@bandwidth_client.messaging_client.client.upload_media(BW_ACCOUNT_ID, media_id, media, :content_type => "text/plain", :cache_control => "no-cache")
|
86
|
-
|
87
|
-
#media download
|
88
|
-
downloaded_media = @bandwidth_client.messaging_client.client.get_media(BW_ACCOUNT_ID, media_id).data
|
89
|
-
|
90
|
-
assert_equal(downloaded_media, media, "Downloaded media file not equal to upload")
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_get_message
|
94
|
-
# Send a successful request to the GET messages API
|
95
|
-
response = @bandwidth_client.messaging_client.client.get_messages(BW_ACCOUNT_ID, :message_id => "abc123")
|
96
|
-
assert_equal(response.status_code, 200, "API did not return a 200 OK")
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_get_message_invalid_auth
|
100
|
-
# Send an unsuccessful request to the GET messages API
|
101
|
-
assert_raise MessagingException do
|
102
|
-
response = @bandwidth_client_invalid_auth.messaging_client.client.get_messages(BW_ACCOUNT_ID)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_create_call_and_get_call_state
|
107
|
-
body = CreateCallRequest.new
|
108
|
-
body.from = BW_NUMBER
|
109
|
-
body.to = USER_NUMBER
|
110
|
-
body.application_id = BW_VOICE_APPLICATION_ID
|
111
|
-
body.answer_url = BASE_CALLBACK_URL
|
112
|
-
response = @bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, body)
|
113
|
-
assert(response.data.call_id.length > 0, "call_id value not set")
|
114
|
-
assert_not_nil(response.data.enqueued_time, "enqueued time is nil")
|
115
|
-
assert(response.data.enqueued_time.is_a?(DateTime), "enqueued time is not a DateTime object")
|
116
|
-
|
117
|
-
#Get phone call information
|
118
|
-
sleep 1
|
119
|
-
response = @bandwidth_client.voice_client.client.get_call(BW_ACCOUNT_ID, response.data.call_id)
|
120
|
-
assert(response.data.state.length > 0, "state value not set")
|
121
|
-
assert_not_nil(response.data.enqueued_time, "enqueued time is nil")
|
122
|
-
assert(response.data.enqueued_time.is_a?(DateTime), "enqueued time is not a DateTime object")
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_create_call_with_amd_and_get_call_state
|
126
|
-
machine_detection = MachineDetectionConfiguration.new
|
127
|
-
machine_detection.mode = 'async'
|
128
|
-
machine_detection.detection_timeout = 5.0
|
129
|
-
machine_detection.silence_timeout = 5.0
|
130
|
-
machine_detection.speech_threshold = 5.0
|
131
|
-
machine_detection.speech_end_threshold = 5.0
|
132
|
-
machine_detection.delay_result = true
|
133
|
-
machine_detection.callback_url = BASE_CALLBACK_URL + '/machineDetection'
|
134
|
-
machine_detection.callback_method = 'POST'
|
135
|
-
machine_detection.machine_speech_end_threshold = 3.2
|
136
|
-
|
137
|
-
body = CreateCallRequest.new
|
138
|
-
body.from = BW_NUMBER
|
139
|
-
body.to = USER_NUMBER
|
140
|
-
body.application_id = BW_VOICE_APPLICATION_ID
|
141
|
-
body.answer_url = BASE_CALLBACK_URL
|
142
|
-
body.machine_detection = machine_detection
|
143
|
-
response = @bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, body)
|
144
|
-
assert(response.data.call_id.length > 0, "call_id value not set")
|
145
|
-
|
146
|
-
#Get phone call information
|
147
|
-
response = @bandwidth_client.voice_client.client.get_call(BW_ACCOUNT_ID, response.data.call_id)
|
148
|
-
assert(response.data.state.length > 0, "state value not set")
|
149
|
-
end
|
150
|
-
|
151
|
-
def test_create_call_with_priority
|
152
|
-
body = CreateCallRequest.new
|
153
|
-
body.from = BW_NUMBER
|
154
|
-
body.to = USER_NUMBER
|
155
|
-
body.application_id = BW_VOICE_APPLICATION_ID
|
156
|
-
body.answer_url = BASE_CALLBACK_URL
|
157
|
-
body.priority = 1
|
158
|
-
|
159
|
-
response = @bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, body)
|
160
|
-
assert(response.data.call_id.length > 0, "call_id value not set")
|
161
|
-
assert(response.data.priority == 1, "priority not set")
|
162
|
-
end
|
163
|
-
|
164
|
-
def test_create_call_invalid_phone_number
|
165
|
-
body = CreateCallRequest.new
|
166
|
-
body.from = BW_NUMBER
|
167
|
-
body.to = "+1invalid"
|
168
|
-
body.application_id = BW_VOICE_APPLICATION_ID
|
169
|
-
body.answer_url = BASE_CALLBACK_URL
|
170
|
-
|
171
|
-
begin
|
172
|
-
@bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, :body => body)
|
173
|
-
#workaround to make sure that if the above error is not raised, the build will fail
|
174
|
-
assert(false, "Expected exception not raised")
|
175
|
-
rescue ApiErrorException => e
|
176
|
-
assert(e.description.length > 0, "description value not set")
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
def test_forward
|
181
|
-
forward = Bandwidth::Voice::Forward.new({
|
182
|
-
:to => "+15554443333",
|
183
|
-
:from => "+13334445555",
|
184
|
-
:call_timeout => 25,
|
185
|
-
:diversion_treatment => "none",
|
186
|
-
:diversion_reason => "away"
|
187
|
-
})
|
188
|
-
|
189
|
-
response = Bandwidth::Voice::Response.new()
|
190
|
-
response.push(forward)
|
191
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Forward to="+15554443333" from="+13334445555" callTimeout="25" diversionTreatment="none" diversionReason="away"/></Response>'
|
192
|
-
actual = response.to_bxml()
|
193
|
-
assert_equal(expected, actual)
|
194
|
-
end
|
195
|
-
|
196
|
-
def test_gather
|
197
|
-
gather = Bandwidth::Voice::Gather.new({
|
198
|
-
:gather_url => "https://test.com",
|
199
|
-
:gather_method => "POST",
|
200
|
-
:username => "user",
|
201
|
-
:password => "pass",
|
202
|
-
:tag => "tag",
|
203
|
-
:terminating_digits => "#",
|
204
|
-
:max_digits => 3,
|
205
|
-
:inter_digit_timeout => 5,
|
206
|
-
:first_digit_timeout => "10",
|
207
|
-
:repeat_count => 1,
|
208
|
-
:gather_fallback_url => "https://test.com",
|
209
|
-
:gather_fallback_method => "GET",
|
210
|
-
:fallback_username => "fuser",
|
211
|
-
:fallback_password => "fpass"
|
212
|
-
})
|
213
|
-
|
214
|
-
response = Bandwidth::Voice::Response.new()
|
215
|
-
response.push(gather)
|
216
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Gather gatherUrl="https://test.com" gatherMethod="POST" terminatingDigits="#" tag="tag" maxDigits="3" interDigitTimeout="5" username="user" password="pass" firstDigitTimeout="10" repeatCount="1" gatherFallbackUrl="https://test.com" gatherFallbackMethod="GET" fallbackUsername="fuser" fallbackPassword="fpass"></Gather></Response>'
|
217
|
-
actual = response.to_bxml()
|
218
|
-
assert_equal(expected, actual)
|
219
|
-
end
|
220
|
-
|
221
|
-
def test_gather_nested_speak_sentence
|
222
|
-
speak_sentence = Bandwidth::Voice::SpeakSentence.new({
|
223
|
-
:sentence => "test"
|
224
|
-
})
|
225
|
-
gather = Bandwidth::Voice::Gather.new({
|
226
|
-
:speak_sentence => speak_sentence
|
227
|
-
})
|
228
|
-
|
229
|
-
response = Bandwidth::Voice::Response.new()
|
230
|
-
response.push(gather)
|
231
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Gather><SpeakSentence>test</SpeakSentence></Gather></Response>'
|
232
|
-
actual = response.to_bxml()
|
233
|
-
assert_equal(expected, actual)
|
234
|
-
end
|
235
|
-
|
236
|
-
def test_gather_nested_play_audio
|
237
|
-
play_audio = Bandwidth::Voice::PlayAudio.new({
|
238
|
-
:url => "https://test.com"
|
239
|
-
})
|
240
|
-
gather = Bandwidth::Voice::Gather.new({
|
241
|
-
:play_audio => play_audio
|
242
|
-
})
|
243
|
-
|
244
|
-
response = Bandwidth::Voice::Response.new()
|
245
|
-
response.push(gather)
|
246
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Gather><PlayAudio>https://test.com</PlayAudio></Gather></Response>'
|
247
|
-
actual = response.to_bxml()
|
248
|
-
assert_equal(expected, actual)
|
249
|
-
end
|
250
|
-
|
251
|
-
def test_gather_multiple_nested_verbs
|
252
|
-
play_audio = Bandwidth::Voice::PlayAudio.new({
|
253
|
-
:url => "https://test.com"
|
254
|
-
})
|
255
|
-
speak_sentence = Bandwidth::Voice::SpeakSentence.new({
|
256
|
-
:sentence => "test"
|
257
|
-
})
|
258
|
-
gather = Bandwidth::Voice::Gather.new({
|
259
|
-
:nested_verbs => [play_audio, speak_sentence]
|
260
|
-
})
|
261
|
-
|
262
|
-
response = Bandwidth::Voice::Response.new()
|
263
|
-
response.push(gather)
|
264
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Gather><PlayAudio>https://test.com</PlayAudio><SpeakSentence>test</SpeakSentence></Gather></Response>'
|
265
|
-
actual = response.to_bxml()
|
266
|
-
assert_equal(expected, actual)
|
267
|
-
end
|
268
|
-
|
269
|
-
def test_empty_bxml_verb
|
270
|
-
bxml = Bandwidth::Voice::Bxml.new()
|
271
|
-
|
272
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Bxml></Bxml>'
|
273
|
-
actual = bxml.to_bxml()
|
274
|
-
assert_equal(expected, actual)
|
275
|
-
end
|
276
|
-
|
277
|
-
def test_speak_sentence_pause
|
278
|
-
bxml = Bandwidth::Voice::Bxml.new()
|
279
|
-
|
280
|
-
speak_sentence = Bandwidth::Voice::SpeakSentence.new({
|
281
|
-
:sentence => "new modify call bxml is pog",
|
282
|
-
:voice => "Julie"
|
283
|
-
})
|
284
|
-
|
285
|
-
pause = Bandwidth::Voice::Pause.new({
|
286
|
-
:duration => 6
|
287
|
-
})
|
288
|
-
|
289
|
-
bxml.push(speak_sentence)
|
290
|
-
bxml.push(pause)
|
291
|
-
|
292
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Bxml><SpeakSentence voice="Julie">new modify call bxml is pog</SpeakSentence><Pause duration="6"/></Bxml>'
|
293
|
-
actual = bxml.to_bxml()
|
294
|
-
assert_equal(expected, actual)
|
295
|
-
end
|
296
|
-
|
297
|
-
def test_hangup
|
298
|
-
hangup = Bandwidth::Voice::Hangup.new()
|
299
|
-
|
300
|
-
response = Bandwidth::Voice::Response.new()
|
301
|
-
response.push(hangup)
|
302
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Hangup/></Response>'
|
303
|
-
actual = response.to_bxml()
|
304
|
-
assert_equal(expected, actual)
|
305
|
-
end
|
306
|
-
|
307
|
-
def test_pause
|
308
|
-
pause = Bandwidth::Voice::Pause.new({
|
309
|
-
:duration => 2
|
310
|
-
})
|
311
|
-
|
312
|
-
response = Bandwidth::Voice::Response.new()
|
313
|
-
response.push(pause)
|
314
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Pause duration="2"/></Response>'
|
315
|
-
actual = response.to_bxml()
|
316
|
-
assert_equal(expected, actual)
|
317
|
-
end
|
318
|
-
|
319
|
-
def test_pause_recording
|
320
|
-
pause_recording = Bandwidth::Voice::PauseRecording.new()
|
321
|
-
|
322
|
-
response = Bandwidth::Voice::Response.new()
|
323
|
-
response.push(pause_recording)
|
324
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><PauseRecording/></Response>'
|
325
|
-
actual = response.to_bxml()
|
326
|
-
assert_equal(expected, actual)
|
327
|
-
end
|
328
|
-
|
329
|
-
def test_play_audio
|
330
|
-
play_audio = Bandwidth::Voice::PlayAudio.new({
|
331
|
-
:url => "https://test.com",
|
332
|
-
:username => "user",
|
333
|
-
:password => "pass"
|
334
|
-
})
|
335
|
-
|
336
|
-
response = Bandwidth::Voice::Response.new()
|
337
|
-
response.push(play_audio)
|
338
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><PlayAudio username="user" password="pass">https://test.com</PlayAudio></Response>'
|
339
|
-
actual = response.to_bxml()
|
340
|
-
assert_equal(expected, actual)
|
341
|
-
end
|
342
|
-
|
343
|
-
def test_record
|
344
|
-
record = Bandwidth::Voice::Record.new({
|
345
|
-
:record_complete_url => "https://complete.com",
|
346
|
-
:record_complete_method => "POST",
|
347
|
-
:recording_available_url => "https://available.com",
|
348
|
-
:recording_available_method => "GET",
|
349
|
-
:transcribe => false,
|
350
|
-
:transcription_available_url => "https://transcribe.com",
|
351
|
-
:transcription_available_method => "POST",
|
352
|
-
:username => "user",
|
353
|
-
:password => "pass",
|
354
|
-
:tag => "tag",
|
355
|
-
:terminating_digits => "#",
|
356
|
-
:max_duration => 3,
|
357
|
-
:silence_timeout => 5,
|
358
|
-
:file_format => "wav",
|
359
|
-
:record_complete_fallback_url => "https://test.com",
|
360
|
-
:record_complete_fallback_method => "GET",
|
361
|
-
:fallback_username => "fuser",
|
362
|
-
:fallback_password => "fpass"
|
363
|
-
})
|
364
|
-
|
365
|
-
response = Bandwidth::Voice::Response.new()
|
366
|
-
response.push(record)
|
367
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Record tag="tag" username="user" password="pass" recordCompleteUrl="https://complete.com" recordCompleteMethod="POST" recordingAvailableUrl="https://available.com" recordingAvailableMethod="GET" terminatingDigits="#" maxDuration="3" fileFormat="wav" transcribe="false" transcriptionAvailableUrl="https://transcribe.com" transcriptionAvailableMethod="POST" silenceTimeout="5" recordCompleteFallbackUrl="https://test.com" recordCompleteFallbackMethod="GET" fallbackUsername="fuser" fallbackPassword="fpass"/></Response>'
|
368
|
-
actual = response.to_bxml()
|
369
|
-
assert_equal(expected, actual)
|
370
|
-
end
|
371
|
-
|
372
|
-
def test_redirect
|
373
|
-
redirect = Bandwidth::Voice::Redirect.new({
|
374
|
-
:redirect_url => "https://redirect.com",
|
375
|
-
:redirect_method => "GET",
|
376
|
-
:username => "user",
|
377
|
-
:password => "pass",
|
378
|
-
:tag => "tag",
|
379
|
-
:redirect_fallback_url => "https://test.com",
|
380
|
-
:redirect_fallback_method => "GET",
|
381
|
-
:fallback_username => "fuser",
|
382
|
-
:fallback_password => "fpass"
|
383
|
-
})
|
384
|
-
|
385
|
-
response = Bandwidth::Voice::Response.new()
|
386
|
-
response.push(redirect)
|
387
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Redirect redirectUrl="https://redirect.com" redirectMethod="GET" tag="tag" username="user" password="pass" redirectFallbackUrl="https://test.com" redirectFallbackMethod="GET" fallbackUsername="fuser" fallbackPassword="fpass"/></Response>'
|
388
|
-
actual = response.to_bxml()
|
389
|
-
assert_equal(expected, actual)
|
390
|
-
end
|
391
|
-
|
392
|
-
def test_resume_recording
|
393
|
-
resume_recording = Bandwidth::Voice::ResumeRecording.new()
|
394
|
-
|
395
|
-
response = Bandwidth::Voice::Response.new()
|
396
|
-
response.push(resume_recording)
|
397
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><ResumeRecording/></Response>'
|
398
|
-
actual = response.to_bxml()
|
399
|
-
assert_equal(expected, actual)
|
400
|
-
end
|
401
|
-
|
402
|
-
def test_send_dtmf
|
403
|
-
send_dtmf = Bandwidth::Voice::SendDtmf.new({
|
404
|
-
:dtmf => "12w34",
|
405
|
-
:tone_duration => 75,
|
406
|
-
:tone_interval => 65
|
407
|
-
})
|
408
|
-
|
409
|
-
response = Bandwidth::Voice::Response.new()
|
410
|
-
response.push(send_dtmf)
|
411
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><SendDtmf toneDuration="75" toneInterval="65">12w34</SendDtmf></Response>'
|
412
|
-
actual = response.to_bxml()
|
413
|
-
assert_equal(expected, actual)
|
414
|
-
end
|
415
|
-
|
416
|
-
def test_speak_sentence
|
417
|
-
speak_sentence = Bandwidth::Voice::SpeakSentence.new({
|
418
|
-
:sentence => "test",
|
419
|
-
:voice => "julie",
|
420
|
-
:gender => "female",
|
421
|
-
:locale => "en_US"
|
422
|
-
})
|
423
|
-
|
424
|
-
response = Bandwidth::Voice::Response.new()
|
425
|
-
response.push(speak_sentence)
|
426
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><SpeakSentence voice="julie" locale="en_US" gender="female">test</SpeakSentence></Response>'
|
427
|
-
actual = response.to_bxml()
|
428
|
-
assert_equal(expected, actual)
|
429
|
-
end
|
430
|
-
|
431
|
-
def test_speak_sentence_ssml
|
432
|
-
speak_sentence = Bandwidth::Voice::SpeakSentence.new({
|
433
|
-
:sentence => 'Hello, you have reached the home of <lang xml:lang="es-MX">Antonio Mendoza</lang>.Please leave a message.',
|
434
|
-
})
|
435
|
-
|
436
|
-
response = Bandwidth::Voice::Response.new()
|
437
|
-
response.push(speak_sentence)
|
438
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><SpeakSentence>Hello, you have reached the home of <lang xml:lang="es-MX">Antonio Mendoza</lang>.Please leave a message.</SpeakSentence></Response>'
|
439
|
-
actual = response.to_bxml()
|
440
|
-
assert_equal(expected, actual)
|
441
|
-
end
|
442
|
-
|
443
|
-
def test_start_recording
|
444
|
-
start_recording = Bandwidth::Voice::StartRecording.new({
|
445
|
-
:recording_available_url => "https://available.com",
|
446
|
-
:recording_available_method => "POST",
|
447
|
-
:transcribe => false,
|
448
|
-
:transcription_available_url => "https://transcribe.com",
|
449
|
-
:transcription_available_method => "GET",
|
450
|
-
:username => "user",
|
451
|
-
:password => "pass",
|
452
|
-
:tag => "tag",
|
453
|
-
:file_format => "mp3",
|
454
|
-
:multi_channel => true
|
455
|
-
})
|
456
|
-
|
457
|
-
response = Bandwidth::Voice::Response.new()
|
458
|
-
response.push(start_recording)
|
459
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StartRecording tag="tag" username="user" password="pass" recordingAvailableUrl="https://available.com" recordingAvailableMethod="POST" fileFormat="mp3" multiChannel="true" transcribe="false" transcriptionAvailableUrl="https://transcribe.com" transcriptionAvailableMethod="GET"/></Response>'
|
460
|
-
actual = response.to_bxml()
|
461
|
-
assert_equal(expected, actual)
|
462
|
-
end
|
463
|
-
|
464
|
-
def test_stop_recording
|
465
|
-
stop_recording = Bandwidth::Voice::StopRecording.new()
|
466
|
-
|
467
|
-
response = Bandwidth::Voice::Response.new()
|
468
|
-
response.push(stop_recording)
|
469
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StopRecording/></Response>'
|
470
|
-
actual = response.to_bxml()
|
471
|
-
assert_equal(expected, actual)
|
472
|
-
end
|
473
|
-
|
474
|
-
def test_transfer
|
475
|
-
phone_number = Bandwidth::Voice::PhoneNumber.new({
|
476
|
-
:number => "+15554443333",
|
477
|
-
:transfer_answer_url => "https://phoneanswer.com",
|
478
|
-
:transfer_answer_method => "GET",
|
479
|
-
:transfer_disconnect_url => "https://phonedisconnect.com",
|
480
|
-
:transfer_disconnect_method => "POST",
|
481
|
-
:username => "phoneuser",
|
482
|
-
:password => "phonepassword",
|
483
|
-
:tag => "phonetag",
|
484
|
-
:transfer_answer_fallback_url => "https://test.com",
|
485
|
-
:transfer_answer_fallback_method => "GET",
|
486
|
-
:fallback_username => "fuser",
|
487
|
-
:fallback_password => "fpass"
|
488
|
-
})
|
489
|
-
transfer = Bandwidth::Voice::Transfer.new({
|
490
|
-
:transfer_caller_id => "+13334445555",
|
491
|
-
:call_timeout => 3,
|
492
|
-
:transfer_complete_url => "https://transfercomplete.com",
|
493
|
-
:transfer_complete_method => "POST",
|
494
|
-
:username => "transferuser",
|
495
|
-
:password => "transferpass",
|
496
|
-
:tag => "transfertag",
|
497
|
-
:diversion_treatment => "none",
|
498
|
-
:diversion_reason => "away",
|
499
|
-
:phone_numbers => [phone_number],
|
500
|
-
:transfer_complete_fallback_url => "https://test.com",
|
501
|
-
:transfer_complete_fallback_method => "GET",
|
502
|
-
:fallback_username => "fusern",
|
503
|
-
:fallback_password => "fpassw"
|
504
|
-
})
|
505
|
-
|
506
|
-
response = Bandwidth::Voice::Response.new()
|
507
|
-
response.push(transfer)
|
508
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Transfer transferCallerId="+13334445555" callTimeout="3" tag="transfertag" transferCompleteUrl="https://transfercomplete.com" transferCompleteMethod="POST" username="transferuser" password="transferpass" diversionTreatment="none" diversionReason="away" transferCompleteFallbackUrl="https://test.com" transferCompleteFallbackMethod="GET" fallbackUsername="fusern" fallbackPassword="fpassw"><PhoneNumber transferAnswerUrl="https://phoneanswer.com" transferAnswerMethod="GET" transferDisconnectUrl="https://phonedisconnect.com" transferDisconnectMethod="POST" username="phoneuser" password="phonepassword" tag="phonetag" transferAnswerFallbackUrl="https://test.com" transferAnswerFallbackMethod="GET" fallbackUsername="fuser" fallbackPassword="fpass">+15554443333</PhoneNumber></Transfer></Response>'
|
509
|
-
actual = response.to_bxml()
|
510
|
-
assert_equal(expected, actual)
|
511
|
-
end
|
512
|
-
|
513
|
-
def test_conference
|
514
|
-
conference = Bandwidth::Voice::Conference.new({
|
515
|
-
:conference_name => 'my-conference',
|
516
|
-
:mute => false,
|
517
|
-
:hold => true,
|
518
|
-
:call_ids_to_coach => "c-123,c-234",
|
519
|
-
:conference_event_url => "https://test.com",
|
520
|
-
:conference_event_method => "POST",
|
521
|
-
:username => "user",
|
522
|
-
:password => "pass",
|
523
|
-
:tag => "tag",
|
524
|
-
:conference_event_fallback_url => "https://test2.com",
|
525
|
-
:conference_event_fallback_method => "POST",
|
526
|
-
:fallback_username => "fuser",
|
527
|
-
:fallback_password => "fpass"
|
528
|
-
})
|
529
|
-
response = Bandwidth::Voice::Response.new()
|
530
|
-
response.push(conference)
|
531
|
-
|
532
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Conference mute="false" hold="true" callIdsToCoach="c-123,c-234" conferenceEventUrl="https://test.com" conferenceEventMethod="POST" username="user" password="pass" tag="tag" conferenceEventFallbackUrl="https://test2.com" conferenceEventFallbackMethod="POST" fallbackUsername="fuser" fallbackPassword="fpass">my-conference</Conference></Response>'
|
533
|
-
actual = response.to_bxml()
|
534
|
-
assert_equal(expected, actual)
|
535
|
-
end
|
536
|
-
|
537
|
-
def test_conference_coach_ids_array
|
538
|
-
conference = Bandwidth::Voice::Conference.new({
|
539
|
-
:conference_name => 'my-conference',
|
540
|
-
:call_ids_to_coach => ["c-123", "c-234"],
|
541
|
-
})
|
542
|
-
response = Bandwidth::Voice::Response.new()
|
543
|
-
response.push(conference)
|
544
|
-
|
545
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Conference callIdsToCoach="c-123,c-234">my-conference</Conference></Response>'
|
546
|
-
actual = response.to_bxml()
|
547
|
-
assert_equal(expected, actual)
|
548
|
-
end
|
549
|
-
|
550
|
-
def test_conference_no_coach
|
551
|
-
conference = Bandwidth::Voice::Conference.new({
|
552
|
-
:conference_name => 'my-conference'
|
553
|
-
})
|
554
|
-
response = Bandwidth::Voice::Response.new()
|
555
|
-
response.push(conference)
|
556
|
-
|
557
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Conference>my-conference</Conference></Response>'
|
558
|
-
actual = response.to_bxml()
|
559
|
-
assert_equal(expected, actual)
|
560
|
-
end
|
561
|
-
|
562
|
-
def test_mfa_messaging
|
563
|
-
body = TwoFactorCodeRequestSchema.new
|
564
|
-
body.from = BW_NUMBER
|
565
|
-
body.to = USER_NUMBER
|
566
|
-
body.application_id = BW_MESSAGING_APPLICATION_ID
|
567
|
-
body.scope = "scope"
|
568
|
-
body.digits = 6
|
569
|
-
body.message = "Your temporary {NAME} {SCOPE} code is {CODE}"
|
570
|
-
|
571
|
-
response = @bandwidth_client.multi_factor_auth_client.mfa.create_messaging_two_factor(BW_ACCOUNT_ID, body)
|
572
|
-
assert(response.data.message_id.length > 0, "message id value not set")
|
573
|
-
end
|
574
|
-
|
575
|
-
def test_mfa_voice
|
576
|
-
body = TwoFactorCodeRequestSchema.new
|
577
|
-
body.from = BW_NUMBER
|
578
|
-
body.to = USER_NUMBER
|
579
|
-
body.application_id = BW_VOICE_APPLICATION_ID
|
580
|
-
body.scope = "scope"
|
581
|
-
body.digits = 6
|
582
|
-
body.message = "Your temporary {NAME} {SCOPE} code is {CODE}"
|
583
|
-
|
584
|
-
response = @bandwidth_client.multi_factor_auth_client.mfa.create_voice_two_factor(BW_ACCOUNT_ID, body)
|
585
|
-
assert(response.data.call_id.length > 0, "call id value not set")
|
586
|
-
end
|
587
|
-
|
588
|
-
def test_mfa_verify
|
589
|
-
body = TwoFactorVerifyRequestSchema.new
|
590
|
-
body.to = "+1000" + rand(1111111..9999999).to_s
|
591
|
-
body.application_id = BW_VOICE_APPLICATION_ID
|
592
|
-
body.scope = "scope"
|
593
|
-
body.code = "123456"
|
594
|
-
body.expiration_time_in_minutes = 3
|
595
|
-
response = @bandwidth_client.multi_factor_auth_client.mfa.create_verify_two_factor(BW_ACCOUNT_ID, body)
|
596
|
-
#Ruby has no check to see if variables are of type boolean
|
597
|
-
#An explicit true/false check is required
|
598
|
-
assert(response.data.valid == true || response.data.valid == false, "'valid' variable is not a boolean")
|
599
|
-
end
|
600
|
-
|
601
|
-
def test_bridge
|
602
|
-
bridge = Bandwidth::Voice::Bridge.new({
|
603
|
-
:call_id => "c-c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d",
|
604
|
-
:bridge_complete_url => "https://test.com",
|
605
|
-
:bridge_complete_method => "POST",
|
606
|
-
:bridge_target_complete_url => "https://test2.com",
|
607
|
-
:bridge_target_complete_method => "GET",
|
608
|
-
:username => "user",
|
609
|
-
:password => "pass",
|
610
|
-
:tag => "custom tag",
|
611
|
-
:bridge_complete_fallback_url => "https://test3.com",
|
612
|
-
:bridge_complete_fallback_method => "GET",
|
613
|
-
:bridge_target_complete_fallback_url => "https://test4.com",
|
614
|
-
:bridge_target_complete_fallback_method => "POST",
|
615
|
-
:fallback_username => "fuser",
|
616
|
-
:fallback_password => "fpass"
|
617
|
-
})
|
618
|
-
|
619
|
-
response = Bandwidth::Voice::Response.new()
|
620
|
-
response.push(bridge)
|
621
|
-
|
622
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Bridge bridgeCompleteUrl="https://test.com" bridgeCompleteMethod="POST" bridgeTargetCompleteUrl="https://test2.com" bridgeTargetCompleteMethod="GET" username="user" password="pass" tag="custom tag" bridgeCompleteFallbackUrl="https://test3.com" bridgeCompleteFallbackMethod="GET" bridgeTargetCompleteFallbackUrl="https://test4.com" bridgeTargetCompleteFallbackMethod="POST" fallbackUsername="fuser" fallbackPassword="fpass">c-c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d</Bridge></Response>'
|
623
|
-
actual = response.to_bxml()
|
624
|
-
assert_equal(expected, actual)
|
625
|
-
end
|
626
|
-
|
627
|
-
def test_ring
|
628
|
-
ring = Bandwidth::Voice::Ring.new({
|
629
|
-
:duration => 5,
|
630
|
-
:answer_call => false
|
631
|
-
})
|
632
|
-
|
633
|
-
response = Bandwidth::Voice::Response.new()
|
634
|
-
response.push(ring)
|
635
|
-
|
636
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Ring duration="5" answerCall="false"/></Response>'
|
637
|
-
actual = response.to_bxml()
|
638
|
-
assert_equal(expected, actual)
|
639
|
-
end
|
640
|
-
|
641
|
-
def test_start_gather
|
642
|
-
start_gather = Bandwidth::Voice::StartGather.new({
|
643
|
-
:username => "user",
|
644
|
-
:password => "pass",
|
645
|
-
:tag => "custom tag",
|
646
|
-
:dtmf_url => "https://test.com",
|
647
|
-
:dtmf_method => "GET"
|
648
|
-
})
|
649
|
-
|
650
|
-
response = Bandwidth::Voice::Response.new()
|
651
|
-
response.push(start_gather)
|
652
|
-
|
653
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StartGather username="user" password="pass" tag="custom tag" dtmfUrl="https://test.com" dtmfMethod="GET"/></Response>'
|
654
|
-
actual = response.to_bxml()
|
655
|
-
assert_equal(expected, actual)
|
656
|
-
end
|
657
|
-
|
658
|
-
def test_stop_gather
|
659
|
-
stop_gather = Bandwidth::Voice::StopGather.new()
|
660
|
-
|
661
|
-
response = Bandwidth::Voice::Response.new()
|
662
|
-
response.push(stop_gather)
|
663
|
-
|
664
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StopGather/></Response>'
|
665
|
-
actual = response.to_bxml()
|
666
|
-
assert_equal(expected, actual)
|
667
|
-
end
|
668
|
-
|
669
|
-
def test_tn_lookup
|
670
|
-
body = OrderRequest.new
|
671
|
-
body.tns = [BW_NUMBER]
|
672
|
-
create_response = @bandwidth_client.phone_number_lookup_client.client.create_lookup_request(BW_ACCOUNT_ID, body)
|
673
|
-
assert(create_response.data.request_id.length > 0, "request_id value not set")
|
674
|
-
|
675
|
-
request_id = create_response.data.request_id
|
676
|
-
get_response = @bandwidth_client.phone_number_lookup_client.client.get_lookup_request_status(BW_ACCOUNT_ID, request_id)
|
677
|
-
assert(get_response.data.status.length > 0, "status value not set")
|
678
|
-
end
|
679
|
-
|
680
|
-
def test_webrtc_generate_bxml
|
681
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Transfer><SipUri uui="93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt">sip:sipx.webrtc.bandwidth.com:5060</SipUri></Transfer></Response>'
|
682
|
-
actual = Bandwidth::WebRtc.generate_bxml('asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4')
|
683
|
-
assert_equal(expected, actual)
|
684
|
-
end
|
685
|
-
|
686
|
-
def test_webrtc_generate_transfer_bxml_verb
|
687
|
-
expected = '<Transfer><SipUri uui="93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt">sip:sipx.webrtc.bandwidth.com:5060</SipUri></Transfer>'
|
688
|
-
actual = Bandwidth::WebRtc.generate_transfer_bxml_verb('asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4')
|
689
|
-
assert_equal(expected, actual)
|
690
|
-
end
|
691
|
-
|
692
|
-
def test_start_stream_bxml_verb
|
693
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StartStream destination="https://www.test.com/stream" name="test_stream" tracks="inbound" streamEventUrl="https://www.test.com/event" streamEventMethod="POST" username="username" password="password"><StreamParam name="name1" value="value1"/></StartStream></Response>'
|
694
|
-
response = Bandwidth::Voice::Response.new()
|
695
|
-
|
696
|
-
stream_param1 = Bandwidth::Voice::StreamParam.new({
|
697
|
-
:name => "name1",
|
698
|
-
:value => "value1"
|
699
|
-
})
|
700
|
-
|
701
|
-
start_stream = Bandwidth::Voice::StartStream.new({
|
702
|
-
:destination => "https://www.test.com/stream",
|
703
|
-
:name => "test_stream",
|
704
|
-
:tracks => "inbound",
|
705
|
-
:streamEventUrl => "https://www.test.com/event",
|
706
|
-
:streamEventMethod => "POST",
|
707
|
-
:username => "username",
|
708
|
-
:password => "password",
|
709
|
-
:stream_params => stream_param1
|
710
|
-
})
|
711
|
-
|
712
|
-
response.push(start_stream)
|
713
|
-
actual = response.to_bxml()
|
714
|
-
|
715
|
-
assert_equal(expected, actual)
|
716
|
-
end
|
717
|
-
|
718
|
-
def test_start_stream_multiple_nested_stream_params
|
719
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StartStream destination="https://www.test.com/stream" name="test_stream" tracks="inbound" streamEventUrl="https://www.test.com/event" streamEventMethod="POST" username="username" password="password"><StreamParam name="name1" value="value1"/><StreamParam name="name2" value="value2"/></StartStream></Response>'
|
720
|
-
response = Bandwidth::Voice::Response.new()
|
721
|
-
|
722
|
-
stream_param1 = Bandwidth::Voice::StreamParam.new({
|
723
|
-
:name => "name1",
|
724
|
-
:value => "value1"
|
725
|
-
})
|
726
|
-
|
727
|
-
stream_param2 = Bandwidth::Voice::StreamParam.new({
|
728
|
-
:name => "name2",
|
729
|
-
:value => "value2"
|
730
|
-
})
|
731
|
-
|
732
|
-
start_stream = Bandwidth::Voice::StartStream.new({
|
733
|
-
:destination => "https://www.test.com/stream",
|
734
|
-
:name => "test_stream",
|
735
|
-
:tracks => "inbound",
|
736
|
-
:streamEventUrl => "https://www.test.com/event",
|
737
|
-
:streamEventMethod => "POST",
|
738
|
-
:username => "username",
|
739
|
-
:password => "password",
|
740
|
-
:nested_verbs => [stream_param1, stream_param2]
|
741
|
-
})
|
742
|
-
|
743
|
-
response.push(start_stream)
|
744
|
-
actual = response.to_bxml()
|
745
|
-
|
746
|
-
assert_equal(expected, actual)
|
747
|
-
end
|
748
|
-
|
749
|
-
def test_stop_stream_bxml_verb
|
750
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StopStream name="test_stream"/></Response>'
|
751
|
-
response = Bandwidth::Voice::Response.new()
|
752
|
-
stop_stream = Bandwidth::Voice::StopStream.new({
|
753
|
-
:name => "test_stream"
|
754
|
-
})
|
755
|
-
response.push(stop_stream)
|
756
|
-
actual = response.to_bxml()
|
757
|
-
|
758
|
-
assert_equal(expected, actual)
|
759
|
-
end
|
760
|
-
end
|