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
@@ -0,0 +1,589 @@
|
|
1
|
+
=begin
|
2
|
+
#Bandwidth
|
3
|
+
|
4
|
+
#Bandwidth's Communication APIs
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: letstalk@bandwidth.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module Bandwidth
|
14
|
+
class Configuration
|
15
|
+
# Defines url scheme
|
16
|
+
attr_accessor :scheme
|
17
|
+
|
18
|
+
# Defines url host
|
19
|
+
attr_accessor :host
|
20
|
+
|
21
|
+
# Defines url base path
|
22
|
+
attr_accessor :base_path
|
23
|
+
|
24
|
+
# Define server configuration index
|
25
|
+
attr_accessor :server_index
|
26
|
+
|
27
|
+
# Define server operation configuration index
|
28
|
+
attr_accessor :server_operation_index
|
29
|
+
|
30
|
+
# Default server variables
|
31
|
+
attr_accessor :server_variables
|
32
|
+
|
33
|
+
# Default server operation variables
|
34
|
+
attr_accessor :server_operation_variables
|
35
|
+
|
36
|
+
# Defines API keys used with API Key authentications.
|
37
|
+
#
|
38
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
39
|
+
#
|
40
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
41
|
+
# config.api_key['api_key'] = 'xxx'
|
42
|
+
attr_accessor :api_key
|
43
|
+
|
44
|
+
# Defines API key prefixes used with API Key authentications.
|
45
|
+
#
|
46
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
47
|
+
#
|
48
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
49
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
50
|
+
attr_accessor :api_key_prefix
|
51
|
+
|
52
|
+
# Defines the username used with HTTP basic authentication.
|
53
|
+
#
|
54
|
+
# @return [String]
|
55
|
+
attr_accessor :username
|
56
|
+
|
57
|
+
# Defines the password used with HTTP basic authentication.
|
58
|
+
#
|
59
|
+
# @return [String]
|
60
|
+
attr_accessor :password
|
61
|
+
|
62
|
+
# Defines the access token (Bearer) used with OAuth2.
|
63
|
+
attr_accessor :access_token
|
64
|
+
|
65
|
+
# Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
|
66
|
+
# Overrides the access_token if set
|
67
|
+
# @return [Proc]
|
68
|
+
attr_accessor :access_token_getter
|
69
|
+
|
70
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
71
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
72
|
+
# Default to false.
|
73
|
+
attr_accessor :return_binary_data
|
74
|
+
|
75
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
76
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
77
|
+
# Default to false.
|
78
|
+
#
|
79
|
+
# @return [true, false]
|
80
|
+
attr_accessor :debugging
|
81
|
+
|
82
|
+
# Defines the logger used for debugging.
|
83
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
84
|
+
#
|
85
|
+
# @return [#debug]
|
86
|
+
attr_accessor :logger
|
87
|
+
|
88
|
+
# Defines the temporary folder to store downloaded files
|
89
|
+
# (for API endpoints that have file response).
|
90
|
+
# Default to use `Tempfile`.
|
91
|
+
#
|
92
|
+
# @return [String]
|
93
|
+
attr_accessor :temp_folder_path
|
94
|
+
|
95
|
+
# The time limit for HTTP request in seconds.
|
96
|
+
# Default to 0 (never times out).
|
97
|
+
attr_accessor :timeout
|
98
|
+
|
99
|
+
# Set this to false to skip client side validation in the operation.
|
100
|
+
# Default to true.
|
101
|
+
# @return [true, false]
|
102
|
+
attr_accessor :client_side_validation
|
103
|
+
|
104
|
+
### TLS/SSL setting
|
105
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
106
|
+
# Default to true.
|
107
|
+
#
|
108
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
109
|
+
#
|
110
|
+
# @return [true, false]
|
111
|
+
attr_accessor :ssl_verify
|
112
|
+
|
113
|
+
### TLS/SSL setting
|
114
|
+
# Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
|
115
|
+
#
|
116
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
117
|
+
#
|
118
|
+
attr_accessor :ssl_verify_mode
|
119
|
+
|
120
|
+
### TLS/SSL setting
|
121
|
+
# Set this to customize the certificate file to verify the peer.
|
122
|
+
#
|
123
|
+
# @return [String] the path to the certificate file
|
124
|
+
attr_accessor :ssl_ca_file
|
125
|
+
|
126
|
+
### TLS/SSL setting
|
127
|
+
# Client certificate file (for client certificate)
|
128
|
+
attr_accessor :ssl_client_cert
|
129
|
+
|
130
|
+
### TLS/SSL setting
|
131
|
+
# Client private key file (for client certificate)
|
132
|
+
attr_accessor :ssl_client_key
|
133
|
+
|
134
|
+
### Proxy setting
|
135
|
+
# HTTP Proxy settings
|
136
|
+
attr_accessor :proxy
|
137
|
+
|
138
|
+
# Set this to customize parameters encoder of array parameter.
|
139
|
+
# Default to nil. Faraday uses NestedParamsEncoder when nil.
|
140
|
+
#
|
141
|
+
# @see The params_encoder option of Faraday. Related source code:
|
142
|
+
# https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders
|
143
|
+
attr_accessor :params_encoder
|
144
|
+
|
145
|
+
|
146
|
+
attr_accessor :inject_format
|
147
|
+
|
148
|
+
attr_accessor :force_ending_format
|
149
|
+
|
150
|
+
def initialize
|
151
|
+
@scheme = 'http'
|
152
|
+
@host = 'localhost'
|
153
|
+
@base_path = ''
|
154
|
+
@server_index = 0
|
155
|
+
@server_operation_index = {}
|
156
|
+
@server_variables = {}
|
157
|
+
@server_operation_variables = {}
|
158
|
+
@api_key = {}
|
159
|
+
@api_key_prefix = {}
|
160
|
+
@client_side_validation = true
|
161
|
+
@ssl_verify = true
|
162
|
+
@ssl_verify_mode = nil
|
163
|
+
@ssl_ca_file = nil
|
164
|
+
@ssl_client_cert = nil
|
165
|
+
@ssl_client_key = nil
|
166
|
+
@middlewares = Hash.new { |h, k| h[k] = [] }
|
167
|
+
@configure_connection_blocks = []
|
168
|
+
@timeout = 60
|
169
|
+
# return data as binary instead of file
|
170
|
+
@return_binary_data = false
|
171
|
+
@params_encoder = nil
|
172
|
+
@debugging = false
|
173
|
+
@inject_format = false
|
174
|
+
@force_ending_format = false
|
175
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
176
|
+
|
177
|
+
yield(self) if block_given?
|
178
|
+
end
|
179
|
+
|
180
|
+
# The default Configuration object.
|
181
|
+
def self.default
|
182
|
+
@@default ||= Configuration.new
|
183
|
+
end
|
184
|
+
|
185
|
+
def configure
|
186
|
+
yield(self) if block_given?
|
187
|
+
end
|
188
|
+
|
189
|
+
def scheme=(scheme)
|
190
|
+
# remove :// from scheme
|
191
|
+
@scheme = scheme.sub(/:\/\//, '')
|
192
|
+
end
|
193
|
+
|
194
|
+
def host=(host)
|
195
|
+
# remove http(s):// and anything after a slash
|
196
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
197
|
+
end
|
198
|
+
|
199
|
+
def base_path=(base_path)
|
200
|
+
# Add leading and trailing slashes to base_path
|
201
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
202
|
+
@base_path = '' if @base_path == '/'
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns base URL for specified operation based on server settings
|
206
|
+
def base_url(operation = nil)
|
207
|
+
index = server_operation_index.fetch(operation, server_index)
|
208
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
|
209
|
+
|
210
|
+
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
211
|
+
end
|
212
|
+
|
213
|
+
# Gets API key (with prefix if set).
|
214
|
+
# @param [String] param_name the parameter name of API key auth
|
215
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
216
|
+
key = @api_key[param_name]
|
217
|
+
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
218
|
+
if @api_key_prefix[param_name]
|
219
|
+
"#{@api_key_prefix[param_name]} #{key}"
|
220
|
+
else
|
221
|
+
key
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
# Gets access_token using access_token_getter or uses the static access_token
|
226
|
+
def access_token_with_refresh
|
227
|
+
return access_token if access_token_getter.nil?
|
228
|
+
access_token_getter.call
|
229
|
+
end
|
230
|
+
|
231
|
+
# Gets Basic Auth token string
|
232
|
+
def basic_auth_token
|
233
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
234
|
+
end
|
235
|
+
|
236
|
+
# Returns Auth Settings hash for api client.
|
237
|
+
def auth_settings
|
238
|
+
{
|
239
|
+
'Basic' =>
|
240
|
+
{
|
241
|
+
type: 'basic',
|
242
|
+
in: 'header',
|
243
|
+
key: 'Authorization',
|
244
|
+
value: basic_auth_token
|
245
|
+
},
|
246
|
+
}
|
247
|
+
end
|
248
|
+
|
249
|
+
# Returns an array of Server setting
|
250
|
+
def server_settings
|
251
|
+
[
|
252
|
+
{
|
253
|
+
url: "",
|
254
|
+
description: "No description provided",
|
255
|
+
}
|
256
|
+
]
|
257
|
+
end
|
258
|
+
|
259
|
+
def operation_server_settings
|
260
|
+
{
|
261
|
+
"CallsApi.create_call": [
|
262
|
+
{
|
263
|
+
url: "https://voice.bandwidth.com/api/v2",
|
264
|
+
description: "Production",
|
265
|
+
}
|
266
|
+
],
|
267
|
+
"CallsApi.get_call_state": [
|
268
|
+
{
|
269
|
+
url: "https://voice.bandwidth.com/api/v2",
|
270
|
+
description: "Production",
|
271
|
+
}
|
272
|
+
],
|
273
|
+
"CallsApi.update_call": [
|
274
|
+
{
|
275
|
+
url: "https://voice.bandwidth.com/api/v2",
|
276
|
+
description: "Production",
|
277
|
+
}
|
278
|
+
],
|
279
|
+
"CallsApi.update_call_bxml": [
|
280
|
+
{
|
281
|
+
url: "https://voice.bandwidth.com/api/v2",
|
282
|
+
description: "Production",
|
283
|
+
}
|
284
|
+
],
|
285
|
+
"ConferencesApi.download_conference_recording": [
|
286
|
+
{
|
287
|
+
url: "https://voice.bandwidth.com/api/v2",
|
288
|
+
description: "Production",
|
289
|
+
}
|
290
|
+
],
|
291
|
+
"ConferencesApi.get_conference": [
|
292
|
+
{
|
293
|
+
url: "https://voice.bandwidth.com/api/v2",
|
294
|
+
description: "Production",
|
295
|
+
}
|
296
|
+
],
|
297
|
+
"ConferencesApi.get_conference_member": [
|
298
|
+
{
|
299
|
+
url: "https://voice.bandwidth.com/api/v2",
|
300
|
+
description: "Production",
|
301
|
+
}
|
302
|
+
],
|
303
|
+
"ConferencesApi.get_conference_recording": [
|
304
|
+
{
|
305
|
+
url: "https://voice.bandwidth.com/api/v2",
|
306
|
+
description: "Production",
|
307
|
+
}
|
308
|
+
],
|
309
|
+
"ConferencesApi.list_conference_recordings": [
|
310
|
+
{
|
311
|
+
url: "https://voice.bandwidth.com/api/v2",
|
312
|
+
description: "Production",
|
313
|
+
}
|
314
|
+
],
|
315
|
+
"ConferencesApi.list_conferences": [
|
316
|
+
{
|
317
|
+
url: "https://voice.bandwidth.com/api/v2",
|
318
|
+
description: "Production",
|
319
|
+
}
|
320
|
+
],
|
321
|
+
"ConferencesApi.update_conference": [
|
322
|
+
{
|
323
|
+
url: "https://voice.bandwidth.com/api/v2",
|
324
|
+
description: "Production",
|
325
|
+
}
|
326
|
+
],
|
327
|
+
"ConferencesApi.update_conference_bxml": [
|
328
|
+
{
|
329
|
+
url: "https://voice.bandwidth.com/api/v2",
|
330
|
+
description: "Production",
|
331
|
+
}
|
332
|
+
],
|
333
|
+
"ConferencesApi.update_conference_member": [
|
334
|
+
{
|
335
|
+
url: "https://voice.bandwidth.com/api/v2",
|
336
|
+
description: "Production",
|
337
|
+
}
|
338
|
+
],
|
339
|
+
"MFAApi.generate_messaging_code": [
|
340
|
+
{
|
341
|
+
url: "https://mfa.bandwidth.com/api/v1",
|
342
|
+
description: "Production",
|
343
|
+
}
|
344
|
+
],
|
345
|
+
"MFAApi.generate_voice_code": [
|
346
|
+
{
|
347
|
+
url: "https://mfa.bandwidth.com/api/v1",
|
348
|
+
description: "Production",
|
349
|
+
}
|
350
|
+
],
|
351
|
+
"MFAApi.verify_code": [
|
352
|
+
{
|
353
|
+
url: "https://mfa.bandwidth.com/api/v1",
|
354
|
+
description: "Production",
|
355
|
+
}
|
356
|
+
],
|
357
|
+
"MediaApi.delete_media": [
|
358
|
+
{
|
359
|
+
url: "https://messaging.bandwidth.com/api/v2",
|
360
|
+
description: "Production",
|
361
|
+
}
|
362
|
+
],
|
363
|
+
"MediaApi.get_media": [
|
364
|
+
{
|
365
|
+
url: "https://messaging.bandwidth.com/api/v2",
|
366
|
+
description: "Production",
|
367
|
+
}
|
368
|
+
],
|
369
|
+
"MediaApi.list_media": [
|
370
|
+
{
|
371
|
+
url: "https://messaging.bandwidth.com/api/v2",
|
372
|
+
description: "Production",
|
373
|
+
}
|
374
|
+
],
|
375
|
+
"MediaApi.upload_media": [
|
376
|
+
{
|
377
|
+
url: "https://messaging.bandwidth.com/api/v2",
|
378
|
+
description: "Production",
|
379
|
+
}
|
380
|
+
],
|
381
|
+
"MessagesApi.create_message": [
|
382
|
+
{
|
383
|
+
url: "https://messaging.bandwidth.com/api/v2",
|
384
|
+
description: "Production",
|
385
|
+
}
|
386
|
+
],
|
387
|
+
"MessagesApi.list_messages": [
|
388
|
+
{
|
389
|
+
url: "https://messaging.bandwidth.com/api/v2",
|
390
|
+
description: "Production",
|
391
|
+
}
|
392
|
+
],
|
393
|
+
"PhoneNumberLookupApi.create_lookup": [
|
394
|
+
{
|
395
|
+
url: "https://numbers.bandwidth.com/api/v1",
|
396
|
+
description: "Production",
|
397
|
+
}
|
398
|
+
],
|
399
|
+
"PhoneNumberLookupApi.get_lookup_status": [
|
400
|
+
{
|
401
|
+
url: "https://numbers.bandwidth.com/api/v1",
|
402
|
+
description: "Production",
|
403
|
+
}
|
404
|
+
],
|
405
|
+
"RecordingsApi.delete_call_transcription": [
|
406
|
+
{
|
407
|
+
url: "https://voice.bandwidth.com/api/v2",
|
408
|
+
description: "Production",
|
409
|
+
}
|
410
|
+
],
|
411
|
+
"RecordingsApi.delete_recording": [
|
412
|
+
{
|
413
|
+
url: "https://voice.bandwidth.com/api/v2",
|
414
|
+
description: "Production",
|
415
|
+
}
|
416
|
+
],
|
417
|
+
"RecordingsApi.delete_recording_media": [
|
418
|
+
{
|
419
|
+
url: "https://voice.bandwidth.com/api/v2",
|
420
|
+
description: "Production",
|
421
|
+
}
|
422
|
+
],
|
423
|
+
"RecordingsApi.download_call_recording": [
|
424
|
+
{
|
425
|
+
url: "https://voice.bandwidth.com/api/v2",
|
426
|
+
description: "Production",
|
427
|
+
}
|
428
|
+
],
|
429
|
+
"RecordingsApi.get_call_recording": [
|
430
|
+
{
|
431
|
+
url: "https://voice.bandwidth.com/api/v2",
|
432
|
+
description: "Production",
|
433
|
+
}
|
434
|
+
],
|
435
|
+
"RecordingsApi.get_call_transcription": [
|
436
|
+
{
|
437
|
+
url: "https://voice.bandwidth.com/api/v2",
|
438
|
+
description: "Production",
|
439
|
+
}
|
440
|
+
],
|
441
|
+
"RecordingsApi.list_account_call_recordings": [
|
442
|
+
{
|
443
|
+
url: "https://voice.bandwidth.com/api/v2",
|
444
|
+
description: "Production",
|
445
|
+
}
|
446
|
+
],
|
447
|
+
"RecordingsApi.list_call_recordings": [
|
448
|
+
{
|
449
|
+
url: "https://voice.bandwidth.com/api/v2",
|
450
|
+
description: "Production",
|
451
|
+
}
|
452
|
+
],
|
453
|
+
"RecordingsApi.transcribe_call_recording": [
|
454
|
+
{
|
455
|
+
url: "https://voice.bandwidth.com/api/v2",
|
456
|
+
description: "Production",
|
457
|
+
}
|
458
|
+
],
|
459
|
+
"RecordingsApi.update_call_recording_state": [
|
460
|
+
{
|
461
|
+
url: "https://voice.bandwidth.com/api/v2",
|
462
|
+
description: "Production",
|
463
|
+
}
|
464
|
+
],
|
465
|
+
"StatisticsApi.get_statistics": [
|
466
|
+
{
|
467
|
+
url: "https://voice.bandwidth.com/api/v2",
|
468
|
+
description: "Production",
|
469
|
+
}
|
470
|
+
],
|
471
|
+
}
|
472
|
+
end
|
473
|
+
|
474
|
+
# Returns URL based on server settings
|
475
|
+
#
|
476
|
+
# @param index array index of the server settings
|
477
|
+
# @param variables hash of variable and the corresponding value
|
478
|
+
def server_url(index, variables = {}, servers = nil)
|
479
|
+
servers = server_settings if servers == nil
|
480
|
+
|
481
|
+
# check array index out of bound
|
482
|
+
if (index < 0 || index >= servers.size)
|
483
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
484
|
+
end
|
485
|
+
|
486
|
+
server = servers[index]
|
487
|
+
url = server[:url]
|
488
|
+
|
489
|
+
return url unless server.key? :variables
|
490
|
+
|
491
|
+
# go through variable and assign a value
|
492
|
+
server[:variables].each do |name, variable|
|
493
|
+
if variables.key?(name)
|
494
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
495
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
496
|
+
else
|
497
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
498
|
+
end
|
499
|
+
else
|
500
|
+
# use default value
|
501
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
url
|
506
|
+
end
|
507
|
+
|
508
|
+
# Configure Faraday connection directly.
|
509
|
+
#
|
510
|
+
# ```
|
511
|
+
# c.configure_faraday_connection do |conn|
|
512
|
+
# conn.use Faraday::HttpCache, shared_cache: false, logger: logger
|
513
|
+
# conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger|
|
514
|
+
# logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]')
|
515
|
+
# end
|
516
|
+
# end
|
517
|
+
#
|
518
|
+
# c.configure_faraday_connection do |conn|
|
519
|
+
# conn.adapter :typhoeus
|
520
|
+
# end
|
521
|
+
# ```
|
522
|
+
#
|
523
|
+
# @param block [Proc] `#call`able object that takes one arg, the connection
|
524
|
+
def configure_faraday_connection(&block)
|
525
|
+
@configure_connection_blocks << block
|
526
|
+
end
|
527
|
+
|
528
|
+
def configure_connection(conn)
|
529
|
+
@configure_connection_blocks.each do |block|
|
530
|
+
block.call(conn)
|
531
|
+
end
|
532
|
+
end
|
533
|
+
|
534
|
+
# Adds middleware to the stack
|
535
|
+
def use(*middleware)
|
536
|
+
set_faraday_middleware(:use, *middleware)
|
537
|
+
end
|
538
|
+
|
539
|
+
# Adds request middleware to the stack
|
540
|
+
def request(*middleware)
|
541
|
+
set_faraday_middleware(:request, *middleware)
|
542
|
+
end
|
543
|
+
|
544
|
+
# Adds response middleware to the stack
|
545
|
+
def response(*middleware)
|
546
|
+
set_faraday_middleware(:response, *middleware)
|
547
|
+
end
|
548
|
+
|
549
|
+
# Adds Faraday middleware setting information to the stack
|
550
|
+
#
|
551
|
+
# @example Use the `set_faraday_middleware` method to set middleware information
|
552
|
+
# config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
|
553
|
+
# config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
|
554
|
+
# config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
|
555
|
+
# config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
|
556
|
+
# config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
|
557
|
+
# config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
|
558
|
+
#
|
559
|
+
# @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
|
560
|
+
def set_faraday_middleware(operation, key, *args, &block)
|
561
|
+
unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
|
562
|
+
fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
|
563
|
+
" :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
|
564
|
+
end
|
565
|
+
|
566
|
+
@middlewares[operation] << [key, args, block]
|
567
|
+
end
|
568
|
+
ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
|
569
|
+
|
570
|
+
# Set up middleware on the connection
|
571
|
+
def configure_middleware(connection)
|
572
|
+
return if @middlewares.empty?
|
573
|
+
|
574
|
+
[:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
|
575
|
+
next unless @middlewares.key?(operation)
|
576
|
+
|
577
|
+
@middlewares[operation].each do |key, args, block|
|
578
|
+
connection.builder.send(operation, key, *args, &block)
|
579
|
+
end
|
580
|
+
end
|
581
|
+
|
582
|
+
if @middlewares.key?(:delete)
|
583
|
+
@middlewares[:delete].each do |key, _args, _block|
|
584
|
+
connection.builder.delete(key)
|
585
|
+
end
|
586
|
+
end
|
587
|
+
end
|
588
|
+
end
|
589
|
+
end
|