diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 65f8a96f..f05c6324 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -5,6 +5,8 @@ Gemfile README.md bandwidth-sdk.gemspec docs/AccountStatistics.md +docs/AdditionalDenialReason.md +docs/Address.md docs/AnswerCallback.md docs/BridgeCompleteCallback.md docs/BridgeTargetCompleteCallback.md @@ -32,6 +34,7 @@ docs/ConferenceRecordingMetadata.md docs/ConferenceRedirectCallback.md docs/ConferenceStateEnum.md docs/ConferencesApi.md +docs/Contact.md docs/CreateCall.md docs/CreateCallResponse.md docs/CreateLookupResponse.md @@ -40,10 +43,13 @@ docs/DeferredResult.md docs/DisconnectCallback.md docs/Diversion.md docs/DtmfCallback.md +docs/Error.md +docs/FailureWebhook.md docs/FieldError.md docs/FileFormatEnum.md docs/GatherCallback.md docs/InitiateCallback.md +docs/LinksObject.md docs/ListMessageDirectionEnum.md docs/ListMessageItem.md docs/LookupRequest.md @@ -71,6 +77,7 @@ docs/MessagingRequestError.md docs/MfaForbiddenRequestError.md docs/MfaRequestError.md docs/MfaUnauthorizedRequestError.md +docs/OptInWorkflow.md docs/PageInfo.md docs/PhoneNumberLookupApi.md docs/PriorityEnum.md @@ -85,7 +92,16 @@ docs/RedirectMethodEnum.md docs/StatisticsApi.md docs/StirShaken.md docs/Tag.md +docs/TelephoneNumber.md +docs/TfvBasicAuthentication.md +docs/TfvCallbackStatusEnum.md +docs/TfvError.md +docs/TfvStatus.md +docs/TfvStatusEnum.md +docs/TfvSubmissionInfo.md +docs/TfvSubmissionWrapper.md docs/TnLookupRequestError.md +docs/TollFreeVerificationApi.md docs/TranscribeRecording.md docs/Transcription.md docs/TranscriptionAvailableCallback.md @@ -97,10 +113,19 @@ docs/UpdateCall.md docs/UpdateCallRecording.md docs/UpdateConference.md docs/UpdateConferenceMember.md +docs/VerificationDenialWebhook.md +docs/VerificationRequest.md +docs/VerificationUpdateRequest.md +docs/VerificationWebhook.md docs/VerifyCodeRequest.md docs/VerifyCodeResponse.md docs/VoiceApiError.md docs/VoiceCodeResponse.md +docs/WebhookSubscription.md +docs/WebhookSubscriptionBasicAuthentication.md +docs/WebhookSubscriptionRequestSchema.md +docs/WebhookSubscriptionTypeEnum.md +docs/WebhookSubscriptionsListBody.md git_push.sh lib/bandwidth-sdk.rb lib/bandwidth-sdk/api/calls_api.rb @@ -111,11 +136,14 @@ lib/bandwidth-sdk/api/mfa_api.rb lib/bandwidth-sdk/api/phone_number_lookup_api.rb lib/bandwidth-sdk/api/recordings_api.rb lib/bandwidth-sdk/api/statistics_api.rb +lib/bandwidth-sdk/api/toll_free_verification_api.rb lib/bandwidth-sdk/api/transcriptions_api.rb lib/bandwidth-sdk/api_client.rb lib/bandwidth-sdk/api_error.rb lib/bandwidth-sdk/configuration.rb lib/bandwidth-sdk/models/account_statistics.rb +lib/bandwidth-sdk/models/additional_denial_reason.rb +lib/bandwidth-sdk/models/address.rb lib/bandwidth-sdk/models/answer_callback.rb lib/bandwidth-sdk/models/bridge_complete_callback.rb lib/bandwidth-sdk/models/bridge_target_complete_callback.rb @@ -141,6 +169,7 @@ lib/bandwidth-sdk/models/conference_recording_available_callback.rb lib/bandwidth-sdk/models/conference_recording_metadata.rb lib/bandwidth-sdk/models/conference_redirect_callback.rb lib/bandwidth-sdk/models/conference_state_enum.rb +lib/bandwidth-sdk/models/contact.rb lib/bandwidth-sdk/models/create_call.rb lib/bandwidth-sdk/models/create_call_response.rb lib/bandwidth-sdk/models/create_lookup_response.rb @@ -149,10 +178,13 @@ lib/bandwidth-sdk/models/deferred_result.rb lib/bandwidth-sdk/models/disconnect_callback.rb lib/bandwidth-sdk/models/diversion.rb lib/bandwidth-sdk/models/dtmf_callback.rb +lib/bandwidth-sdk/models/error.rb +lib/bandwidth-sdk/models/failure_webhook.rb lib/bandwidth-sdk/models/field_error.rb lib/bandwidth-sdk/models/file_format_enum.rb lib/bandwidth-sdk/models/gather_callback.rb lib/bandwidth-sdk/models/initiate_callback.rb +lib/bandwidth-sdk/models/links_object.rb lib/bandwidth-sdk/models/list_message_direction_enum.rb lib/bandwidth-sdk/models/list_message_item.rb lib/bandwidth-sdk/models/lookup_request.rb @@ -177,6 +209,7 @@ lib/bandwidth-sdk/models/messaging_request_error.rb lib/bandwidth-sdk/models/mfa_forbidden_request_error.rb lib/bandwidth-sdk/models/mfa_request_error.rb lib/bandwidth-sdk/models/mfa_unauthorized_request_error.rb +lib/bandwidth-sdk/models/opt_in_workflow.rb lib/bandwidth-sdk/models/page_info.rb lib/bandwidth-sdk/models/priority_enum.rb lib/bandwidth-sdk/models/recording_available_callback.rb @@ -188,6 +221,14 @@ lib/bandwidth-sdk/models/redirect_callback.rb lib/bandwidth-sdk/models/redirect_method_enum.rb lib/bandwidth-sdk/models/stir_shaken.rb lib/bandwidth-sdk/models/tag.rb +lib/bandwidth-sdk/models/telephone_number.rb +lib/bandwidth-sdk/models/tfv_basic_authentication.rb +lib/bandwidth-sdk/models/tfv_callback_status_enum.rb +lib/bandwidth-sdk/models/tfv_error.rb +lib/bandwidth-sdk/models/tfv_status.rb +lib/bandwidth-sdk/models/tfv_status_enum.rb +lib/bandwidth-sdk/models/tfv_submission_info.rb +lib/bandwidth-sdk/models/tfv_submission_wrapper.rb lib/bandwidth-sdk/models/tn_lookup_request_error.rb lib/bandwidth-sdk/models/transcribe_recording.rb lib/bandwidth-sdk/models/transcription.rb @@ -199,8 +240,17 @@ lib/bandwidth-sdk/models/update_call.rb lib/bandwidth-sdk/models/update_call_recording.rb lib/bandwidth-sdk/models/update_conference.rb lib/bandwidth-sdk/models/update_conference_member.rb +lib/bandwidth-sdk/models/verification_denial_webhook.rb +lib/bandwidth-sdk/models/verification_request.rb +lib/bandwidth-sdk/models/verification_update_request.rb +lib/bandwidth-sdk/models/verification_webhook.rb lib/bandwidth-sdk/models/verify_code_request.rb lib/bandwidth-sdk/models/verify_code_response.rb lib/bandwidth-sdk/models/voice_api_error.rb lib/bandwidth-sdk/models/voice_code_response.rb +lib/bandwidth-sdk/models/webhook_subscription.rb +lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb +lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb +lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb +lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb lib/bandwidth-sdk/version.rb diff --git a/.travis.yml b/.travis.yml index 98744be3..91f9b244 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,4 @@ script: - bundle install --path vendor/bundle - bundle exec rspec - gem build bandwidth-sdk.gemspec - - gem install ./bandwidth-sdk-1.0.0-dev.gem + - gem install ./bandwidth-sdk-1.0.0.gem diff --git a/README.md b/README.md index 7e1c7b32..3efa5cd8 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Bandwidth's Communication APIs This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 1.0.0 -- Package version: 1.0.0-dev +- Package version: 1.0.0 - Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit [https://dev.bandwidth.com](https://dev.bandwidth.com) @@ -45,16 +45,16 @@ gem build bandwidth-sdk.gemspec Then either install the gem locally: ```shell -gem install ./bandwidth-sdk-1.0.0-dev.gem +gem install ./bandwidth-sdk-1.0.0.gem ``` -(for development, run `gem install --dev ./bandwidth-sdk-1.0.0-dev.gem` to install the development dependencies) +(for development, run `gem install --dev ./bandwidth-sdk-1.0.0.gem` to install the development dependencies) or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). Finally add this to the Gemfile: - gem 'bandwidth-sdk', '~> 1.0.0-dev' + gem 'bandwidth-sdk', '~> 1.0.0' ### Install from Git @@ -143,6 +143,14 @@ Class | Method | HTTP request | Description *Bandwidth::RecordingsApi* | [**transcribe_call_recording**](docs/RecordingsApi.md#transcribe_call_recording) | **POST** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Create Transcription Request *Bandwidth::RecordingsApi* | [**update_call_recording_state**](docs/RecordingsApi.md#update_call_recording_state) | **PUT** /accounts/{accountId}/calls/{callId}/recording | Update Recording *Bandwidth::StatisticsApi* | [**get_statistics**](docs/StatisticsApi.md#get_statistics) | **GET** /accounts/{accountId}/statistics | Get Account Statistics +*Bandwidth::TollFreeVerificationApi* | [**create_webhook_subscription**](docs/TollFreeVerificationApi.md#create_webhook_subscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription +*Bandwidth::TollFreeVerificationApi* | [**delete_webhook_subscription**](docs/TollFreeVerificationApi.md#delete_webhook_subscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription +*Bandwidth::TollFreeVerificationApi* | [**get_toll_free_verification_status**](docs/TollFreeVerificationApi.md#get_toll_free_verification_status) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status +*Bandwidth::TollFreeVerificationApi* | [**list_toll_free_use_cases**](docs/TollFreeVerificationApi.md#list_toll_free_use_cases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases +*Bandwidth::TollFreeVerificationApi* | [**list_webhook_subscriptions**](docs/TollFreeVerificationApi.md#list_webhook_subscriptions) | **GET** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | List Webhook Subscriptions +*Bandwidth::TollFreeVerificationApi* | [**request_toll_free_verification**](docs/TollFreeVerificationApi.md#request_toll_free_verification) | **POST** /accounts/{accountId}/tollFreeVerification | Request Toll-Free Verification +*Bandwidth::TollFreeVerificationApi* | [**update_toll_free_verification_request**](docs/TollFreeVerificationApi.md#update_toll_free_verification_request) | **PUT** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Update Toll-Free Verification Request +*Bandwidth::TollFreeVerificationApi* | [**update_webhook_subscription**](docs/TollFreeVerificationApi.md#update_webhook_subscription) | **PUT** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Update Webhook Subscription *Bandwidth::TranscriptionsApi* | [**delete_real_time_transcription**](docs/TranscriptionsApi.md#delete_real_time_transcription) | **DELETE** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Delete a specific transcription *Bandwidth::TranscriptionsApi* | [**get_real_time_transcription**](docs/TranscriptionsApi.md#get_real_time_transcription) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Retrieve a specific transcription *Bandwidth::TranscriptionsApi* | [**list_real_time_transcriptions**](docs/TranscriptionsApi.md#list_real_time_transcriptions) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions | Enumerate transcriptions made with StartTranscription @@ -151,6 +159,8 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Bandwidth::AccountStatistics](docs/AccountStatistics.md) + - [Bandwidth::AdditionalDenialReason](docs/AdditionalDenialReason.md) + - [Bandwidth::Address](docs/Address.md) - [Bandwidth::AnswerCallback](docs/AnswerCallback.md) - [Bandwidth::BridgeCompleteCallback](docs/BridgeCompleteCallback.md) - [Bandwidth::BridgeTargetCompleteCallback](docs/BridgeTargetCompleteCallback.md) @@ -176,6 +186,7 @@ Class | Method | HTTP request | Description - [Bandwidth::ConferenceRecordingMetadata](docs/ConferenceRecordingMetadata.md) - [Bandwidth::ConferenceRedirectCallback](docs/ConferenceRedirectCallback.md) - [Bandwidth::ConferenceStateEnum](docs/ConferenceStateEnum.md) + - [Bandwidth::Contact](docs/Contact.md) - [Bandwidth::CreateCall](docs/CreateCall.md) - [Bandwidth::CreateCallResponse](docs/CreateCallResponse.md) - [Bandwidth::CreateLookupResponse](docs/CreateLookupResponse.md) @@ -184,10 +195,13 @@ Class | Method | HTTP request | Description - [Bandwidth::DisconnectCallback](docs/DisconnectCallback.md) - [Bandwidth::Diversion](docs/Diversion.md) - [Bandwidth::DtmfCallback](docs/DtmfCallback.md) + - [Bandwidth::Error](docs/Error.md) + - [Bandwidth::FailureWebhook](docs/FailureWebhook.md) - [Bandwidth::FieldError](docs/FieldError.md) - [Bandwidth::FileFormatEnum](docs/FileFormatEnum.md) - [Bandwidth::GatherCallback](docs/GatherCallback.md) - [Bandwidth::InitiateCallback](docs/InitiateCallback.md) + - [Bandwidth::LinksObject](docs/LinksObject.md) - [Bandwidth::ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) - [Bandwidth::ListMessageItem](docs/ListMessageItem.md) - [Bandwidth::LookupRequest](docs/LookupRequest.md) @@ -212,6 +226,7 @@ Class | Method | HTTP request | Description - [Bandwidth::MfaForbiddenRequestError](docs/MfaForbiddenRequestError.md) - [Bandwidth::MfaRequestError](docs/MfaRequestError.md) - [Bandwidth::MfaUnauthorizedRequestError](docs/MfaUnauthorizedRequestError.md) + - [Bandwidth::OptInWorkflow](docs/OptInWorkflow.md) - [Bandwidth::PageInfo](docs/PageInfo.md) - [Bandwidth::PriorityEnum](docs/PriorityEnum.md) - [Bandwidth::RecordingAvailableCallback](docs/RecordingAvailableCallback.md) @@ -223,6 +238,14 @@ Class | Method | HTTP request | Description - [Bandwidth::RedirectMethodEnum](docs/RedirectMethodEnum.md) - [Bandwidth::StirShaken](docs/StirShaken.md) - [Bandwidth::Tag](docs/Tag.md) + - [Bandwidth::TelephoneNumber](docs/TelephoneNumber.md) + - [Bandwidth::TfvBasicAuthentication](docs/TfvBasicAuthentication.md) + - [Bandwidth::TfvCallbackStatusEnum](docs/TfvCallbackStatusEnum.md) + - [Bandwidth::TfvError](docs/TfvError.md) + - [Bandwidth::TfvStatus](docs/TfvStatus.md) + - [Bandwidth::TfvStatusEnum](docs/TfvStatusEnum.md) + - [Bandwidth::TfvSubmissionInfo](docs/TfvSubmissionInfo.md) + - [Bandwidth::TfvSubmissionWrapper](docs/TfvSubmissionWrapper.md) - [Bandwidth::TnLookupRequestError](docs/TnLookupRequestError.md) - [Bandwidth::TranscribeRecording](docs/TranscribeRecording.md) - [Bandwidth::Transcription](docs/Transcription.md) @@ -234,10 +257,19 @@ Class | Method | HTTP request | Description - [Bandwidth::UpdateCallRecording](docs/UpdateCallRecording.md) - [Bandwidth::UpdateConference](docs/UpdateConference.md) - [Bandwidth::UpdateConferenceMember](docs/UpdateConferenceMember.md) + - [Bandwidth::VerificationDenialWebhook](docs/VerificationDenialWebhook.md) + - [Bandwidth::VerificationRequest](docs/VerificationRequest.md) + - [Bandwidth::VerificationUpdateRequest](docs/VerificationUpdateRequest.md) + - [Bandwidth::VerificationWebhook](docs/VerificationWebhook.md) - [Bandwidth::VerifyCodeRequest](docs/VerifyCodeRequest.md) - [Bandwidth::VerifyCodeResponse](docs/VerifyCodeResponse.md) - [Bandwidth::VoiceApiError](docs/VoiceApiError.md) - [Bandwidth::VoiceCodeResponse](docs/VoiceCodeResponse.md) + - [Bandwidth::WebhookSubscription](docs/WebhookSubscription.md) + - [Bandwidth::WebhookSubscriptionBasicAuthentication](docs/WebhookSubscriptionBasicAuthentication.md) + - [Bandwidth::WebhookSubscriptionRequestSchema](docs/WebhookSubscriptionRequestSchema.md) + - [Bandwidth::WebhookSubscriptionTypeEnum](docs/WebhookSubscriptionTypeEnum.md) + - [Bandwidth::WebhookSubscriptionsListBody](docs/WebhookSubscriptionsListBody.md) ## Documentation for Authorization diff --git a/bandwidth.yml b/bandwidth.yml index 87921dfa..70ca20d3 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -19,6 +19,7 @@ tags: - name: Transcriptions - name: MFA - name: Phone Number Lookup + - name: Toll-Free Verification paths: /users/{accountId}/media: get: @@ -1328,6 +1329,270 @@ paths: '500': $ref: '#/components/responses/tnLookupInternalServerError' servers: *ref_3 + /accounts/{accountId}/tollFreeVerification: + post: + tags: + - Toll-Free Verification + summary: Request Toll-Free Verification + description: Submit a request for verification of a toll-free phone number. + operationId: requestTollFreeVerification + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/requestTollFreeVerificationRequest' + responses: + '202': + description: Accepted + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + callbacks: + tfVerificationStatus: + $ref: '#/components/callbacks/tfVerificationStatus' + servers: &ref_4 + - url: https://api.bandwidth.com/api/v2 + description: Production + /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification: + get: + tags: + - Toll-Free Verification + summary: Get Toll-Free Verification Status + description: >- + Gets the verification status for a phone number that is provisioned to + your account. + + Submission information will be appended to the response if it is + available. + operationId: getTollFreeVerificationStatus + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/tfPhoneNumberPathParam' + responses: + '200': + $ref: '#/components/responses/getTollFreeVerificationStatusResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + put: + tags: + - Toll-Free Verification + summary: Update Toll-Free Verification Request + description: >- + Updates a toll-free verification request. + + Submissions are only eligible for resubmission for 7 days within being + processed and if resubmission is allowed (resubmitAllowed field is + true). + operationId: updateTollFreeVerificationRequest + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/tfPhoneNumberPathParam' + requestBody: + $ref: '#/components/requestBodies/updateTollFreeVerificationRequestRequest' + responses: + '202': + description: Accepted + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + callbacks: + tfVerificationStatus: + $ref: '#/components/callbacks/tfVerificationStatus' + servers: *ref_4 + /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions: + get: + tags: + - Toll-Free Verification + summary: List Webhook Subscriptions + description: >- + Lists all webhook subscriptions that are registered to receive status + updates for the toll-free verification requests submitted under this + account (password will not be returned through this API + + If `basicAuthentication` is defined, the `password` property of that + object will be null). + operationId: listWebhookSubscriptions + parameters: + - $ref: '#/components/parameters/accountId' + responses: + '200': + $ref: '#/components/responses/listWebhookSubscriptionsResponse' + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + post: + tags: + - Toll-Free Verification + summary: Create Webhook Subscription + description: >- + Create a new webhook subscription (this webhook will be called for every + update on every submission). + + In addition to a `callbackUrl`, this subscription can provide optional + HTTP basic authentication credentials (a username and a password). + + The returned subscription object will contain an ID that can be used to + modify or delete the subscription at a later time. + operationId: createWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/webhookSubscriptionRequest' + responses: + '201': + $ref: '#/components/responses/createWebhookSubscriptionResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 + /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}: + delete: + tags: + - Toll-Free Verification + summary: Delete Webhook Subscription + description: Delete a webhook subscription by ID. + operationId: deleteWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/webhookSubscriptionIdPathParam' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + put: + tags: + - Toll-Free Verification + summary: Update Webhook Subscription + description: >- + Update an existing webhook subscription (`callbackUrl` and + `basicAuthentication` can be updated). + operationId: updateWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/webhookSubscriptionIdPathParam' + requestBody: + $ref: '#/components/requestBodies/webhookSubscriptionRequest' + responses: + '200': + $ref: '#/components/responses/updateWebhookSubscriptionResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 + /tollFreeVerification/useCases: + get: + tags: + - Toll-Free Verification + summary: List Toll-Free Use Cases + description: Lists valid toll-free use cases. + operationId: listTollFreeUseCases + responses: + '200': + $ref: '#/components/responses/listTollFreeUseCasesResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 components: schemas: callbackTypeEnum: @@ -4410,6 +4675,640 @@ components: type: string description: A description of what validation error occurred. example: example error message + accountId1: + type: string + description: User's account ID. + example: '1234567' + tfPhoneNumber: + type: string + description: Toll-free telephone number in E.164 format. + minLength: 12 + maxLength: 12 + nullable: false + pattern: ^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$ + example: '+18005555555' + tfvWebhookErrors: + type: array + description: Details of the errors that were encountered when processing the request. + items: + type: string + example: 'optInWorkflowImageURLs: Entries must be a valid array of objects.' + tfvCallbackStatusEnum: + type: string + enum: + - VERIFIED + - UNVERIFIED + example: VERIFIED + tfvUnverifiedStatus: + type: string + default: UNVERIFIED + example: UNVERIFIED + declineReasonDescription: + type: string + description: Explanation for why a verification request was declined. + nullable: false + example: >- + Invalid Information - Can't Validate URL - Website is not accessible / + not available + denialStatusCode: + description: Reason code for denial. + type: integer + example: 511 + resubmitAllowed: + description: >- + Whether a Toll-Free Verification request qualifies for resubmission via + PUT. + example: true + type: boolean + additionalDenialReason: + properties: + statusCode: + $ref: '#/components/schemas/denialStatusCode' + reason: + $ref: '#/components/schemas/declineReasonDescription' + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + required: + - statusCode + - reason + - resubmitAllowed + type: object + internalTicketNumber: + type: string + format: uuid + description: >- + Unique identifier (UUID) generated by Bandwidth to assist in tracking + the verification status of a toll-free number - included in all webhook + payloads. + example: acde070d-8c4c-4f0d-9d8a-162843c10333 + internalTicketNumberForWebhook: + type: string + format: uuid + description: >- + Unique identifier (UUID) generated by Bandwidth to assist in tracking + the verification status of a toll-free number. + example: acde070d-8c4c-4f0d-9d8a-162843c10333 + businessContactPhoneNumber: + description: Contact telephone number + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: '+19192654500' + verificationRequest: + type: object + required: + - businessAddress + - businessContact + - messageVolume + - phoneNumbers + - useCase + - useCaseSummary + - productionMessageContent + - optInWorkflow + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + phoneNumbers: + type: array + minItems: 1 + maxItems: 10 + items: + $ref: '#/components/schemas/tfPhoneNumber' + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + type: string + description: A general idea of the use case and customer. + minLength: 1 + maxLength: 500 + nullable: false + productionMessageContent: + type: string + description: Example of message content. + minLength: 1 + maxLength: 500 + nullable: false + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + type: string + description: Any additional information. + minLength: 0 + maxLength: 500 + nullable: true + isvReseller: + $ref: '#/components/schemas/isvReseller' + verificationUpdateRequest: + type: object + required: + - businessAddress + - businessContact + - messageVolume + - useCase + - useCaseSummary + - productionMessageContent + - optInWorkflow + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + type: string + description: A general idea of the use case and customer. + minLength: 0 + maxLength: 500 + nullable: false + productionMessageContent: + type: string + description: Example of message content. + minLength: 0 + maxLength: 500 + nullable: false + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + type: string + description: Any additional information. + minLength: 0 + maxLength: 500 + nullable: true + isvReseller: + $ref: '#/components/schemas/isvReseller' + tfvBasicAuthentication: + type: object + properties: + username: + type: string + maxLength: 100 + password: + type: string + maxLength: 200 + required: + - username + - password + webhookSubscriptionRequestSchema: + type: object + properties: + basicAuthentication: + $ref: '#/components/schemas/tfvBasicAuthentication' + callbackUrl: + $ref: '#/components/schemas/webhookUrl' + sharedSecretKey: + $ref: '#/components/schemas/sharedSecretKey' + required: + - callbackUrl + failureWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + errorCode: + type: string + description: >- + An error code indicating what error was encountered. This code can + be interpreted as an HTTP status code in regards to the error that + was encountered. + example: '400' + errorDescription: + type: string + description: A description of the error that was encountered. + example: cannot process request. + errors: + $ref: '#/components/schemas/tfvWebhookErrors' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + verificationDenialWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + additionalDenialReasons: + description: >- + An optional list of denial reasons in addition to + declineReasonDescription when multiple reasons apply. + items: + $ref: '#/components/schemas/additionalDenialReason' + example: + - statusCode: 512 + reason: Reason A + resubmitAllowed: true + - statusCode: 513 + reason: Reason B + resubmitAllowed: true + type: array + declineReasonDescription: + $ref: '#/components/schemas/declineReasonDescription' + denialStatusCode: + $ref: '#/components/schemas/denialStatusCode' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + status: + $ref: '#/components/schemas/tfvUnverifiedStatus' + verificationWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + status: + $ref: '#/components/schemas/tfvCallbackStatusEnum' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + tfvSubmissionWrapper: + type: object + properties: + submission: + $ref: '#/components/schemas/verificationUpdateRequest' + address: + type: object + nullable: false + required: + - name + - addr1 + - city + - state + - zip + - url + properties: + name: + type: string + description: The name of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Bandwidth Inc. + addr1: + type: string + description: The address of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: 2230 Bandmate Way + addr2: + type: string + description: The address of the business using the toll-free number. + minLength: 0 + maxLength: 500 + nullable: true + city: + type: string + description: The city of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Raleigh + state: + type: string + description: The state of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: NC + zip: + type: string + description: The zip of the business using the toll-free number. + nullable: false + example: '27606' + pattern: '[- A-Za-z0-9]{0,500}' + url: + type: string + format: url + description: The website of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: https://www.example.com/path/to/resource + optInWorkflow: + type: object + nullable: false + required: + - description + - imageUrls + properties: + description: + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: Opt In Flow + imageUrls: + type: array + items: + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: https://www.example.com/path/to/resource + pattern: >- + ^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*) + isvReseller: + type: string + description: ISV name. + minLength: 0 + maxLength: 500 + nullable: true + example: Test ISV + contact: + type: object + nullable: false + required: + - firstName + - lastName + - email + - phoneNumber + properties: + firstName: + type: string + description: The first name of the business contact using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: John + lastName: + type: string + description: The last name of the business contact using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Doe + email: + $ref: '#/components/schemas/email' + phoneNumber: + $ref: '#/components/schemas/businessContactPhoneNumber' + email: + type: string + format: email + minLength: 0 + maxLength: 500 + nullable: false + pattern: >- + ^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$ + example: foo@bar.com + useCases: + type: array + items: + type: string + example: + - 2FA + - App Notifications + - Appointments + - Auctions + - Auto Repair Services + - Bank Transfers + - Billing + - Booking Confirmations + - Business Updates + - COVID-19 Alerts + useCase: + type: string + description: The category of the use case. + minLength: 0 + maxLength: 500 + example: 2FA + webhookSubscriptionsListBody: + description: >- + A list of all webhook subscriptions registered for this account ID for + this particular feature (unpaginated). + type: object + required: + - data + properties: + links: + $ref: '#/components/schemas/linksObject' + errors: + type: array + items: + $ref: '#/components/schemas/error' + data: + items: + $ref: '#/components/schemas/webhookSubscription' + type: array + linksObject: + type: object + properties: + first: + description: The first (or only) page of results matching the query. + type: string + next: + description: >- + If more results exist than specified by 'size', this link returns + the next page of 'size' results. + type: string + previous: + description: >- + If the results are more than one page, this link returns the + previous page of 'size' results. + type: string + last: + description: >- + If more results exist than specified by 'size', this link return the + last page of result. + type: string + error: + type: object + properties: + code: + type: integer + description: + type: string + telephoneNumbers: + type: array + items: + $ref: '#/components/schemas/telephoneNumber' + telephoneNumber: + type: object + properties: + telephoneNumber: + description: Simple Telephone Number. + type: string + webhookSubscriptionTypeEnum: + type: string + enum: + - TOLLFREE_VERIFICATION_STATUS + - MESSAGING_PORTOUT_APPROVAL_STATUS + example: TOLLFREE_VERIFICATION_STATUS + webhookSubscription: + description: >- + Information about a webhook that Bandwidth should send upon the + completion of event customer has subscribed to. + type: object + required: + - callbackUrl + properties: + id: + type: string + example: 7hICGStfAfeGxEq3N0lQwO + accountId: + type: string + example: '1234567' + callbackUrl: + $ref: '#/components/schemas/webhookUrl' + type: + $ref: '#/components/schemas/webhookSubscriptionTypeEnum' + basicAuthentication: + description: >- + Basic authentication credentials are not required, but if present, + both username and password must be provided. + type: object + required: + - username + - password + properties: + username: + type: string + maxLength: 100 + password: + type: string + maxLength: 200 + createdDate: + type: string + format: date-time + example: '2023-05-15T13:56:39.965Z' + modifiedDate: + type: string + format: date-time + example: '2023-05-15T13:56:39.965Z' + webhookUrl: + description: >- + Callback URL to receive status updates from Bandwidth. When a webhook + subscription is registered with Bandwidth under a given account ID, it + will be used to send status updates for all requests submitted under + that account ID. + type: string + format: url + minLength: 0 + maxLength: 2000 + nullable: true + example: https://www.example.com/path/to/resource + pattern: >- + ^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*) + tfvError: + description: A generic error object. + properties: + type: + type: string + example: Error Type + description: + type: string + example: Error Message + errors: + type: object + description: >- + Each key of this errors object refers to a field of the submitted + object (using dot notation for nested objects), with the field being + a key to an array of one or more errors for that field. + example: + field: error message + type: object + tfvStatus: + type: object + properties: + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + status: + $ref: '#/components/schemas/tfvStatusEnum' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumber' + declineReasonDescription: + $ref: '#/components/schemas/declineReasonDescription' + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + createdDateTime: + type: string + description: Date and time the verification request was created. + format: date-time + example: '2021-06-08T06:45:13.0Z' + modifiedDateTime: + type: string + description: Date and time the verification request was last modified. + format: date-time + example: '2021-06-08T06:45:13.0Z' + submission: + $ref: '#/components/schemas/tfvSubmissionInfo' + tfvSubmissionInfo: + type: object + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + type: string + description: A general idea of the use case and customer. + minLength: 0 + maxLength: 500 + nullable: false + example: Text summarizing the use case for the toll-free number + productionMessageContent: + type: string + description: Example of message content. + minLength: 0 + maxLength: 500 + nullable: false + example: Production message content + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + type: string + description: Any additional information. + minLength: 0 + maxLength: 500 + nullable: true + example: Any additional information + isvReseller: + $ref: '#/components/schemas/isvReseller' + tfvStatusEnum: + type: string + enum: + - VERIFIED + - UNVERIFIED + - PENDING + - PARTIALLY_VERIFIED + - INVALID_STATUS + example: VERIFIED + sharedSecretKey: + description: >- + An ASCII string submitted by the user as a shared secret key for + generating an HMAC header for callbacks. + example: This is my $3cret + maxLength: 64 + minLength: 16 + nullable: true + pattern: ^[ -~]{16,64}$ + type: string responses: createMessageResponse: description: Accepted @@ -4860,6 +5759,120 @@ components: summary: Example Internal Server Error Error value: message: Request has not been passed further. + getTollFreeVerificationStatusResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/tfvStatus' + listWebhookSubscriptionsResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscriptionsListBody' + createWebhookSubscriptionResponse: + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + updateWebhookSubscriptionResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + listTollFreeUseCasesResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/useCases' + tfvBadRequestResponse: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Cannot process request. + type: bad request + tfvPostBadRequestResponse: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: cannot process request. + errors: + businessName: Business name is required. + businessContactEmail: Business contact email is not a valid email address. + optInWorkflowImageURLs: Entries must be a valid array of objects. + tfvUnauthorizedResponse: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + tfvForbiddenResponse: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Client is not authorized for the action. + type: forbidden + tfvNotFoundResponse: + description: Cannot find the requested resource. + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Cannot find the requested resource. + type: Not Found + tfvNotAllowedResponse: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Method is not allowed. + type: Method Not Allowed + tfvTooManyRequestsResponse: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Throttling error. Too many requests. + type: Too Many Requests + tfvServerErrorResponse: + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Internal Server Error. + type: Internal Server Error + tfvServiceUnavailableResponse: + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Service Unavailable Error. + type: Service Unavailable parameters: accountId: in: path @@ -5227,6 +6240,22 @@ components: type: string description: The phone number lookup request ID from Bandwidth. example: 004223a0-8b17-41b1-bf81-20732adf5590 + tfPhoneNumberPathParam: + in: path + name: phoneNumber + required: true + schema: + $ref: '#/components/schemas/tfPhoneNumber' + description: Valid Toll-Free telephone number in E.164 format. + example: '+18885555555' + webhookSubscriptionIdPathParam: + in: path + name: id + required: true + schema: + type: string + description: Webhook subscription ID + example: 7bt57JcsVYJrN9K1OcV1Nu examples: smsMessageReceivedCallbackExample: summary: An example of a sms message-received callback body. @@ -5843,6 +6872,39 @@ components: $ref: '#/components/examples/singleNumberRequestExample' multipleNumberRequestExample: $ref: '#/components/examples/multipleNumberRequestExample' + requestTollFreeVerificationRequest: + description: Request for verification of a toll-free phone number. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/verificationRequest' + updateTollFreeVerificationRequestRequest: + description: Update a request for verification of a toll-free phone number. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tfvSubmissionWrapper' + verificationWebhookRequest: + description: Verification callback status of a toll-free phone number. + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/verificationWebhook' + - $ref: '#/components/schemas/verificationDenialWebhook' + - $ref: '#/components/schemas/failureWebhook' + webhookSubscriptionRequest: + description: >- + Information about a webhook that Bandwidth should send upon the + completion of event customer is trying to subscribe to. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscriptionRequestSchema' securitySchemes: Basic: type: http @@ -5913,3 +6975,43 @@ components: responses: '200': description: OK + tfVerificationStatus: + your_url.com/webhookService: + post: + summary: TFV status updates sent to customer's webhook URL. + description: >- + Unique webhook URL provided by customers to which Bandwidth sends a + POST request to notify customer regarding TFV status updates. + operationId: tfvRequest + parameters: + - description: >- + 64-character lowercase hexidecimal HMAC calculated with a shared + secret key, the canonicalized request body, and SHA256. It is + only included when a shared secret key is set through webhook + subscription. + example: ca7b9e9816c90d336f5dca529e733354b81535c7af027b81878ac98afb2dbaa2 + in: header + name: x-bandwidth-signature-hmac-sha256 + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/verificationWebhookRequest' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' diff --git a/docs/AdditionalDenialReason.md b/docs/AdditionalDenialReason.md new file mode 100644 index 00000000..e942c7c0 --- /dev/null +++ b/docs/AdditionalDenialReason.md @@ -0,0 +1,22 @@ +# Bandwidth::AdditionalDenialReason + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **status_code** | **Integer** | Reason code for denial. | | +| **reason** | **String** | Explanation for why a verification request was declined. | | +| **resubmit_allowed** | **Boolean** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::AdditionalDenialReason.new( + status_code: 511, + reason: Invalid Information - Can't Validate URL - Website is not accessible / not available, + resubmit_allowed: true +) +``` + diff --git a/docs/Address.md b/docs/Address.md new file mode 100644 index 00000000..ddb1a9e8 --- /dev/null +++ b/docs/Address.md @@ -0,0 +1,30 @@ +# Bandwidth::Address + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | The name of the business using the toll-free number. | | +| **addr1** | **String** | The address of the business using the toll-free number. | | +| **addr2** | **String** | The address of the business using the toll-free number. | [optional] | +| **city** | **String** | The city of the business using the toll-free number. | | +| **state** | **String** | The state of the business using the toll-free number. | | +| **zip** | **String** | The zip of the business using the toll-free number. | | +| **url** | **String** | The website of the business using the toll-free number. | | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::Address.new( + name: Bandwidth Inc., + addr1: 2230 Bandmate Way, + addr2: null, + city: Raleigh, + state: NC, + zip: 27606, + url: https://www.example.com/path/to/resource +) +``` + diff --git a/docs/Contact.md b/docs/Contact.md new file mode 100644 index 00000000..1217e33d --- /dev/null +++ b/docs/Contact.md @@ -0,0 +1,24 @@ +# Bandwidth::Contact + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **first_name** | **String** | The first name of the business contact using the toll-free number. | | +| **last_name** | **String** | The last name of the business contact using the toll-free number. | | +| **email** | **String** | | | +| **phone_number** | **String** | Contact telephone number | | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::Contact.new( + first_name: John, + last_name: Doe, + email: foo@bar.com, + phone_number: +19192654500 +) +``` + diff --git a/docs/Error.md b/docs/Error.md new file mode 100644 index 00000000..04060fa3 --- /dev/null +++ b/docs/Error.md @@ -0,0 +1,22 @@ +# Bandwidth::Error + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **code** | **Integer** | | [optional] | +| **description** | **String** | | [optional] | +| **telephone_numbers** | [**Array<TelephoneNumber>**](TelephoneNumber.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::Error.new( + code: null, + description: null, + telephone_numbers: null +) +``` + diff --git a/docs/FailureWebhook.md b/docs/FailureWebhook.md new file mode 100644 index 00000000..db61fa74 --- /dev/null +++ b/docs/FailureWebhook.md @@ -0,0 +1,28 @@ +# Bandwidth::FailureWebhook + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | User's account ID. | [optional] | +| **phone_number** | **String** | Toll-free telephone number in E.164 format. | [optional] | +| **error_code** | **String** | An error code indicating what error was encountered. This code can be interpreted as an HTTP status code in regards to the error that was encountered. | [optional] | +| **error_description** | **String** | A description of the error that was encountered. | [optional] | +| **errors** | **Array<String>** | Details of the errors that were encountered when processing the request. | [optional] | +| **internal_ticket_number** | **String** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::FailureWebhook.new( + account_id: 1234567, + phone_number: +18005555555, + error_code: 400, + error_description: cannot process request., + errors: null, + internal_ticket_number: acde070d-8c4c-4f0d-9d8a-162843c10333 +) +``` + diff --git a/docs/LinksObject.md b/docs/LinksObject.md new file mode 100644 index 00000000..5d2b81a9 --- /dev/null +++ b/docs/LinksObject.md @@ -0,0 +1,24 @@ +# Bandwidth::LinksObject + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **first** | **String** | The first (or only) page of results matching the query. | [optional] | +| **_next** | **String** | If more results exist than specified by 'size', this link returns the next page of 'size' results. | [optional] | +| **previous** | **String** | If the results are more than one page, this link returns the previous page of 'size' results. | [optional] | +| **last** | **String** | If more results exist than specified by 'size', this link return the last page of result. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::LinksObject.new( + first: null, + _next: null, + previous: null, + last: null +) +``` + diff --git a/docs/OptInWorkflow.md b/docs/OptInWorkflow.md new file mode 100644 index 00000000..f23130a5 --- /dev/null +++ b/docs/OptInWorkflow.md @@ -0,0 +1,20 @@ +# Bandwidth::OptInWorkflow + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **description** | **String** | | | +| **image_urls** | **Array<String>** | | | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::OptInWorkflow.new( + description: Opt In Flow, + image_urls: null +) +``` + diff --git a/docs/TelephoneNumber.md b/docs/TelephoneNumber.md new file mode 100644 index 00000000..0868da68 --- /dev/null +++ b/docs/TelephoneNumber.md @@ -0,0 +1,18 @@ +# Bandwidth::TelephoneNumber + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **telephone_number** | **String** | Simple Telephone Number. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::TelephoneNumber.new( + telephone_number: null +) +``` + diff --git a/docs/TfvBasicAuthentication.md b/docs/TfvBasicAuthentication.md new file mode 100644 index 00000000..db7ccdfe --- /dev/null +++ b/docs/TfvBasicAuthentication.md @@ -0,0 +1,20 @@ +# Bandwidth::TfvBasicAuthentication + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **username** | **String** | | | +| **password** | **String** | | | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::TfvBasicAuthentication.new( + username: null, + password: null +) +``` + diff --git a/docs/TfvCallbackStatusEnum.md b/docs/TfvCallbackStatusEnum.md new file mode 100644 index 00000000..387d558a --- /dev/null +++ b/docs/TfvCallbackStatusEnum.md @@ -0,0 +1,15 @@ +# Bandwidth::TfvCallbackStatusEnum + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::TfvCallbackStatusEnum.new() +``` + diff --git a/docs/TfvError.md b/docs/TfvError.md new file mode 100644 index 00000000..7da1739b --- /dev/null +++ b/docs/TfvError.md @@ -0,0 +1,22 @@ +# Bandwidth::TfvError + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | [optional] | +| **description** | **String** | | [optional] | +| **errors** | **Object** | Each key of this errors object refers to a field of the submitted object (using dot notation for nested objects), with the field being a key to an array of one or more errors for that field. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::TfvError.new( + type: Error Type, + description: Error Message, + errors: {"field":"error message"} +) +``` + diff --git a/docs/TfvStatus.md b/docs/TfvStatus.md new file mode 100644 index 00000000..b9552917 --- /dev/null +++ b/docs/TfvStatus.md @@ -0,0 +1,32 @@ +# Bandwidth::TfvStatus + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **phone_number** | **String** | Toll-free telephone number in E.164 format. | [optional] | +| **status** | [**TfvStatusEnum**](TfvStatusEnum.md) | | [optional] | +| **internal_ticket_number** | **String** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. | [optional] | +| **decline_reason_description** | **String** | Explanation for why a verification request was declined. | [optional] | +| **resubmit_allowed** | **Boolean** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional] | +| **created_date_time** | **Time** | Date and time the verification request was created. | [optional] | +| **modified_date_time** | **Time** | Date and time the verification request was last modified. | [optional] | +| **submission** | [**TfvSubmissionInfo**](TfvSubmissionInfo.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::TfvStatus.new( + phone_number: +18005555555, + status: null, + internal_ticket_number: acde070d-8c4c-4f0d-9d8a-162843c10333, + decline_reason_description: Invalid Information - Can't Validate URL - Website is not accessible / not available, + resubmit_allowed: true, + created_date_time: 2021-06-08T06:45:13Z, + modified_date_time: 2021-06-08T06:45:13Z, + submission: null +) +``` + diff --git a/docs/TfvStatusEnum.md b/docs/TfvStatusEnum.md new file mode 100644 index 00000000..f4bb4b39 --- /dev/null +++ b/docs/TfvStatusEnum.md @@ -0,0 +1,15 @@ +# Bandwidth::TfvStatusEnum + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::TfvStatusEnum.new() +``` + diff --git a/docs/TfvSubmissionInfo.md b/docs/TfvSubmissionInfo.md new file mode 100644 index 00000000..bfcdebdc --- /dev/null +++ b/docs/TfvSubmissionInfo.md @@ -0,0 +1,34 @@ +# Bandwidth::TfvSubmissionInfo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **business_address** | [**Address**](Address.md) | | [optional] | +| **business_contact** | [**Contact**](Contact.md) | | [optional] | +| **message_volume** | **Integer** | Estimated monthly volume of messages from the toll-free number. | [optional] | +| **use_case** | **String** | The category of the use case. | [optional] | +| **use_case_summary** | **String** | A general idea of the use case and customer. | [optional] | +| **production_message_content** | **String** | Example of message content. | [optional] | +| **opt_in_workflow** | [**OptInWorkflow**](OptInWorkflow.md) | | [optional] | +| **additional_information** | **String** | Any additional information. | [optional] | +| **isv_reseller** | **String** | ISV name. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::TfvSubmissionInfo.new( + business_address: null, + business_contact: null, + message_volume: 10000, + use_case: 2FA, + use_case_summary: Text summarizing the use case for the toll-free number, + production_message_content: Production message content, + opt_in_workflow: null, + additional_information: Any additional information, + isv_reseller: Test ISV +) +``` + diff --git a/docs/TfvSubmissionWrapper.md b/docs/TfvSubmissionWrapper.md new file mode 100644 index 00000000..fc03ff01 --- /dev/null +++ b/docs/TfvSubmissionWrapper.md @@ -0,0 +1,18 @@ +# Bandwidth::TfvSubmissionWrapper + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **submission** | [**VerificationUpdateRequest**](VerificationUpdateRequest.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::TfvSubmissionWrapper.new( + submission: null +) +``` + diff --git a/docs/TollFreeVerificationApi.md b/docs/TollFreeVerificationApi.md new file mode 100644 index 00000000..9f91fd27 --- /dev/null +++ b/docs/TollFreeVerificationApi.md @@ -0,0 +1,585 @@ +# Bandwidth::TollFreeVerificationApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**create_webhook_subscription**](TollFreeVerificationApi.md#create_webhook_subscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription | +| [**delete_webhook_subscription**](TollFreeVerificationApi.md#delete_webhook_subscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription | +| [**get_toll_free_verification_status**](TollFreeVerificationApi.md#get_toll_free_verification_status) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status | +| [**list_toll_free_use_cases**](TollFreeVerificationApi.md#list_toll_free_use_cases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases | +| [**list_webhook_subscriptions**](TollFreeVerificationApi.md#list_webhook_subscriptions) | **GET** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | List Webhook Subscriptions | +| [**request_toll_free_verification**](TollFreeVerificationApi.md#request_toll_free_verification) | **POST** /accounts/{accountId}/tollFreeVerification | Request Toll-Free Verification | +| [**update_toll_free_verification_request**](TollFreeVerificationApi.md#update_toll_free_verification_request) | **PUT** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Update Toll-Free Verification Request | +| [**update_webhook_subscription**](TollFreeVerificationApi.md#update_webhook_subscription) | **PUT** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Update Webhook Subscription | + + +## create_webhook_subscription + +> create_webhook_subscription(account_id, webhook_subscription_request_schema) + +Create Webhook Subscription + +Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time. + +### Examples + +```ruby +require 'time' +require 'bandwidth-sdk' +# setup authorization +Bandwidth.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + +api_instance = Bandwidth::TollFreeVerificationApi.new +account_id = '9900000' # String | Your Bandwidth Account ID. +webhook_subscription_request_schema = Bandwidth::WebhookSubscriptionRequestSchema.new({callback_url: 'https://www.example.com/path/to/resource'}) # WebhookSubscriptionRequestSchema | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + +begin + # Create Webhook Subscription + result = api_instance.create_webhook_subscription(account_id, webhook_subscription_request_schema) + p result +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->create_webhook_subscription: #{e}" +end +``` + +#### Using the create_webhook_subscription_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_webhook_subscription_with_http_info(account_id, webhook_subscription_request_schema) + +```ruby +begin + # Create Webhook Subscription + data, status_code, headers = api_instance.create_webhook_subscription_with_http_info(account_id, webhook_subscription_request_schema) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->create_webhook_subscription_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | Your Bandwidth Account ID. | | +| **webhook_subscription_request_schema** | [**WebhookSubscriptionRequestSchema**](WebhookSubscriptionRequestSchema.md) | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. | | + +### Return type + +[**WebhookSubscription**](WebhookSubscription.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## delete_webhook_subscription + +> delete_webhook_subscription(account_id, id) + +Delete Webhook Subscription + +Delete a webhook subscription by ID. + +### Examples + +```ruby +require 'time' +require 'bandwidth-sdk' +# setup authorization +Bandwidth.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + +api_instance = Bandwidth::TollFreeVerificationApi.new +account_id = '9900000' # String | Your Bandwidth Account ID. +id = '7bt57JcsVYJrN9K1OcV1Nu' # String | Webhook subscription ID + +begin + # Delete Webhook Subscription + api_instance.delete_webhook_subscription(account_id, id) +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->delete_webhook_subscription: #{e}" +end +``` + +#### Using the delete_webhook_subscription_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> delete_webhook_subscription_with_http_info(account_id, id) + +```ruby +begin + # Delete Webhook Subscription + data, status_code, headers = api_instance.delete_webhook_subscription_with_http_info(account_id, id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->delete_webhook_subscription_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | Your Bandwidth Account ID. | | +| **id** | **String** | Webhook subscription ID | | + +### Return type + +nil (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_toll_free_verification_status + +> get_toll_free_verification_status(account_id, phone_number) + +Get Toll-Free Verification Status + +Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available. + +### Examples + +```ruby +require 'time' +require 'bandwidth-sdk' +# setup authorization +Bandwidth.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + +api_instance = Bandwidth::TollFreeVerificationApi.new +account_id = '9900000' # String | Your Bandwidth Account ID. +phone_number = '+18885555555' # String | Valid Toll-Free telephone number in E.164 format. + +begin + # Get Toll-Free Verification Status + result = api_instance.get_toll_free_verification_status(account_id, phone_number) + p result +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->get_toll_free_verification_status: #{e}" +end +``` + +#### Using the get_toll_free_verification_status_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_toll_free_verification_status_with_http_info(account_id, phone_number) + +```ruby +begin + # Get Toll-Free Verification Status + data, status_code, headers = api_instance.get_toll_free_verification_status_with_http_info(account_id, phone_number) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->get_toll_free_verification_status_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | Your Bandwidth Account ID. | | +| **phone_number** | **String** | Valid Toll-Free telephone number in E.164 format. | | + +### Return type + +[**TfvStatus**](TfvStatus.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## list_toll_free_use_cases + +> Array<String> list_toll_free_use_cases + +List Toll-Free Use Cases + +Lists valid toll-free use cases. + +### Examples + +```ruby +require 'time' +require 'bandwidth-sdk' +# setup authorization +Bandwidth.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + +api_instance = Bandwidth::TollFreeVerificationApi.new + +begin + # List Toll-Free Use Cases + result = api_instance.list_toll_free_use_cases + p result +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->list_toll_free_use_cases: #{e}" +end +``` + +#### Using the list_toll_free_use_cases_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> list_toll_free_use_cases_with_http_info + +```ruby +begin + # List Toll-Free Use Cases + data, status_code, headers = api_instance.list_toll_free_use_cases_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => Array<String> +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->list_toll_free_use_cases_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**Array<String>** + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## list_webhook_subscriptions + +> list_webhook_subscriptions(account_id) + +List Webhook Subscriptions + +Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null). + +### Examples + +```ruby +require 'time' +require 'bandwidth-sdk' +# setup authorization +Bandwidth.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + +api_instance = Bandwidth::TollFreeVerificationApi.new +account_id = '9900000' # String | Your Bandwidth Account ID. + +begin + # List Webhook Subscriptions + result = api_instance.list_webhook_subscriptions(account_id) + p result +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->list_webhook_subscriptions: #{e}" +end +``` + +#### Using the list_webhook_subscriptions_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> list_webhook_subscriptions_with_http_info(account_id) + +```ruby +begin + # List Webhook Subscriptions + data, status_code, headers = api_instance.list_webhook_subscriptions_with_http_info(account_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->list_webhook_subscriptions_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | Your Bandwidth Account ID. | | + +### Return type + +[**WebhookSubscriptionsListBody**](WebhookSubscriptionsListBody.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## request_toll_free_verification + +> request_toll_free_verification(account_id, verification_request) + +Request Toll-Free Verification + +Submit a request for verification of a toll-free phone number. + +### Examples + +```ruby +require 'time' +require 'bandwidth-sdk' +# setup authorization +Bandwidth.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + +api_instance = Bandwidth::TollFreeVerificationApi.new +account_id = '9900000' # String | Your Bandwidth Account ID. +verification_request = Bandwidth::VerificationRequest.new({business_address: Bandwidth::Address.new({name: 'Bandwidth Inc.', addr1: '2230 Bandmate Way', city: 'Raleigh', state: 'NC', zip: '27606', url: 'https://www.example.com/path/to/resource'}), business_contact: Bandwidth::Contact.new({first_name: 'John', last_name: 'Doe', email: 'foo@bar.com', phone_number: '+19192654500'}), message_volume: 10000, phone_numbers: ['+18005555555'], use_case: '2FA', use_case_summary: 'use_case_summary_example', production_message_content: 'production_message_content_example', opt_in_workflow: Bandwidth::OptInWorkflow.new({description: 'Opt In Flow', image_urls: ['https://www.example.com/path/to/resource']})}) # VerificationRequest | Request for verification of a toll-free phone number. + +begin + # Request Toll-Free Verification + api_instance.request_toll_free_verification(account_id, verification_request) +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->request_toll_free_verification: #{e}" +end +``` + +#### Using the request_toll_free_verification_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> request_toll_free_verification_with_http_info(account_id, verification_request) + +```ruby +begin + # Request Toll-Free Verification + data, status_code, headers = api_instance.request_toll_free_verification_with_http_info(account_id, verification_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->request_toll_free_verification_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | Your Bandwidth Account ID. | | +| **verification_request** | [**VerificationRequest**](VerificationRequest.md) | Request for verification of a toll-free phone number. | | + +### Return type + +nil (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## update_toll_free_verification_request + +> update_toll_free_verification_request(account_id, phone_number, tfv_submission_wrapper) + +Update Toll-Free Verification Request + +Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true). + +### Examples + +```ruby +require 'time' +require 'bandwidth-sdk' +# setup authorization +Bandwidth.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + +api_instance = Bandwidth::TollFreeVerificationApi.new +account_id = '9900000' # String | Your Bandwidth Account ID. +phone_number = '+18885555555' # String | Valid Toll-Free telephone number in E.164 format. +tfv_submission_wrapper = Bandwidth::TfvSubmissionWrapper.new # TfvSubmissionWrapper | Update a request for verification of a toll-free phone number. + +begin + # Update Toll-Free Verification Request + api_instance.update_toll_free_verification_request(account_id, phone_number, tfv_submission_wrapper) +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->update_toll_free_verification_request: #{e}" +end +``` + +#### Using the update_toll_free_verification_request_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> update_toll_free_verification_request_with_http_info(account_id, phone_number, tfv_submission_wrapper) + +```ruby +begin + # Update Toll-Free Verification Request + data, status_code, headers = api_instance.update_toll_free_verification_request_with_http_info(account_id, phone_number, tfv_submission_wrapper) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->update_toll_free_verification_request_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | Your Bandwidth Account ID. | | +| **phone_number** | **String** | Valid Toll-Free telephone number in E.164 format. | | +| **tfv_submission_wrapper** | [**TfvSubmissionWrapper**](TfvSubmissionWrapper.md) | Update a request for verification of a toll-free phone number. | | + +### Return type + +nil (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## update_webhook_subscription + +> update_webhook_subscription(account_id, id, webhook_subscription_request_schema) + +Update Webhook Subscription + +Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + +### Examples + +```ruby +require 'time' +require 'bandwidth-sdk' +# setup authorization +Bandwidth.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + +api_instance = Bandwidth::TollFreeVerificationApi.new +account_id = '9900000' # String | Your Bandwidth Account ID. +id = '7bt57JcsVYJrN9K1OcV1Nu' # String | Webhook subscription ID +webhook_subscription_request_schema = Bandwidth::WebhookSubscriptionRequestSchema.new({callback_url: 'https://www.example.com/path/to/resource'}) # WebhookSubscriptionRequestSchema | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + +begin + # Update Webhook Subscription + result = api_instance.update_webhook_subscription(account_id, id, webhook_subscription_request_schema) + p result +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->update_webhook_subscription: #{e}" +end +``` + +#### Using the update_webhook_subscription_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_webhook_subscription_with_http_info(account_id, id, webhook_subscription_request_schema) + +```ruby +begin + # Update Webhook Subscription + data, status_code, headers = api_instance.update_webhook_subscription_with_http_info(account_id, id, webhook_subscription_request_schema) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->update_webhook_subscription_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | Your Bandwidth Account ID. | | +| **id** | **String** | Webhook subscription ID | | +| **webhook_subscription_request_schema** | [**WebhookSubscriptionRequestSchema**](WebhookSubscriptionRequestSchema.md) | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. | | + +### Return type + +[**WebhookSubscription**](WebhookSubscription.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/VerificationDenialWebhook.md b/docs/VerificationDenialWebhook.md new file mode 100644 index 00000000..eb8a8d12 --- /dev/null +++ b/docs/VerificationDenialWebhook.md @@ -0,0 +1,32 @@ +# Bandwidth::VerificationDenialWebhook + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | User's account ID. | [optional] | +| **additional_denial_reasons** | [**Array<AdditionalDenialReason>**](AdditionalDenialReason.md) | An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. | [optional] | +| **decline_reason_description** | **String** | Explanation for why a verification request was declined. | [optional] | +| **denial_status_code** | **Integer** | Reason code for denial. | [optional] | +| **internal_ticket_number** | **String** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] | +| **phone_number** | **String** | Toll-free telephone number in E.164 format. | [optional] | +| **resubmit_allowed** | **Boolean** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional] | +| **status** | **String** | | [optional][default to 'UNVERIFIED'] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::VerificationDenialWebhook.new( + account_id: 1234567, + additional_denial_reasons: [{"statusCode":512,"reason":"Reason A","resubmitAllowed":true},{"statusCode":513,"reason":"Reason B","resubmitAllowed":true}], + decline_reason_description: Invalid Information - Can't Validate URL - Website is not accessible / not available, + denial_status_code: 511, + internal_ticket_number: acde070d-8c4c-4f0d-9d8a-162843c10333, + phone_number: +18005555555, + resubmit_allowed: true, + status: UNVERIFIED +) +``` + diff --git a/docs/VerificationRequest.md b/docs/VerificationRequest.md new file mode 100644 index 00000000..b48e90dc --- /dev/null +++ b/docs/VerificationRequest.md @@ -0,0 +1,36 @@ +# Bandwidth::VerificationRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **business_address** | [**Address**](Address.md) | | | +| **business_contact** | [**Contact**](Contact.md) | | | +| **message_volume** | **Integer** | Estimated monthly volume of messages from the toll-free number. | | +| **phone_numbers** | **Array<String>** | | | +| **use_case** | **String** | The category of the use case. | | +| **use_case_summary** | **String** | A general idea of the use case and customer. | | +| **production_message_content** | **String** | Example of message content. | | +| **opt_in_workflow** | [**OptInWorkflow**](OptInWorkflow.md) | | | +| **additional_information** | **String** | Any additional information. | [optional] | +| **isv_reseller** | **String** | ISV name. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::VerificationRequest.new( + business_address: null, + business_contact: null, + message_volume: 10000, + phone_numbers: null, + use_case: 2FA, + use_case_summary: null, + production_message_content: null, + opt_in_workflow: null, + additional_information: null, + isv_reseller: Test ISV +) +``` + diff --git a/docs/VerificationUpdateRequest.md b/docs/VerificationUpdateRequest.md new file mode 100644 index 00000000..2f065db1 --- /dev/null +++ b/docs/VerificationUpdateRequest.md @@ -0,0 +1,34 @@ +# Bandwidth::VerificationUpdateRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **business_address** | [**Address**](Address.md) | | | +| **business_contact** | [**Contact**](Contact.md) | | | +| **message_volume** | **Integer** | Estimated monthly volume of messages from the toll-free number. | | +| **use_case** | **String** | The category of the use case. | | +| **use_case_summary** | **String** | A general idea of the use case and customer. | | +| **production_message_content** | **String** | Example of message content. | | +| **opt_in_workflow** | [**OptInWorkflow**](OptInWorkflow.md) | | | +| **additional_information** | **String** | Any additional information. | [optional] | +| **isv_reseller** | **String** | ISV name. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::VerificationUpdateRequest.new( + business_address: null, + business_contact: null, + message_volume: 10000, + use_case: 2FA, + use_case_summary: null, + production_message_content: null, + opt_in_workflow: null, + additional_information: null, + isv_reseller: Test ISV +) +``` + diff --git a/docs/VerificationWebhook.md b/docs/VerificationWebhook.md new file mode 100644 index 00000000..d0cbddf1 --- /dev/null +++ b/docs/VerificationWebhook.md @@ -0,0 +1,24 @@ +# Bandwidth::VerificationWebhook + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | User's account ID. | [optional] | +| **phone_number** | **String** | Toll-free telephone number in E.164 format. | [optional] | +| **status** | [**TfvCallbackStatusEnum**](TfvCallbackStatusEnum.md) | | [optional] | +| **internal_ticket_number** | **String** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::VerificationWebhook.new( + account_id: 1234567, + phone_number: +18005555555, + status: null, + internal_ticket_number: acde070d-8c4c-4f0d-9d8a-162843c10333 +) +``` + diff --git a/docs/WebhookSubscription.md b/docs/WebhookSubscription.md new file mode 100644 index 00000000..5188efbb --- /dev/null +++ b/docs/WebhookSubscription.md @@ -0,0 +1,30 @@ +# Bandwidth::WebhookSubscription + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **account_id** | **String** | | [optional] | +| **callback_url** | **String** | Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. | | +| **type** | [**WebhookSubscriptionTypeEnum**](WebhookSubscriptionTypeEnum.md) | | [optional] | +| **basic_authentication** | [**WebhookSubscriptionBasicAuthentication**](WebhookSubscriptionBasicAuthentication.md) | | [optional] | +| **created_date** | **Time** | | [optional] | +| **modified_date** | **Time** | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::WebhookSubscription.new( + id: 7hICGStfAfeGxEq3N0lQwO, + account_id: 1234567, + callback_url: https://www.example.com/path/to/resource, + type: null, + basic_authentication: null, + created_date: 2023-05-15T13:56:39.965Z, + modified_date: 2023-05-15T13:56:39.965Z +) +``` + diff --git a/docs/WebhookSubscriptionBasicAuthentication.md b/docs/WebhookSubscriptionBasicAuthentication.md new file mode 100644 index 00000000..46516aea --- /dev/null +++ b/docs/WebhookSubscriptionBasicAuthentication.md @@ -0,0 +1,20 @@ +# Bandwidth::WebhookSubscriptionBasicAuthentication + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **username** | **String** | | | +| **password** | **String** | | | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::WebhookSubscriptionBasicAuthentication.new( + username: null, + password: null +) +``` + diff --git a/docs/WebhookSubscriptionRequestSchema.md b/docs/WebhookSubscriptionRequestSchema.md new file mode 100644 index 00000000..bebaf0f6 --- /dev/null +++ b/docs/WebhookSubscriptionRequestSchema.md @@ -0,0 +1,22 @@ +# Bandwidth::WebhookSubscriptionRequestSchema + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **basic_authentication** | [**TfvBasicAuthentication**](TfvBasicAuthentication.md) | | [optional] | +| **callback_url** | **String** | Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. | | +| **shared_secret_key** | **String** | An ASCII string submitted by the user as a shared secret key for generating an HMAC header for callbacks. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::WebhookSubscriptionRequestSchema.new( + basic_authentication: null, + callback_url: https://www.example.com/path/to/resource, + shared_secret_key: This is my $3cret +) +``` + diff --git a/docs/WebhookSubscriptionTypeEnum.md b/docs/WebhookSubscriptionTypeEnum.md new file mode 100644 index 00000000..a4411fb3 --- /dev/null +++ b/docs/WebhookSubscriptionTypeEnum.md @@ -0,0 +1,15 @@ +# Bandwidth::WebhookSubscriptionTypeEnum + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::WebhookSubscriptionTypeEnum.new() +``` + diff --git a/docs/WebhookSubscriptionsListBody.md b/docs/WebhookSubscriptionsListBody.md new file mode 100644 index 00000000..5b85e830 --- /dev/null +++ b/docs/WebhookSubscriptionsListBody.md @@ -0,0 +1,22 @@ +# Bandwidth::WebhookSubscriptionsListBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **links** | [**LinksObject**](LinksObject.md) | | [optional] | +| **errors** | [**Array<Error>**](Error.md) | | [optional] | +| **data** | [**Array<WebhookSubscription>**](WebhookSubscription.md) | | | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::WebhookSubscriptionsListBody.new( + links: null, + errors: null, + data: null +) +``` + diff --git a/lib/bandwidth-sdk.rb b/lib/bandwidth-sdk.rb index bfa258bd..152eeecb 100644 --- a/lib/bandwidth-sdk.rb +++ b/lib/bandwidth-sdk.rb @@ -18,6 +18,8 @@ # Models require 'bandwidth-sdk/models/account_statistics' +require 'bandwidth-sdk/models/additional_denial_reason' +require 'bandwidth-sdk/models/address' require 'bandwidth-sdk/models/answer_callback' require 'bandwidth-sdk/models/bridge_complete_callback' require 'bandwidth-sdk/models/bridge_target_complete_callback' @@ -43,6 +45,7 @@ require 'bandwidth-sdk/models/conference_recording_metadata' require 'bandwidth-sdk/models/conference_redirect_callback' require 'bandwidth-sdk/models/conference_state_enum' +require 'bandwidth-sdk/models/contact' require 'bandwidth-sdk/models/create_call' require 'bandwidth-sdk/models/create_call_response' require 'bandwidth-sdk/models/create_lookup_response' @@ -51,10 +54,13 @@ require 'bandwidth-sdk/models/disconnect_callback' require 'bandwidth-sdk/models/diversion' require 'bandwidth-sdk/models/dtmf_callback' +require 'bandwidth-sdk/models/error' +require 'bandwidth-sdk/models/failure_webhook' require 'bandwidth-sdk/models/field_error' require 'bandwidth-sdk/models/file_format_enum' require 'bandwidth-sdk/models/gather_callback' require 'bandwidth-sdk/models/initiate_callback' +require 'bandwidth-sdk/models/links_object' require 'bandwidth-sdk/models/list_message_direction_enum' require 'bandwidth-sdk/models/list_message_item' require 'bandwidth-sdk/models/lookup_request' @@ -79,6 +85,7 @@ require 'bandwidth-sdk/models/mfa_forbidden_request_error' require 'bandwidth-sdk/models/mfa_request_error' require 'bandwidth-sdk/models/mfa_unauthorized_request_error' +require 'bandwidth-sdk/models/opt_in_workflow' require 'bandwidth-sdk/models/page_info' require 'bandwidth-sdk/models/priority_enum' require 'bandwidth-sdk/models/recording_available_callback' @@ -90,6 +97,14 @@ require 'bandwidth-sdk/models/redirect_method_enum' require 'bandwidth-sdk/models/stir_shaken' require 'bandwidth-sdk/models/tag' +require 'bandwidth-sdk/models/telephone_number' +require 'bandwidth-sdk/models/tfv_basic_authentication' +require 'bandwidth-sdk/models/tfv_callback_status_enum' +require 'bandwidth-sdk/models/tfv_error' +require 'bandwidth-sdk/models/tfv_status' +require 'bandwidth-sdk/models/tfv_status_enum' +require 'bandwidth-sdk/models/tfv_submission_info' +require 'bandwidth-sdk/models/tfv_submission_wrapper' require 'bandwidth-sdk/models/tn_lookup_request_error' require 'bandwidth-sdk/models/transcribe_recording' require 'bandwidth-sdk/models/transcription' @@ -101,10 +116,19 @@ require 'bandwidth-sdk/models/update_call_recording' require 'bandwidth-sdk/models/update_conference' require 'bandwidth-sdk/models/update_conference_member' +require 'bandwidth-sdk/models/verification_denial_webhook' +require 'bandwidth-sdk/models/verification_request' +require 'bandwidth-sdk/models/verification_update_request' +require 'bandwidth-sdk/models/verification_webhook' require 'bandwidth-sdk/models/verify_code_request' require 'bandwidth-sdk/models/verify_code_response' require 'bandwidth-sdk/models/voice_api_error' require 'bandwidth-sdk/models/voice_code_response' +require 'bandwidth-sdk/models/webhook_subscription' +require 'bandwidth-sdk/models/webhook_subscription_basic_authentication' +require 'bandwidth-sdk/models/webhook_subscription_request_schema' +require 'bandwidth-sdk/models/webhook_subscription_type_enum' +require 'bandwidth-sdk/models/webhook_subscriptions_list_body' # BXML require 'bandwidth-sdk/models/bxml/root' @@ -150,6 +174,7 @@ require 'bandwidth-sdk/api/phone_number_lookup_api' require 'bandwidth-sdk/api/recordings_api' require 'bandwidth-sdk/api/statistics_api' +require 'bandwidth-sdk/api/toll_free_verification_api' require 'bandwidth-sdk/api/transcriptions_api' module Bandwidth diff --git a/lib/bandwidth-sdk/api/toll_free_verification_api.rb b/lib/bandwidth-sdk/api/toll_free_verification_api.rb new file mode 100644 index 00000000..c72a7d8f --- /dev/null +++ b/lib/bandwidth-sdk/api/toll_free_verification_api.rb @@ -0,0 +1,614 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'cgi' + +module Bandwidth + class TollFreeVerificationApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create Webhook Subscription + # Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time. + # @param account_id [String] Your Bandwidth Account ID. + # @param webhook_subscription_request_schema [WebhookSubscriptionRequestSchema] Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + # @param [Hash] opts the optional parameters + # @return [WebhookSubscription] + def create_webhook_subscription(account_id, webhook_subscription_request_schema, opts = {}) + data, _status_code, _headers = create_webhook_subscription_with_http_info(account_id, webhook_subscription_request_schema, opts) + data + end + + # Create Webhook Subscription + # Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time. + # @param account_id [String] Your Bandwidth Account ID. + # @param webhook_subscription_request_schema [WebhookSubscriptionRequestSchema] Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + # @param [Hash] opts the optional parameters + # @return [Array<(WebhookSubscription, Integer, Hash)>] WebhookSubscription data, response status code and response headers + def create_webhook_subscription_with_http_info(account_id, webhook_subscription_request_schema, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.create_webhook_subscription ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.create_webhook_subscription" + end + # verify the required parameter 'webhook_subscription_request_schema' is set + if @api_client.config.client_side_validation && webhook_subscription_request_schema.nil? + fail ArgumentError, "Missing the required parameter 'webhook_subscription_request_schema' when calling TollFreeVerificationApi.create_webhook_subscription" + end + # resource path + local_var_path = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_subscription_request_schema) + + # return_type + return_type = opts[:debug_return_type] || 'WebhookSubscription' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Basic'] + + new_options = opts.merge( + :operation => :"TollFreeVerificationApi.create_webhook_subscription", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TollFreeVerificationApi#create_webhook_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Webhook Subscription + # Delete a webhook subscription by ID. + # @param account_id [String] Your Bandwidth Account ID. + # @param id [String] Webhook subscription ID + # @param [Hash] opts the optional parameters + # @return [nil] + def delete_webhook_subscription(account_id, id, opts = {}) + delete_webhook_subscription_with_http_info(account_id, id, opts) + nil + end + + # Delete Webhook Subscription + # Delete a webhook subscription by ID. + # @param account_id [String] Your Bandwidth Account ID. + # @param id [String] Webhook subscription ID + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_webhook_subscription_with_http_info(account_id, id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.delete_webhook_subscription ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.delete_webhook_subscription" + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling TollFreeVerificationApi.delete_webhook_subscription" + end + # resource path + local_var_path = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Basic'] + + new_options = opts.merge( + :operation => :"TollFreeVerificationApi.delete_webhook_subscription", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TollFreeVerificationApi#delete_webhook_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Toll-Free Verification Status + # Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available. + # @param account_id [String] Your Bandwidth Account ID. + # @param phone_number [String] Valid Toll-Free telephone number in E.164 format. + # @param [Hash] opts the optional parameters + # @return [TfvStatus] + def get_toll_free_verification_status(account_id, phone_number, opts = {}) + data, _status_code, _headers = get_toll_free_verification_status_with_http_info(account_id, phone_number, opts) + data + end + + # Get Toll-Free Verification Status + # Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available. + # @param account_id [String] Your Bandwidth Account ID. + # @param phone_number [String] Valid Toll-Free telephone number in E.164 format. + # @param [Hash] opts the optional parameters + # @return [Array<(TfvStatus, Integer, Hash)>] TfvStatus data, response status code and response headers + def get_toll_free_verification_status_with_http_info(account_id, phone_number, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.get_toll_free_verification_status ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.get_toll_free_verification_status" + end + # verify the required parameter 'phone_number' is set + if @api_client.config.client_side_validation && phone_number.nil? + fail ArgumentError, "Missing the required parameter 'phone_number' when calling TollFreeVerificationApi.get_toll_free_verification_status" + end + if @api_client.config.client_side_validation && phone_number.to_s.length > 12 + fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.get_toll_free_verification_status, the character length must be smaller than or equal to 12.' + end + + if @api_client.config.client_side_validation && phone_number.to_s.length < 12 + fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.get_toll_free_verification_status, the character length must be great than or equal to 12.' + end + + pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + if @api_client.config.client_side_validation && phone_number !~ pattern + fail ArgumentError, "invalid value for 'phone_number' when calling TollFreeVerificationApi.get_toll_free_verification_status, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'phoneNumber' + '}', CGI.escape(phone_number.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'TfvStatus' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Basic'] + + new_options = opts.merge( + :operation => :"TollFreeVerificationApi.get_toll_free_verification_status", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TollFreeVerificationApi#get_toll_free_verification_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Toll-Free Use Cases + # Lists valid toll-free use cases. + # @param [Hash] opts the optional parameters + # @return [Array] + def list_toll_free_use_cases(opts = {}) + data, _status_code, _headers = list_toll_free_use_cases_with_http_info(opts) + data + end + + # List Toll-Free Use Cases + # Lists valid toll-free use cases. + # @param [Hash] opts the optional parameters + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers + def list_toll_free_use_cases_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.list_toll_free_use_cases ...' + end + # resource path + local_var_path = '/tollFreeVerification/useCases' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Array' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Basic'] + + new_options = opts.merge( + :operation => :"TollFreeVerificationApi.list_toll_free_use_cases", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TollFreeVerificationApi#list_toll_free_use_cases\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Webhook Subscriptions + # Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null). + # @param account_id [String] Your Bandwidth Account ID. + # @param [Hash] opts the optional parameters + # @return [WebhookSubscriptionsListBody] + def list_webhook_subscriptions(account_id, opts = {}) + data, _status_code, _headers = list_webhook_subscriptions_with_http_info(account_id, opts) + data + end + + # List Webhook Subscriptions + # Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null). + # @param account_id [String] Your Bandwidth Account ID. + # @param [Hash] opts the optional parameters + # @return [Array<(WebhookSubscriptionsListBody, Integer, Hash)>] WebhookSubscriptionsListBody data, response status code and response headers + def list_webhook_subscriptions_with_http_info(account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.list_webhook_subscriptions ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.list_webhook_subscriptions" + end + # resource path + local_var_path = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'WebhookSubscriptionsListBody' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Basic'] + + new_options = opts.merge( + :operation => :"TollFreeVerificationApi.list_webhook_subscriptions", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TollFreeVerificationApi#list_webhook_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Request Toll-Free Verification + # Submit a request for verification of a toll-free phone number. + # @param account_id [String] Your Bandwidth Account ID. + # @param verification_request [VerificationRequest] Request for verification of a toll-free phone number. + # @param [Hash] opts the optional parameters + # @return [nil] + def request_toll_free_verification(account_id, verification_request, opts = {}) + request_toll_free_verification_with_http_info(account_id, verification_request, opts) + nil + end + + # Request Toll-Free Verification + # Submit a request for verification of a toll-free phone number. + # @param account_id [String] Your Bandwidth Account ID. + # @param verification_request [VerificationRequest] Request for verification of a toll-free phone number. + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def request_toll_free_verification_with_http_info(account_id, verification_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.request_toll_free_verification ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.request_toll_free_verification" + end + # verify the required parameter 'verification_request' is set + if @api_client.config.client_side_validation && verification_request.nil? + fail ArgumentError, "Missing the required parameter 'verification_request' when calling TollFreeVerificationApi.request_toll_free_verification" + end + # resource path + local_var_path = '/accounts/{accountId}/tollFreeVerification'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(verification_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Basic'] + + new_options = opts.merge( + :operation => :"TollFreeVerificationApi.request_toll_free_verification", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TollFreeVerificationApi#request_toll_free_verification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Toll-Free Verification Request + # Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true). + # @param account_id [String] Your Bandwidth Account ID. + # @param phone_number [String] Valid Toll-Free telephone number in E.164 format. + # @param tfv_submission_wrapper [TfvSubmissionWrapper] Update a request for verification of a toll-free phone number. + # @param [Hash] opts the optional parameters + # @return [nil] + def update_toll_free_verification_request(account_id, phone_number, tfv_submission_wrapper, opts = {}) + update_toll_free_verification_request_with_http_info(account_id, phone_number, tfv_submission_wrapper, opts) + nil + end + + # Update Toll-Free Verification Request + # Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true). + # @param account_id [String] Your Bandwidth Account ID. + # @param phone_number [String] Valid Toll-Free telephone number in E.164 format. + # @param tfv_submission_wrapper [TfvSubmissionWrapper] Update a request for verification of a toll-free phone number. + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def update_toll_free_verification_request_with_http_info(account_id, phone_number, tfv_submission_wrapper, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.update_toll_free_verification_request ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.update_toll_free_verification_request" + end + # verify the required parameter 'phone_number' is set + if @api_client.config.client_side_validation && phone_number.nil? + fail ArgumentError, "Missing the required parameter 'phone_number' when calling TollFreeVerificationApi.update_toll_free_verification_request" + end + if @api_client.config.client_side_validation && phone_number.to_s.length > 12 + fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.update_toll_free_verification_request, the character length must be smaller than or equal to 12.' + end + + if @api_client.config.client_side_validation && phone_number.to_s.length < 12 + fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.update_toll_free_verification_request, the character length must be great than or equal to 12.' + end + + pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + if @api_client.config.client_side_validation && phone_number !~ pattern + fail ArgumentError, "invalid value for 'phone_number' when calling TollFreeVerificationApi.update_toll_free_verification_request, must conform to the pattern #{pattern}." + end + + # verify the required parameter 'tfv_submission_wrapper' is set + if @api_client.config.client_side_validation && tfv_submission_wrapper.nil? + fail ArgumentError, "Missing the required parameter 'tfv_submission_wrapper' when calling TollFreeVerificationApi.update_toll_free_verification_request" + end + # resource path + local_var_path = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'phoneNumber' + '}', CGI.escape(phone_number.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(tfv_submission_wrapper) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Basic'] + + new_options = opts.merge( + :operation => :"TollFreeVerificationApi.update_toll_free_verification_request", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TollFreeVerificationApi#update_toll_free_verification_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Webhook Subscription + # Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + # @param account_id [String] Your Bandwidth Account ID. + # @param id [String] Webhook subscription ID + # @param webhook_subscription_request_schema [WebhookSubscriptionRequestSchema] Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + # @param [Hash] opts the optional parameters + # @return [WebhookSubscription] + def update_webhook_subscription(account_id, id, webhook_subscription_request_schema, opts = {}) + data, _status_code, _headers = update_webhook_subscription_with_http_info(account_id, id, webhook_subscription_request_schema, opts) + data + end + + # Update Webhook Subscription + # Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + # @param account_id [String] Your Bandwidth Account ID. + # @param id [String] Webhook subscription ID + # @param webhook_subscription_request_schema [WebhookSubscriptionRequestSchema] Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + # @param [Hash] opts the optional parameters + # @return [Array<(WebhookSubscription, Integer, Hash)>] WebhookSubscription data, response status code and response headers + def update_webhook_subscription_with_http_info(account_id, id, webhook_subscription_request_schema, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.update_webhook_subscription ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling TollFreeVerificationApi.update_webhook_subscription" + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling TollFreeVerificationApi.update_webhook_subscription" + end + # verify the required parameter 'webhook_subscription_request_schema' is set + if @api_client.config.client_side_validation && webhook_subscription_request_schema.nil? + fail ArgumentError, "Missing the required parameter 'webhook_subscription_request_schema' when calling TollFreeVerificationApi.update_webhook_subscription" + end + # resource path + local_var_path = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_subscription_request_schema) + + # return_type + return_type = opts[:debug_return_type] || 'WebhookSubscription' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Basic'] + + new_options = opts.merge( + :operation => :"TollFreeVerificationApi.update_webhook_subscription", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TollFreeVerificationApi#update_webhook_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/bandwidth-sdk/configuration.rb b/lib/bandwidth-sdk/configuration.rb index 3090faf3..54e328b8 100644 --- a/lib/bandwidth-sdk/configuration.rb +++ b/lib/bandwidth-sdk/configuration.rb @@ -486,6 +486,54 @@ def operation_server_settings description: "Production", } ], + "TollFreeVerificationApi.create_webhook_subscription": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.delete_webhook_subscription": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.get_toll_free_verification_status": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.list_toll_free_use_cases": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.list_webhook_subscriptions": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.request_toll_free_verification": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.update_toll_free_verification_request": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.update_webhook_subscription": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], "TranscriptionsApi.delete_real_time_transcription": [ { url: "https://voice.bandwidth.com/api/v2", diff --git a/lib/bandwidth-sdk/models/additional_denial_reason.rb b/lib/bandwidth-sdk/models/additional_denial_reason.rb new file mode 100644 index 00000000..34e39447 --- /dev/null +++ b/lib/bandwidth-sdk/models/additional_denial_reason.rb @@ -0,0 +1,254 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class AdditionalDenialReason + # Reason code for denial. + attr_accessor :status_code + + # Explanation for why a verification request was declined. + attr_accessor :reason + + # Whether a Toll-Free Verification request qualifies for resubmission via PUT. + attr_accessor :resubmit_allowed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status_code' => :'statusCode', + :'reason' => :'reason', + :'resubmit_allowed' => :'resubmitAllowed' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'status_code' => :'Integer', + :'reason' => :'String', + :'resubmit_allowed' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::AdditionalDenialReason` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AdditionalDenialReason`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'status_code') + self.status_code = attributes[:'status_code'] + else + self.status_code = nil + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + else + self.reason = nil + end + + if attributes.key?(:'resubmit_allowed') + self.resubmit_allowed = attributes[:'resubmit_allowed'] + else + self.resubmit_allowed = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @status_code.nil? + invalid_properties.push('invalid value for "status_code", status_code cannot be nil.') + end + + if @reason.nil? + invalid_properties.push('invalid value for "reason", reason cannot be nil.') + end + + if @resubmit_allowed.nil? + invalid_properties.push('invalid value for "resubmit_allowed", resubmit_allowed cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @status_code.nil? + return false if @reason.nil? + return false if @resubmit_allowed.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status_code == o.status_code && + reason == o.reason && + resubmit_allowed == o.resubmit_allowed + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [status_code, reason, resubmit_allowed].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/address.rb b/lib/bandwidth-sdk/models/address.rb new file mode 100644 index 00000000..2403803c --- /dev/null +++ b/lib/bandwidth-sdk/models/address.rb @@ -0,0 +1,501 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class Address + # The name of the business using the toll-free number. + attr_accessor :name + + # The address of the business using the toll-free number. + attr_accessor :addr1 + + # The address of the business using the toll-free number. + attr_accessor :addr2 + + # The city of the business using the toll-free number. + attr_accessor :city + + # The state of the business using the toll-free number. + attr_accessor :state + + # The zip of the business using the toll-free number. + attr_accessor :zip + + # The website of the business using the toll-free number. + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'addr1' => :'addr1', + :'addr2' => :'addr2', + :'city' => :'city', + :'state' => :'state', + :'zip' => :'zip', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'addr1' => :'String', + :'addr2' => :'String', + :'city' => :'String', + :'state' => :'String', + :'zip' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'addr2', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Address` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Address`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'addr1') + self.addr1 = attributes[:'addr1'] + else + self.addr1 = nil + end + + if attributes.key?(:'addr2') + self.addr2 = attributes[:'addr2'] + end + + if attributes.key?(:'city') + self.city = attributes[:'city'] + else + self.city = nil + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + else + self.state = nil + end + + if attributes.key?(:'zip') + self.zip = attributes[:'zip'] + else + self.zip = nil + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + else + self.url = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @name.to_s.length > 500 + invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 500.') + end + + if @name.to_s.length < 1 + invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + end + + if @addr1.nil? + invalid_properties.push('invalid value for "addr1", addr1 cannot be nil.') + end + + if @addr1.to_s.length > 500 + invalid_properties.push('invalid value for "addr1", the character length must be smaller than or equal to 500.') + end + + if @addr1.to_s.length < 1 + invalid_properties.push('invalid value for "addr1", the character length must be great than or equal to 1.') + end + + if !@addr2.nil? && @addr2.to_s.length > 500 + invalid_properties.push('invalid value for "addr2", the character length must be smaller than or equal to 500.') + end + + if !@addr2.nil? && @addr2.to_s.length < 0 + invalid_properties.push('invalid value for "addr2", the character length must be great than or equal to 0.') + end + + if @city.nil? + invalid_properties.push('invalid value for "city", city cannot be nil.') + end + + if @city.to_s.length > 500 + invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 500.') + end + + if @city.to_s.length < 1 + invalid_properties.push('invalid value for "city", the character length must be great than or equal to 1.') + end + + if @state.nil? + invalid_properties.push('invalid value for "state", state cannot be nil.') + end + + if @state.to_s.length > 500 + invalid_properties.push('invalid value for "state", the character length must be smaller than or equal to 500.') + end + + if @state.to_s.length < 1 + invalid_properties.push('invalid value for "state", the character length must be great than or equal to 1.') + end + + if @zip.nil? + invalid_properties.push('invalid value for "zip", zip cannot be nil.') + end + + pattern = Regexp.new(/[- A-Za-z0-9]{0,500}/) + if @zip !~ pattern + invalid_properties.push("invalid value for \"zip\", must conform to the pattern #{pattern}.") + end + + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + if @url.to_s.length > 500 + invalid_properties.push('invalid value for "url", the character length must be smaller than or equal to 500.') + end + + if @url.to_s.length < 1 + invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @name.nil? + return false if @name.to_s.length > 500 + return false if @name.to_s.length < 1 + return false if @addr1.nil? + return false if @addr1.to_s.length > 500 + return false if @addr1.to_s.length < 1 + return false if !@addr2.nil? && @addr2.to_s.length > 500 + return false if !@addr2.nil? && @addr2.to_s.length < 0 + return false if @city.nil? + return false if @city.to_s.length > 500 + return false if @city.to_s.length < 1 + return false if @state.nil? + return false if @state.to_s.length > 500 + return false if @state.to_s.length < 1 + return false if @zip.nil? + return false if @zip !~ Regexp.new(/[- A-Za-z0-9]{0,500}/) + return false if @url.nil? + return false if @url.to_s.length > 500 + return false if @url.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + if name.to_s.length > 500 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 500.' + end + + if name.to_s.length < 1 + fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] addr1 Value to be assigned + def addr1=(addr1) + if addr1.nil? + fail ArgumentError, 'addr1 cannot be nil' + end + + if addr1.to_s.length > 500 + fail ArgumentError, 'invalid value for "addr1", the character length must be smaller than or equal to 500.' + end + + if addr1.to_s.length < 1 + fail ArgumentError, 'invalid value for "addr1", the character length must be great than or equal to 1.' + end + + @addr1 = addr1 + end + + # Custom attribute writer method with validation + # @param [Object] addr2 Value to be assigned + def addr2=(addr2) + if !addr2.nil? && addr2.to_s.length > 500 + fail ArgumentError, 'invalid value for "addr2", the character length must be smaller than or equal to 500.' + end + + if !addr2.nil? && addr2.to_s.length < 0 + fail ArgumentError, 'invalid value for "addr2", the character length must be great than or equal to 0.' + end + + @addr2 = addr2 + end + + # Custom attribute writer method with validation + # @param [Object] city Value to be assigned + def city=(city) + if city.nil? + fail ArgumentError, 'city cannot be nil' + end + + if city.to_s.length > 500 + fail ArgumentError, 'invalid value for "city", the character length must be smaller than or equal to 500.' + end + + if city.to_s.length < 1 + fail ArgumentError, 'invalid value for "city", the character length must be great than or equal to 1.' + end + + @city = city + end + + # Custom attribute writer method with validation + # @param [Object] state Value to be assigned + def state=(state) + if state.nil? + fail ArgumentError, 'state cannot be nil' + end + + if state.to_s.length > 500 + fail ArgumentError, 'invalid value for "state", the character length must be smaller than or equal to 500.' + end + + if state.to_s.length < 1 + fail ArgumentError, 'invalid value for "state", the character length must be great than or equal to 1.' + end + + @state = state + end + + # Custom attribute writer method with validation + # @param [Object] zip Value to be assigned + def zip=(zip) + if zip.nil? + fail ArgumentError, 'zip cannot be nil' + end + + pattern = Regexp.new(/[- A-Za-z0-9]{0,500}/) + if zip !~ pattern + fail ArgumentError, "invalid value for \"zip\", must conform to the pattern #{pattern}." + end + + @zip = zip + end + + # Custom attribute writer method with validation + # @param [Object] url Value to be assigned + def url=(url) + if url.nil? + fail ArgumentError, 'url cannot be nil' + end + + if url.to_s.length > 500 + fail ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 500.' + end + + if url.to_s.length < 1 + fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.' + end + + @url = url + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + addr1 == o.addr1 && + addr2 == o.addr2 && + city == o.city && + state == o.state && + zip == o.zip && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, addr1, addr2, city, state, zip, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/contact.rb b/lib/bandwidth-sdk/models/contact.rb new file mode 100644 index 00000000..510e5957 --- /dev/null +++ b/lib/bandwidth-sdk/models/contact.rb @@ -0,0 +1,393 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class Contact + # The first name of the business contact using the toll-free number. + attr_accessor :first_name + + # The last name of the business contact using the toll-free number. + attr_accessor :last_name + + attr_accessor :email + + # Contact telephone number + attr_accessor :phone_number + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'first_name' => :'firstName', + :'last_name' => :'lastName', + :'email' => :'email', + :'phone_number' => :'phoneNumber' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'first_name' => :'String', + :'last_name' => :'String', + :'email' => :'String', + :'phone_number' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Contact` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Contact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + else + self.first_name = nil + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + else + self.last_name = nil + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + else + self.email = nil + end + + if attributes.key?(:'phone_number') + self.phone_number = attributes[:'phone_number'] + else + self.phone_number = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @first_name.nil? + invalid_properties.push('invalid value for "first_name", first_name cannot be nil.') + end + + if @first_name.to_s.length > 500 + invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 500.') + end + + if @first_name.to_s.length < 1 + invalid_properties.push('invalid value for "first_name", the character length must be great than or equal to 1.') + end + + if @last_name.nil? + invalid_properties.push('invalid value for "last_name", last_name cannot be nil.') + end + + if @last_name.to_s.length > 500 + invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 500.') + end + + if @last_name.to_s.length < 1 + invalid_properties.push('invalid value for "last_name", the character length must be great than or equal to 1.') + end + + if @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if @email.to_s.length > 500 + invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 500.') + end + + if @email.to_s.length < 0 + invalid_properties.push('invalid value for "email", the character length must be great than or equal to 0.') + end + + pattern = Regexp.new(/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/) + if @email !~ pattern + invalid_properties.push("invalid value for \"email\", must conform to the pattern #{pattern}.") + end + + if @phone_number.nil? + invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.') + end + + if @phone_number.to_s.length > 500 + invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 500.') + end + + if @phone_number.to_s.length < 1 + invalid_properties.push('invalid value for "phone_number", the character length must be great than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @first_name.nil? + return false if @first_name.to_s.length > 500 + return false if @first_name.to_s.length < 1 + return false if @last_name.nil? + return false if @last_name.to_s.length > 500 + return false if @last_name.to_s.length < 1 + return false if @email.nil? + return false if @email.to_s.length > 500 + return false if @email.to_s.length < 0 + return false if @email !~ Regexp.new(/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/) + return false if @phone_number.nil? + return false if @phone_number.to_s.length > 500 + return false if @phone_number.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] first_name Value to be assigned + def first_name=(first_name) + if first_name.nil? + fail ArgumentError, 'first_name cannot be nil' + end + + if first_name.to_s.length > 500 + fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 500.' + end + + if first_name.to_s.length < 1 + fail ArgumentError, 'invalid value for "first_name", the character length must be great than or equal to 1.' + end + + @first_name = first_name + end + + # Custom attribute writer method with validation + # @param [Object] last_name Value to be assigned + def last_name=(last_name) + if last_name.nil? + fail ArgumentError, 'last_name cannot be nil' + end + + if last_name.to_s.length > 500 + fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 500.' + end + + if last_name.to_s.length < 1 + fail ArgumentError, 'invalid value for "last_name", the character length must be great than or equal to 1.' + end + + @last_name = last_name + end + + # Custom attribute writer method with validation + # @param [Object] email Value to be assigned + def email=(email) + if email.nil? + fail ArgumentError, 'email cannot be nil' + end + + if email.to_s.length > 500 + fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 500.' + end + + if email.to_s.length < 0 + fail ArgumentError, 'invalid value for "email", the character length must be great than or equal to 0.' + end + + pattern = Regexp.new(/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/) + if email !~ pattern + fail ArgumentError, "invalid value for \"email\", must conform to the pattern #{pattern}." + end + + @email = email + end + + # Custom attribute writer method with validation + # @param [Object] phone_number Value to be assigned + def phone_number=(phone_number) + if phone_number.nil? + fail ArgumentError, 'phone_number cannot be nil' + end + + if phone_number.to_s.length > 500 + fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 500.' + end + + if phone_number.to_s.length < 1 + fail ArgumentError, 'invalid value for "phone_number", the character length must be great than or equal to 1.' + end + + @phone_number = phone_number + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first_name == o.first_name && + last_name == o.last_name && + email == o.email && + phone_number == o.phone_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [first_name, last_name, email, phone_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/error.rb b/lib/bandwidth-sdk/models/error.rb new file mode 100644 index 00000000..c5cac684 --- /dev/null +++ b/lib/bandwidth-sdk/models/error.rb @@ -0,0 +1,232 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class Error + attr_accessor :code + + attr_accessor :description + + attr_accessor :telephone_numbers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'code' => :'code', + :'description' => :'description', + :'telephone_numbers' => :'telephoneNumbers' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'code' => :'Integer', + :'description' => :'String', + :'telephone_numbers' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Error` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'telephone_numbers') + if (value = attributes[:'telephone_numbers']).is_a?(Array) + self.telephone_numbers = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + code == o.code && + description == o.description && + telephone_numbers == o.telephone_numbers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [code, description, telephone_numbers].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/failure_webhook.rb b/lib/bandwidth-sdk/models/failure_webhook.rb new file mode 100644 index 00000000..5e4333b6 --- /dev/null +++ b/lib/bandwidth-sdk/models/failure_webhook.rb @@ -0,0 +1,304 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class FailureWebhook + # User's account ID. + attr_accessor :account_id + + # Toll-free telephone number in E.164 format. + attr_accessor :phone_number + + # An error code indicating what error was encountered. This code can be interpreted as an HTTP status code in regards to the error that was encountered. + attr_accessor :error_code + + # A description of the error that was encountered. + attr_accessor :error_description + + # Details of the errors that were encountered when processing the request. + attr_accessor :errors + + # Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + attr_accessor :internal_ticket_number + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'accountId', + :'phone_number' => :'phoneNumber', + :'error_code' => :'errorCode', + :'error_description' => :'errorDescription', + :'errors' => :'errors', + :'internal_ticket_number' => :'internalTicketNumber' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_id' => :'String', + :'phone_number' => :'String', + :'error_code' => :'String', + :'error_description' => :'String', + :'errors' => :'Array', + :'internal_ticket_number' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::FailureWebhook` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::FailureWebhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'phone_number') + self.phone_number = attributes[:'phone_number'] + end + + if attributes.key?(:'error_code') + self.error_code = attributes[:'error_code'] + end + + if attributes.key?(:'error_description') + self.error_description = attributes[:'error_description'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + end + + if attributes.key?(:'internal_ticket_number') + self.internal_ticket_number = attributes[:'internal_ticket_number'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@phone_number.nil? && @phone_number.to_s.length > 12 + invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.') + end + + if !@phone_number.nil? && @phone_number.to_s.length < 12 + invalid_properties.push('invalid value for "phone_number", the character length must be great than or equal to 12.') + end + + pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + if !@phone_number.nil? && @phone_number !~ pattern + invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@phone_number.nil? && @phone_number.to_s.length > 12 + return false if !@phone_number.nil? && @phone_number.to_s.length < 12 + return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] phone_number Value to be assigned + def phone_number=(phone_number) + if phone_number.nil? + fail ArgumentError, 'phone_number cannot be nil' + end + + if phone_number.to_s.length > 12 + fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.' + end + + if phone_number.to_s.length < 12 + fail ArgumentError, 'invalid value for "phone_number", the character length must be great than or equal to 12.' + end + + pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + if phone_number !~ pattern + fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}." + end + + @phone_number = phone_number + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + phone_number == o.phone_number && + error_code == o.error_code && + error_description == o.error_description && + errors == o.errors && + internal_ticket_number == o.internal_ticket_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_id, phone_number, error_code, error_description, errors, internal_ticket_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/links_object.rb b/lib/bandwidth-sdk/models/links_object.rb new file mode 100644 index 00000000..2d6181e9 --- /dev/null +++ b/lib/bandwidth-sdk/models/links_object.rb @@ -0,0 +1,243 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class LinksObject + # The first (or only) page of results matching the query. + attr_accessor :first + + # If more results exist than specified by 'size', this link returns the next page of 'size' results. + attr_accessor :_next + + # If the results are more than one page, this link returns the previous page of 'size' results. + attr_accessor :previous + + # If more results exist than specified by 'size', this link return the last page of result. + attr_accessor :last + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'first' => :'first', + :'_next' => :'next', + :'previous' => :'previous', + :'last' => :'last' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'first' => :'String', + :'_next' => :'String', + :'previous' => :'String', + :'last' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LinksObject` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LinksObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'first') + self.first = attributes[:'first'] + end + + if attributes.key?(:'_next') + self._next = attributes[:'_next'] + end + + if attributes.key?(:'previous') + self.previous = attributes[:'previous'] + end + + if attributes.key?(:'last') + self.last = attributes[:'last'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first == o.first && + _next == o._next && + previous == o.previous && + last == o.last + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [first, _next, previous, last].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/opt_in_workflow.rb b/lib/bandwidth-sdk/models/opt_in_workflow.rb new file mode 100644 index 00000000..e4ea2df4 --- /dev/null +++ b/lib/bandwidth-sdk/models/opt_in_workflow.rb @@ -0,0 +1,265 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class OptInWorkflow + attr_accessor :description + + attr_accessor :image_urls + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'description' => :'description', + :'image_urls' => :'imageUrls' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'description' => :'String', + :'image_urls' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::OptInWorkflow` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::OptInWorkflow`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + else + self.description = nil + end + + if attributes.key?(:'image_urls') + if (value = attributes[:'image_urls']).is_a?(Array) + self.image_urls = value + end + else + self.image_urls = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @description.nil? + invalid_properties.push('invalid value for "description", description cannot be nil.') + end + + if @description.to_s.length > 500 + invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 500.') + end + + if @description.to_s.length < 1 + invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.') + end + + if @image_urls.nil? + invalid_properties.push('invalid value for "image_urls", image_urls cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @description.nil? + return false if @description.to_s.length > 500 + return false if @description.to_s.length < 1 + return false if @image_urls.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if description.nil? + fail ArgumentError, 'description cannot be nil' + end + + if description.to_s.length > 500 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 500.' + end + + if description.to_s.length < 1 + fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.' + end + + @description = description + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + image_urls == o.image_urls + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [description, image_urls].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/telephone_number.rb b/lib/bandwidth-sdk/models/telephone_number.rb new file mode 100644 index 00000000..d350137f --- /dev/null +++ b/lib/bandwidth-sdk/models/telephone_number.rb @@ -0,0 +1,213 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class TelephoneNumber + # Simple Telephone Number. + attr_accessor :telephone_number + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'telephone_number' => :'telephoneNumber' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'telephone_number' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TelephoneNumber` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TelephoneNumber`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'telephone_number') + self.telephone_number = attributes[:'telephone_number'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + telephone_number == o.telephone_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [telephone_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/tfv_basic_authentication.rb b/lib/bandwidth-sdk/models/tfv_basic_authentication.rb new file mode 100644 index 00000000..a3ee757c --- /dev/null +++ b/lib/bandwidth-sdk/models/tfv_basic_authentication.rb @@ -0,0 +1,273 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class TfvBasicAuthentication + attr_accessor :username + + attr_accessor :password + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'username' => :'username', + :'password' => :'password' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'username' => :'String', + :'password' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvBasicAuthentication` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvBasicAuthentication`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'username') + self.username = attributes[:'username'] + else + self.username = nil + end + + if attributes.key?(:'password') + self.password = attributes[:'password'] + else + self.password = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @username.nil? + invalid_properties.push('invalid value for "username", username cannot be nil.') + end + + if @username.to_s.length > 100 + invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 100.') + end + + if @password.nil? + invalid_properties.push('invalid value for "password", password cannot be nil.') + end + + if @password.to_s.length > 200 + invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 200.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @username.nil? + return false if @username.to_s.length > 100 + return false if @password.nil? + return false if @password.to_s.length > 200 + true + end + + # Custom attribute writer method with validation + # @param [Object] username Value to be assigned + def username=(username) + if username.nil? + fail ArgumentError, 'username cannot be nil' + end + + if username.to_s.length > 100 + fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 100.' + end + + @username = username + end + + # Custom attribute writer method with validation + # @param [Object] password Value to be assigned + def password=(password) + if password.nil? + fail ArgumentError, 'password cannot be nil' + end + + if password.to_s.length > 200 + fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 200.' + end + + @password = password + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + username == o.username && + password == o.password + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [username, password].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb b/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb new file mode 100644 index 00000000..8a25dfe4 --- /dev/null +++ b/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb @@ -0,0 +1,40 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class TfvCallbackStatusEnum + VERIFIED = 'VERIFIED'.freeze + UNVERIFIED = 'UNVERIFIED'.freeze + + def self.all_vars + @all_vars ||= [VERIFIED, UNVERIFIED].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if TfvCallbackStatusEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #TfvCallbackStatusEnum" + end + end +end diff --git a/lib/bandwidth-sdk/models/tfv_error.rb b/lib/bandwidth-sdk/models/tfv_error.rb new file mode 100644 index 00000000..3130ea66 --- /dev/null +++ b/lib/bandwidth-sdk/models/tfv_error.rb @@ -0,0 +1,232 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + # A generic error object. + class TfvError + attr_accessor :type + + attr_accessor :description + + # Each key of this errors object refers to a field of the submitted object (using dot notation for nested objects), with the field being a key to an array of one or more errors for that field. + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'description' => :'description', + :'errors' => :'errors' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'description' => :'String', + :'errors' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvError` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'errors') + self.errors = attributes[:'errors'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + description == o.description && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, description, errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/tfv_status.rb b/lib/bandwidth-sdk/models/tfv_status.rb new file mode 100644 index 00000000..8096de5d --- /dev/null +++ b/lib/bandwidth-sdk/models/tfv_status.rb @@ -0,0 +1,342 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class TfvStatus + # Toll-free telephone number in E.164 format. + attr_accessor :phone_number + + attr_accessor :status + + # Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. + attr_accessor :internal_ticket_number + + # Explanation for why a verification request was declined. + attr_accessor :decline_reason_description + + # Whether a Toll-Free Verification request qualifies for resubmission via PUT. + attr_accessor :resubmit_allowed + + # Date and time the verification request was created. + attr_accessor :created_date_time + + # Date and time the verification request was last modified. + attr_accessor :modified_date_time + + attr_accessor :submission + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'phone_number' => :'phoneNumber', + :'status' => :'status', + :'internal_ticket_number' => :'internalTicketNumber', + :'decline_reason_description' => :'declineReasonDescription', + :'resubmit_allowed' => :'resubmitAllowed', + :'created_date_time' => :'createdDateTime', + :'modified_date_time' => :'modifiedDateTime', + :'submission' => :'submission' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'phone_number' => :'String', + :'status' => :'TfvStatusEnum', + :'internal_ticket_number' => :'String', + :'decline_reason_description' => :'String', + :'resubmit_allowed' => :'Boolean', + :'created_date_time' => :'Time', + :'modified_date_time' => :'Time', + :'submission' => :'TfvSubmissionInfo' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvStatus` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'phone_number') + self.phone_number = attributes[:'phone_number'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'internal_ticket_number') + self.internal_ticket_number = attributes[:'internal_ticket_number'] + end + + if attributes.key?(:'decline_reason_description') + self.decline_reason_description = attributes[:'decline_reason_description'] + end + + if attributes.key?(:'resubmit_allowed') + self.resubmit_allowed = attributes[:'resubmit_allowed'] + end + + if attributes.key?(:'created_date_time') + self.created_date_time = attributes[:'created_date_time'] + end + + if attributes.key?(:'modified_date_time') + self.modified_date_time = attributes[:'modified_date_time'] + end + + if attributes.key?(:'submission') + self.submission = attributes[:'submission'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@phone_number.nil? && @phone_number.to_s.length > 12 + invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.') + end + + if !@phone_number.nil? && @phone_number.to_s.length < 12 + invalid_properties.push('invalid value for "phone_number", the character length must be great than or equal to 12.') + end + + pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + if !@phone_number.nil? && @phone_number !~ pattern + invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@phone_number.nil? && @phone_number.to_s.length > 12 + return false if !@phone_number.nil? && @phone_number.to_s.length < 12 + return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] phone_number Value to be assigned + def phone_number=(phone_number) + if phone_number.nil? + fail ArgumentError, 'phone_number cannot be nil' + end + + if phone_number.to_s.length > 12 + fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.' + end + + if phone_number.to_s.length < 12 + fail ArgumentError, 'invalid value for "phone_number", the character length must be great than or equal to 12.' + end + + pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + if phone_number !~ pattern + fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}." + end + + @phone_number = phone_number + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + phone_number == o.phone_number && + status == o.status && + internal_ticket_number == o.internal_ticket_number && + decline_reason_description == o.decline_reason_description && + resubmit_allowed == o.resubmit_allowed && + created_date_time == o.created_date_time && + modified_date_time == o.modified_date_time && + submission == o.submission + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [phone_number, status, internal_ticket_number, decline_reason_description, resubmit_allowed, created_date_time, modified_date_time, submission].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/tfv_status_enum.rb b/lib/bandwidth-sdk/models/tfv_status_enum.rb new file mode 100644 index 00000000..c8143e0e --- /dev/null +++ b/lib/bandwidth-sdk/models/tfv_status_enum.rb @@ -0,0 +1,43 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class TfvStatusEnum + VERIFIED = 'VERIFIED'.freeze + UNVERIFIED = 'UNVERIFIED'.freeze + PENDING = 'PENDING'.freeze + PARTIALLY_VERIFIED = 'PARTIALLY_VERIFIED'.freeze + INVALID_STATUS = 'INVALID_STATUS'.freeze + + def self.all_vars + @all_vars ||= [VERIFIED, UNVERIFIED, PENDING, PARTIALLY_VERIFIED, INVALID_STATUS].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if TfvStatusEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #TfvStatusEnum" + end + end +end diff --git a/lib/bandwidth-sdk/models/tfv_submission_info.rb b/lib/bandwidth-sdk/models/tfv_submission_info.rb new file mode 100644 index 00000000..0a632c62 --- /dev/null +++ b/lib/bandwidth-sdk/models/tfv_submission_info.rb @@ -0,0 +1,452 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class TfvSubmissionInfo + attr_accessor :business_address + + attr_accessor :business_contact + + # Estimated monthly volume of messages from the toll-free number. + attr_accessor :message_volume + + # The category of the use case. + attr_accessor :use_case + + # A general idea of the use case and customer. + attr_accessor :use_case_summary + + # Example of message content. + attr_accessor :production_message_content + + attr_accessor :opt_in_workflow + + # Any additional information. + attr_accessor :additional_information + + # ISV name. + attr_accessor :isv_reseller + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'business_address' => :'businessAddress', + :'business_contact' => :'businessContact', + :'message_volume' => :'messageVolume', + :'use_case' => :'useCase', + :'use_case_summary' => :'useCaseSummary', + :'production_message_content' => :'productionMessageContent', + :'opt_in_workflow' => :'optInWorkflow', + :'additional_information' => :'additionalInformation', + :'isv_reseller' => :'isvReseller' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'business_address' => :'Address', + :'business_contact' => :'Contact', + :'message_volume' => :'Integer', + :'use_case' => :'String', + :'use_case_summary' => :'String', + :'production_message_content' => :'String', + :'opt_in_workflow' => :'OptInWorkflow', + :'additional_information' => :'String', + :'isv_reseller' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'additional_information', + :'isv_reseller' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvSubmissionInfo` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvSubmissionInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'business_address') + self.business_address = attributes[:'business_address'] + end + + if attributes.key?(:'business_contact') + self.business_contact = attributes[:'business_contact'] + end + + if attributes.key?(:'message_volume') + self.message_volume = attributes[:'message_volume'] + end + + if attributes.key?(:'use_case') + self.use_case = attributes[:'use_case'] + end + + if attributes.key?(:'use_case_summary') + self.use_case_summary = attributes[:'use_case_summary'] + end + + if attributes.key?(:'production_message_content') + self.production_message_content = attributes[:'production_message_content'] + end + + if attributes.key?(:'opt_in_workflow') + self.opt_in_workflow = attributes[:'opt_in_workflow'] + end + + if attributes.key?(:'additional_information') + self.additional_information = attributes[:'additional_information'] + end + + if attributes.key?(:'isv_reseller') + self.isv_reseller = attributes[:'isv_reseller'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@message_volume.nil? && @message_volume > 10000000 + invalid_properties.push('invalid value for "message_volume", must be smaller than or equal to 10000000.') + end + + if !@message_volume.nil? && @message_volume < 10 + invalid_properties.push('invalid value for "message_volume", must be greater than or equal to 10.') + end + + if !@use_case.nil? && @use_case.to_s.length > 500 + invalid_properties.push('invalid value for "use_case", the character length must be smaller than or equal to 500.') + end + + if !@use_case.nil? && @use_case.to_s.length < 0 + invalid_properties.push('invalid value for "use_case", the character length must be great than or equal to 0.') + end + + if !@use_case_summary.nil? && @use_case_summary.to_s.length > 500 + invalid_properties.push('invalid value for "use_case_summary", the character length must be smaller than or equal to 500.') + end + + if !@use_case_summary.nil? && @use_case_summary.to_s.length < 0 + invalid_properties.push('invalid value for "use_case_summary", the character length must be great than or equal to 0.') + end + + if !@production_message_content.nil? && @production_message_content.to_s.length > 500 + invalid_properties.push('invalid value for "production_message_content", the character length must be smaller than or equal to 500.') + end + + if !@production_message_content.nil? && @production_message_content.to_s.length < 0 + invalid_properties.push('invalid value for "production_message_content", the character length must be great than or equal to 0.') + end + + if !@additional_information.nil? && @additional_information.to_s.length > 500 + invalid_properties.push('invalid value for "additional_information", the character length must be smaller than or equal to 500.') + end + + if !@additional_information.nil? && @additional_information.to_s.length < 0 + invalid_properties.push('invalid value for "additional_information", the character length must be great than or equal to 0.') + end + + if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500 + invalid_properties.push('invalid value for "isv_reseller", the character length must be smaller than or equal to 500.') + end + + if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0 + invalid_properties.push('invalid value for "isv_reseller", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@message_volume.nil? && @message_volume > 10000000 + return false if !@message_volume.nil? && @message_volume < 10 + return false if !@use_case.nil? && @use_case.to_s.length > 500 + return false if !@use_case.nil? && @use_case.to_s.length < 0 + return false if !@use_case_summary.nil? && @use_case_summary.to_s.length > 500 + return false if !@use_case_summary.nil? && @use_case_summary.to_s.length < 0 + return false if !@production_message_content.nil? && @production_message_content.to_s.length > 500 + return false if !@production_message_content.nil? && @production_message_content.to_s.length < 0 + return false if !@additional_information.nil? && @additional_information.to_s.length > 500 + return false if !@additional_information.nil? && @additional_information.to_s.length < 0 + return false if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500 + return false if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] message_volume Value to be assigned + def message_volume=(message_volume) + if message_volume.nil? + fail ArgumentError, 'message_volume cannot be nil' + end + + if message_volume > 10000000 + fail ArgumentError, 'invalid value for "message_volume", must be smaller than or equal to 10000000.' + end + + if message_volume < 10 + fail ArgumentError, 'invalid value for "message_volume", must be greater than or equal to 10.' + end + + @message_volume = message_volume + end + + # Custom attribute writer method with validation + # @param [Object] use_case Value to be assigned + def use_case=(use_case) + if use_case.nil? + fail ArgumentError, 'use_case cannot be nil' + end + + if use_case.to_s.length > 500 + fail ArgumentError, 'invalid value for "use_case", the character length must be smaller than or equal to 500.' + end + + if use_case.to_s.length < 0 + fail ArgumentError, 'invalid value for "use_case", the character length must be great than or equal to 0.' + end + + @use_case = use_case + end + + # Custom attribute writer method with validation + # @param [Object] use_case_summary Value to be assigned + def use_case_summary=(use_case_summary) + if use_case_summary.nil? + fail ArgumentError, 'use_case_summary cannot be nil' + end + + if use_case_summary.to_s.length > 500 + fail ArgumentError, 'invalid value for "use_case_summary", the character length must be smaller than or equal to 500.' + end + + if use_case_summary.to_s.length < 0 + fail ArgumentError, 'invalid value for "use_case_summary", the character length must be great than or equal to 0.' + end + + @use_case_summary = use_case_summary + end + + # Custom attribute writer method with validation + # @param [Object] production_message_content Value to be assigned + def production_message_content=(production_message_content) + if production_message_content.nil? + fail ArgumentError, 'production_message_content cannot be nil' + end + + if production_message_content.to_s.length > 500 + fail ArgumentError, 'invalid value for "production_message_content", the character length must be smaller than or equal to 500.' + end + + if production_message_content.to_s.length < 0 + fail ArgumentError, 'invalid value for "production_message_content", the character length must be great than or equal to 0.' + end + + @production_message_content = production_message_content + end + + # Custom attribute writer method with validation + # @param [Object] additional_information Value to be assigned + def additional_information=(additional_information) + if !additional_information.nil? && additional_information.to_s.length > 500 + fail ArgumentError, 'invalid value for "additional_information", the character length must be smaller than or equal to 500.' + end + + if !additional_information.nil? && additional_information.to_s.length < 0 + fail ArgumentError, 'invalid value for "additional_information", the character length must be great than or equal to 0.' + end + + @additional_information = additional_information + end + + # Custom attribute writer method with validation + # @param [Object] isv_reseller Value to be assigned + def isv_reseller=(isv_reseller) + if !isv_reseller.nil? && isv_reseller.to_s.length > 500 + fail ArgumentError, 'invalid value for "isv_reseller", the character length must be smaller than or equal to 500.' + end + + if !isv_reseller.nil? && isv_reseller.to_s.length < 0 + fail ArgumentError, 'invalid value for "isv_reseller", the character length must be great than or equal to 0.' + end + + @isv_reseller = isv_reseller + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + business_address == o.business_address && + business_contact == o.business_contact && + message_volume == o.message_volume && + use_case == o.use_case && + use_case_summary == o.use_case_summary && + production_message_content == o.production_message_content && + opt_in_workflow == o.opt_in_workflow && + additional_information == o.additional_information && + isv_reseller == o.isv_reseller + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [business_address, business_contact, message_volume, use_case, use_case_summary, production_message_content, opt_in_workflow, additional_information, isv_reseller].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb b/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb new file mode 100644 index 00000000..e413c786 --- /dev/null +++ b/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb @@ -0,0 +1,212 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class TfvSubmissionWrapper + attr_accessor :submission + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'submission' => :'submission' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'submission' => :'VerificationUpdateRequest' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvSubmissionWrapper` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvSubmissionWrapper`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'submission') + self.submission = attributes[:'submission'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + submission == o.submission + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [submission].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/verification_denial_webhook.rb b/lib/bandwidth-sdk/models/verification_denial_webhook.rb new file mode 100644 index 00000000..2b95ea24 --- /dev/null +++ b/lib/bandwidth-sdk/models/verification_denial_webhook.rb @@ -0,0 +1,325 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class VerificationDenialWebhook + # User's account ID. + attr_accessor :account_id + + # An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. + attr_accessor :additional_denial_reasons + + # Explanation for why a verification request was declined. + attr_accessor :decline_reason_description + + # Reason code for denial. + attr_accessor :denial_status_code + + # Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + attr_accessor :internal_ticket_number + + # Toll-free telephone number in E.164 format. + attr_accessor :phone_number + + # Whether a Toll-Free Verification request qualifies for resubmission via PUT. + attr_accessor :resubmit_allowed + + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'accountId', + :'additional_denial_reasons' => :'additionalDenialReasons', + :'decline_reason_description' => :'declineReasonDescription', + :'denial_status_code' => :'denialStatusCode', + :'internal_ticket_number' => :'internalTicketNumber', + :'phone_number' => :'phoneNumber', + :'resubmit_allowed' => :'resubmitAllowed', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_id' => :'String', + :'additional_denial_reasons' => :'Array', + :'decline_reason_description' => :'String', + :'denial_status_code' => :'Integer', + :'internal_ticket_number' => :'String', + :'phone_number' => :'String', + :'resubmit_allowed' => :'Boolean', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerificationDenialWebhook` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerificationDenialWebhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'additional_denial_reasons') + if (value = attributes[:'additional_denial_reasons']).is_a?(Array) + self.additional_denial_reasons = value + end + end + + if attributes.key?(:'decline_reason_description') + self.decline_reason_description = attributes[:'decline_reason_description'] + end + + if attributes.key?(:'denial_status_code') + self.denial_status_code = attributes[:'denial_status_code'] + end + + if attributes.key?(:'internal_ticket_number') + self.internal_ticket_number = attributes[:'internal_ticket_number'] + end + + if attributes.key?(:'phone_number') + self.phone_number = attributes[:'phone_number'] + end + + if attributes.key?(:'resubmit_allowed') + self.resubmit_allowed = attributes[:'resubmit_allowed'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = 'UNVERIFIED' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@phone_number.nil? && @phone_number.to_s.length > 12 + invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.') + end + + if !@phone_number.nil? && @phone_number.to_s.length < 12 + invalid_properties.push('invalid value for "phone_number", the character length must be great than or equal to 12.') + end + + pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + if !@phone_number.nil? && @phone_number !~ pattern + invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@phone_number.nil? && @phone_number.to_s.length > 12 + return false if !@phone_number.nil? && @phone_number.to_s.length < 12 + return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] phone_number Value to be assigned + def phone_number=(phone_number) + if phone_number.nil? + fail ArgumentError, 'phone_number cannot be nil' + end + + if phone_number.to_s.length > 12 + fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.' + end + + if phone_number.to_s.length < 12 + fail ArgumentError, 'invalid value for "phone_number", the character length must be great than or equal to 12.' + end + + pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + if phone_number !~ pattern + fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}." + end + + @phone_number = phone_number + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + additional_denial_reasons == o.additional_denial_reasons && + decline_reason_description == o.decline_reason_description && + denial_status_code == o.denial_status_code && + internal_ticket_number == o.internal_ticket_number && + phone_number == o.phone_number && + resubmit_allowed == o.resubmit_allowed && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_id, additional_denial_reasons, decline_reason_description, denial_status_code, internal_ticket_number, phone_number, resubmit_allowed, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/verification_request.rb b/lib/bandwidth-sdk/models/verification_request.rb new file mode 100644 index 00000000..072f6c74 --- /dev/null +++ b/lib/bandwidth-sdk/models/verification_request.rb @@ -0,0 +1,547 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class VerificationRequest + attr_accessor :business_address + + attr_accessor :business_contact + + # Estimated monthly volume of messages from the toll-free number. + attr_accessor :message_volume + + attr_accessor :phone_numbers + + # The category of the use case. + attr_accessor :use_case + + # A general idea of the use case and customer. + attr_accessor :use_case_summary + + # Example of message content. + attr_accessor :production_message_content + + attr_accessor :opt_in_workflow + + # Any additional information. + attr_accessor :additional_information + + # ISV name. + attr_accessor :isv_reseller + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'business_address' => :'businessAddress', + :'business_contact' => :'businessContact', + :'message_volume' => :'messageVolume', + :'phone_numbers' => :'phoneNumbers', + :'use_case' => :'useCase', + :'use_case_summary' => :'useCaseSummary', + :'production_message_content' => :'productionMessageContent', + :'opt_in_workflow' => :'optInWorkflow', + :'additional_information' => :'additionalInformation', + :'isv_reseller' => :'isvReseller' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'business_address' => :'Address', + :'business_contact' => :'Contact', + :'message_volume' => :'Integer', + :'phone_numbers' => :'Array', + :'use_case' => :'String', + :'use_case_summary' => :'String', + :'production_message_content' => :'String', + :'opt_in_workflow' => :'OptInWorkflow', + :'additional_information' => :'String', + :'isv_reseller' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'additional_information', + :'isv_reseller' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerificationRequest` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerificationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'business_address') + self.business_address = attributes[:'business_address'] + else + self.business_address = nil + end + + if attributes.key?(:'business_contact') + self.business_contact = attributes[:'business_contact'] + else + self.business_contact = nil + end + + if attributes.key?(:'message_volume') + self.message_volume = attributes[:'message_volume'] + else + self.message_volume = nil + end + + if attributes.key?(:'phone_numbers') + if (value = attributes[:'phone_numbers']).is_a?(Array) + self.phone_numbers = value + end + else + self.phone_numbers = nil + end + + if attributes.key?(:'use_case') + self.use_case = attributes[:'use_case'] + else + self.use_case = nil + end + + if attributes.key?(:'use_case_summary') + self.use_case_summary = attributes[:'use_case_summary'] + else + self.use_case_summary = nil + end + + if attributes.key?(:'production_message_content') + self.production_message_content = attributes[:'production_message_content'] + else + self.production_message_content = nil + end + + if attributes.key?(:'opt_in_workflow') + self.opt_in_workflow = attributes[:'opt_in_workflow'] + else + self.opt_in_workflow = nil + end + + if attributes.key?(:'additional_information') + self.additional_information = attributes[:'additional_information'] + end + + if attributes.key?(:'isv_reseller') + self.isv_reseller = attributes[:'isv_reseller'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @business_address.nil? + invalid_properties.push('invalid value for "business_address", business_address cannot be nil.') + end + + if @business_contact.nil? + invalid_properties.push('invalid value for "business_contact", business_contact cannot be nil.') + end + + if @message_volume.nil? + invalid_properties.push('invalid value for "message_volume", message_volume cannot be nil.') + end + + if @message_volume > 10000000 + invalid_properties.push('invalid value for "message_volume", must be smaller than or equal to 10000000.') + end + + if @message_volume < 10 + invalid_properties.push('invalid value for "message_volume", must be greater than or equal to 10.') + end + + if @phone_numbers.nil? + invalid_properties.push('invalid value for "phone_numbers", phone_numbers cannot be nil.') + end + + if @phone_numbers.length > 10 + invalid_properties.push('invalid value for "phone_numbers", number of items must be less than or equal to 10.') + end + + if @phone_numbers.length < 1 + invalid_properties.push('invalid value for "phone_numbers", number of items must be greater than or equal to 1.') + end + + if @use_case.nil? + invalid_properties.push('invalid value for "use_case", use_case cannot be nil.') + end + + if @use_case.to_s.length > 500 + invalid_properties.push('invalid value for "use_case", the character length must be smaller than or equal to 500.') + end + + if @use_case.to_s.length < 0 + invalid_properties.push('invalid value for "use_case", the character length must be great than or equal to 0.') + end + + if @use_case_summary.nil? + invalid_properties.push('invalid value for "use_case_summary", use_case_summary cannot be nil.') + end + + if @use_case_summary.to_s.length > 500 + invalid_properties.push('invalid value for "use_case_summary", the character length must be smaller than or equal to 500.') + end + + if @use_case_summary.to_s.length < 1 + invalid_properties.push('invalid value for "use_case_summary", the character length must be great than or equal to 1.') + end + + if @production_message_content.nil? + invalid_properties.push('invalid value for "production_message_content", production_message_content cannot be nil.') + end + + if @production_message_content.to_s.length > 500 + invalid_properties.push('invalid value for "production_message_content", the character length must be smaller than or equal to 500.') + end + + if @production_message_content.to_s.length < 1 + invalid_properties.push('invalid value for "production_message_content", the character length must be great than or equal to 1.') + end + + if @opt_in_workflow.nil? + invalid_properties.push('invalid value for "opt_in_workflow", opt_in_workflow cannot be nil.') + end + + if !@additional_information.nil? && @additional_information.to_s.length > 500 + invalid_properties.push('invalid value for "additional_information", the character length must be smaller than or equal to 500.') + end + + if !@additional_information.nil? && @additional_information.to_s.length < 0 + invalid_properties.push('invalid value for "additional_information", the character length must be great than or equal to 0.') + end + + if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500 + invalid_properties.push('invalid value for "isv_reseller", the character length must be smaller than or equal to 500.') + end + + if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0 + invalid_properties.push('invalid value for "isv_reseller", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @business_address.nil? + return false if @business_contact.nil? + return false if @message_volume.nil? + return false if @message_volume > 10000000 + return false if @message_volume < 10 + return false if @phone_numbers.nil? + return false if @phone_numbers.length > 10 + return false if @phone_numbers.length < 1 + return false if @use_case.nil? + return false if @use_case.to_s.length > 500 + return false if @use_case.to_s.length < 0 + return false if @use_case_summary.nil? + return false if @use_case_summary.to_s.length > 500 + return false if @use_case_summary.to_s.length < 1 + return false if @production_message_content.nil? + return false if @production_message_content.to_s.length > 500 + return false if @production_message_content.to_s.length < 1 + return false if @opt_in_workflow.nil? + return false if !@additional_information.nil? && @additional_information.to_s.length > 500 + return false if !@additional_information.nil? && @additional_information.to_s.length < 0 + return false if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500 + return false if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] message_volume Value to be assigned + def message_volume=(message_volume) + if message_volume.nil? + fail ArgumentError, 'message_volume cannot be nil' + end + + if message_volume > 10000000 + fail ArgumentError, 'invalid value for "message_volume", must be smaller than or equal to 10000000.' + end + + if message_volume < 10 + fail ArgumentError, 'invalid value for "message_volume", must be greater than or equal to 10.' + end + + @message_volume = message_volume + end + + # Custom attribute writer method with validation + # @param [Object] phone_numbers Value to be assigned + def phone_numbers=(phone_numbers) + if phone_numbers.nil? + fail ArgumentError, 'phone_numbers cannot be nil' + end + + if phone_numbers.length > 10 + fail ArgumentError, 'invalid value for "phone_numbers", number of items must be less than or equal to 10.' + end + + if phone_numbers.length < 1 + fail ArgumentError, 'invalid value for "phone_numbers", number of items must be greater than or equal to 1.' + end + + @phone_numbers = phone_numbers + end + + # Custom attribute writer method with validation + # @param [Object] use_case Value to be assigned + def use_case=(use_case) + if use_case.nil? + fail ArgumentError, 'use_case cannot be nil' + end + + if use_case.to_s.length > 500 + fail ArgumentError, 'invalid value for "use_case", the character length must be smaller than or equal to 500.' + end + + if use_case.to_s.length < 0 + fail ArgumentError, 'invalid value for "use_case", the character length must be great than or equal to 0.' + end + + @use_case = use_case + end + + # Custom attribute writer method with validation + # @param [Object] use_case_summary Value to be assigned + def use_case_summary=(use_case_summary) + if use_case_summary.nil? + fail ArgumentError, 'use_case_summary cannot be nil' + end + + if use_case_summary.to_s.length > 500 + fail ArgumentError, 'invalid value for "use_case_summary", the character length must be smaller than or equal to 500.' + end + + if use_case_summary.to_s.length < 1 + fail ArgumentError, 'invalid value for "use_case_summary", the character length must be great than or equal to 1.' + end + + @use_case_summary = use_case_summary + end + + # Custom attribute writer method with validation + # @param [Object] production_message_content Value to be assigned + def production_message_content=(production_message_content) + if production_message_content.nil? + fail ArgumentError, 'production_message_content cannot be nil' + end + + if production_message_content.to_s.length > 500 + fail ArgumentError, 'invalid value for "production_message_content", the character length must be smaller than or equal to 500.' + end + + if production_message_content.to_s.length < 1 + fail ArgumentError, 'invalid value for "production_message_content", the character length must be great than or equal to 1.' + end + + @production_message_content = production_message_content + end + + # Custom attribute writer method with validation + # @param [Object] additional_information Value to be assigned + def additional_information=(additional_information) + if !additional_information.nil? && additional_information.to_s.length > 500 + fail ArgumentError, 'invalid value for "additional_information", the character length must be smaller than or equal to 500.' + end + + if !additional_information.nil? && additional_information.to_s.length < 0 + fail ArgumentError, 'invalid value for "additional_information", the character length must be great than or equal to 0.' + end + + @additional_information = additional_information + end + + # Custom attribute writer method with validation + # @param [Object] isv_reseller Value to be assigned + def isv_reseller=(isv_reseller) + if !isv_reseller.nil? && isv_reseller.to_s.length > 500 + fail ArgumentError, 'invalid value for "isv_reseller", the character length must be smaller than or equal to 500.' + end + + if !isv_reseller.nil? && isv_reseller.to_s.length < 0 + fail ArgumentError, 'invalid value for "isv_reseller", the character length must be great than or equal to 0.' + end + + @isv_reseller = isv_reseller + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + business_address == o.business_address && + business_contact == o.business_contact && + message_volume == o.message_volume && + phone_numbers == o.phone_numbers && + use_case == o.use_case && + use_case_summary == o.use_case_summary && + production_message_content == o.production_message_content && + opt_in_workflow == o.opt_in_workflow && + additional_information == o.additional_information && + isv_reseller == o.isv_reseller + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [business_address, business_contact, message_volume, phone_numbers, use_case, use_case_summary, production_message_content, opt_in_workflow, additional_information, isv_reseller].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/verification_update_request.rb b/lib/bandwidth-sdk/models/verification_update_request.rb new file mode 100644 index 00000000..337e83a0 --- /dev/null +++ b/lib/bandwidth-sdk/models/verification_update_request.rb @@ -0,0 +1,501 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class VerificationUpdateRequest + attr_accessor :business_address + + attr_accessor :business_contact + + # Estimated monthly volume of messages from the toll-free number. + attr_accessor :message_volume + + # The category of the use case. + attr_accessor :use_case + + # A general idea of the use case and customer. + attr_accessor :use_case_summary + + # Example of message content. + attr_accessor :production_message_content + + attr_accessor :opt_in_workflow + + # Any additional information. + attr_accessor :additional_information + + # ISV name. + attr_accessor :isv_reseller + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'business_address' => :'businessAddress', + :'business_contact' => :'businessContact', + :'message_volume' => :'messageVolume', + :'use_case' => :'useCase', + :'use_case_summary' => :'useCaseSummary', + :'production_message_content' => :'productionMessageContent', + :'opt_in_workflow' => :'optInWorkflow', + :'additional_information' => :'additionalInformation', + :'isv_reseller' => :'isvReseller' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'business_address' => :'Address', + :'business_contact' => :'Contact', + :'message_volume' => :'Integer', + :'use_case' => :'String', + :'use_case_summary' => :'String', + :'production_message_content' => :'String', + :'opt_in_workflow' => :'OptInWorkflow', + :'additional_information' => :'String', + :'isv_reseller' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'additional_information', + :'isv_reseller' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerificationUpdateRequest` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerificationUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'business_address') + self.business_address = attributes[:'business_address'] + else + self.business_address = nil + end + + if attributes.key?(:'business_contact') + self.business_contact = attributes[:'business_contact'] + else + self.business_contact = nil + end + + if attributes.key?(:'message_volume') + self.message_volume = attributes[:'message_volume'] + else + self.message_volume = nil + end + + if attributes.key?(:'use_case') + self.use_case = attributes[:'use_case'] + else + self.use_case = nil + end + + if attributes.key?(:'use_case_summary') + self.use_case_summary = attributes[:'use_case_summary'] + else + self.use_case_summary = nil + end + + if attributes.key?(:'production_message_content') + self.production_message_content = attributes[:'production_message_content'] + else + self.production_message_content = nil + end + + if attributes.key?(:'opt_in_workflow') + self.opt_in_workflow = attributes[:'opt_in_workflow'] + else + self.opt_in_workflow = nil + end + + if attributes.key?(:'additional_information') + self.additional_information = attributes[:'additional_information'] + end + + if attributes.key?(:'isv_reseller') + self.isv_reseller = attributes[:'isv_reseller'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @business_address.nil? + invalid_properties.push('invalid value for "business_address", business_address cannot be nil.') + end + + if @business_contact.nil? + invalid_properties.push('invalid value for "business_contact", business_contact cannot be nil.') + end + + if @message_volume.nil? + invalid_properties.push('invalid value for "message_volume", message_volume cannot be nil.') + end + + if @message_volume > 10000000 + invalid_properties.push('invalid value for "message_volume", must be smaller than or equal to 10000000.') + end + + if @message_volume < 10 + invalid_properties.push('invalid value for "message_volume", must be greater than or equal to 10.') + end + + if @use_case.nil? + invalid_properties.push('invalid value for "use_case", use_case cannot be nil.') + end + + if @use_case.to_s.length > 500 + invalid_properties.push('invalid value for "use_case", the character length must be smaller than or equal to 500.') + end + + if @use_case.to_s.length < 0 + invalid_properties.push('invalid value for "use_case", the character length must be great than or equal to 0.') + end + + if @use_case_summary.nil? + invalid_properties.push('invalid value for "use_case_summary", use_case_summary cannot be nil.') + end + + if @use_case_summary.to_s.length > 500 + invalid_properties.push('invalid value for "use_case_summary", the character length must be smaller than or equal to 500.') + end + + if @use_case_summary.to_s.length < 0 + invalid_properties.push('invalid value for "use_case_summary", the character length must be great than or equal to 0.') + end + + if @production_message_content.nil? + invalid_properties.push('invalid value for "production_message_content", production_message_content cannot be nil.') + end + + if @production_message_content.to_s.length > 500 + invalid_properties.push('invalid value for "production_message_content", the character length must be smaller than or equal to 500.') + end + + if @production_message_content.to_s.length < 0 + invalid_properties.push('invalid value for "production_message_content", the character length must be great than or equal to 0.') + end + + if @opt_in_workflow.nil? + invalid_properties.push('invalid value for "opt_in_workflow", opt_in_workflow cannot be nil.') + end + + if !@additional_information.nil? && @additional_information.to_s.length > 500 + invalid_properties.push('invalid value for "additional_information", the character length must be smaller than or equal to 500.') + end + + if !@additional_information.nil? && @additional_information.to_s.length < 0 + invalid_properties.push('invalid value for "additional_information", the character length must be great than or equal to 0.') + end + + if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500 + invalid_properties.push('invalid value for "isv_reseller", the character length must be smaller than or equal to 500.') + end + + if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0 + invalid_properties.push('invalid value for "isv_reseller", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @business_address.nil? + return false if @business_contact.nil? + return false if @message_volume.nil? + return false if @message_volume > 10000000 + return false if @message_volume < 10 + return false if @use_case.nil? + return false if @use_case.to_s.length > 500 + return false if @use_case.to_s.length < 0 + return false if @use_case_summary.nil? + return false if @use_case_summary.to_s.length > 500 + return false if @use_case_summary.to_s.length < 0 + return false if @production_message_content.nil? + return false if @production_message_content.to_s.length > 500 + return false if @production_message_content.to_s.length < 0 + return false if @opt_in_workflow.nil? + return false if !@additional_information.nil? && @additional_information.to_s.length > 500 + return false if !@additional_information.nil? && @additional_information.to_s.length < 0 + return false if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500 + return false if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] message_volume Value to be assigned + def message_volume=(message_volume) + if message_volume.nil? + fail ArgumentError, 'message_volume cannot be nil' + end + + if message_volume > 10000000 + fail ArgumentError, 'invalid value for "message_volume", must be smaller than or equal to 10000000.' + end + + if message_volume < 10 + fail ArgumentError, 'invalid value for "message_volume", must be greater than or equal to 10.' + end + + @message_volume = message_volume + end + + # Custom attribute writer method with validation + # @param [Object] use_case Value to be assigned + def use_case=(use_case) + if use_case.nil? + fail ArgumentError, 'use_case cannot be nil' + end + + if use_case.to_s.length > 500 + fail ArgumentError, 'invalid value for "use_case", the character length must be smaller than or equal to 500.' + end + + if use_case.to_s.length < 0 + fail ArgumentError, 'invalid value for "use_case", the character length must be great than or equal to 0.' + end + + @use_case = use_case + end + + # Custom attribute writer method with validation + # @param [Object] use_case_summary Value to be assigned + def use_case_summary=(use_case_summary) + if use_case_summary.nil? + fail ArgumentError, 'use_case_summary cannot be nil' + end + + if use_case_summary.to_s.length > 500 + fail ArgumentError, 'invalid value for "use_case_summary", the character length must be smaller than or equal to 500.' + end + + if use_case_summary.to_s.length < 0 + fail ArgumentError, 'invalid value for "use_case_summary", the character length must be great than or equal to 0.' + end + + @use_case_summary = use_case_summary + end + + # Custom attribute writer method with validation + # @param [Object] production_message_content Value to be assigned + def production_message_content=(production_message_content) + if production_message_content.nil? + fail ArgumentError, 'production_message_content cannot be nil' + end + + if production_message_content.to_s.length > 500 + fail ArgumentError, 'invalid value for "production_message_content", the character length must be smaller than or equal to 500.' + end + + if production_message_content.to_s.length < 0 + fail ArgumentError, 'invalid value for "production_message_content", the character length must be great than or equal to 0.' + end + + @production_message_content = production_message_content + end + + # Custom attribute writer method with validation + # @param [Object] additional_information Value to be assigned + def additional_information=(additional_information) + if !additional_information.nil? && additional_information.to_s.length > 500 + fail ArgumentError, 'invalid value for "additional_information", the character length must be smaller than or equal to 500.' + end + + if !additional_information.nil? && additional_information.to_s.length < 0 + fail ArgumentError, 'invalid value for "additional_information", the character length must be great than or equal to 0.' + end + + @additional_information = additional_information + end + + # Custom attribute writer method with validation + # @param [Object] isv_reseller Value to be assigned + def isv_reseller=(isv_reseller) + if !isv_reseller.nil? && isv_reseller.to_s.length > 500 + fail ArgumentError, 'invalid value for "isv_reseller", the character length must be smaller than or equal to 500.' + end + + if !isv_reseller.nil? && isv_reseller.to_s.length < 0 + fail ArgumentError, 'invalid value for "isv_reseller", the character length must be great than or equal to 0.' + end + + @isv_reseller = isv_reseller + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + business_address == o.business_address && + business_contact == o.business_contact && + message_volume == o.message_volume && + use_case == o.use_case && + use_case_summary == o.use_case_summary && + production_message_content == o.production_message_content && + opt_in_workflow == o.opt_in_workflow && + additional_information == o.additional_information && + isv_reseller == o.isv_reseller + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [business_address, business_contact, message_volume, use_case, use_case_summary, production_message_content, opt_in_workflow, additional_information, isv_reseller].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/verification_webhook.rb b/lib/bandwidth-sdk/models/verification_webhook.rb new file mode 100644 index 00000000..23472a1c --- /dev/null +++ b/lib/bandwidth-sdk/models/verification_webhook.rb @@ -0,0 +1,303 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class VerificationWebhook + # User's account ID. + attr_accessor :account_id + + # Toll-free telephone number in E.164 format. + attr_accessor :phone_number + + attr_accessor :status + + # Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + attr_accessor :internal_ticket_number + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'accountId', + :'phone_number' => :'phoneNumber', + :'status' => :'status', + :'internal_ticket_number' => :'internalTicketNumber' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_id' => :'String', + :'phone_number' => :'String', + :'status' => :'TfvCallbackStatusEnum', + :'internal_ticket_number' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerificationWebhook` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerificationWebhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'phone_number') + self.phone_number = attributes[:'phone_number'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'internal_ticket_number') + self.internal_ticket_number = attributes[:'internal_ticket_number'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@phone_number.nil? && @phone_number.to_s.length > 12 + invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.') + end + + if !@phone_number.nil? && @phone_number.to_s.length < 12 + invalid_properties.push('invalid value for "phone_number", the character length must be great than or equal to 12.') + end + + pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + if !@phone_number.nil? && @phone_number !~ pattern + invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@phone_number.nil? && @phone_number.to_s.length > 12 + return false if !@phone_number.nil? && @phone_number.to_s.length < 12 + return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] phone_number Value to be assigned + def phone_number=(phone_number) + if phone_number.nil? + fail ArgumentError, 'phone_number cannot be nil' + end + + if phone_number.to_s.length > 12 + fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.' + end + + if phone_number.to_s.length < 12 + fail ArgumentError, 'invalid value for "phone_number", the character length must be great than or equal to 12.' + end + + pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + if phone_number !~ pattern + fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}." + end + + @phone_number = phone_number + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + phone_number == o.phone_number && + status == o.status && + internal_ticket_number == o.internal_ticket_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_id, phone_number, status, internal_ticket_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/webhook_subscription.rb b/lib/bandwidth-sdk/models/webhook_subscription.rb new file mode 100644 index 00000000..01e6efd5 --- /dev/null +++ b/lib/bandwidth-sdk/models/webhook_subscription.rb @@ -0,0 +1,328 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + # Information about a webhook that Bandwidth should send upon the completion of event customer has subscribed to. + class WebhookSubscription + attr_accessor :id + + attr_accessor :account_id + + # Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. + attr_accessor :callback_url + + attr_accessor :type + + attr_accessor :basic_authentication + + attr_accessor :created_date + + attr_accessor :modified_date + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'account_id' => :'accountId', + :'callback_url' => :'callbackUrl', + :'type' => :'type', + :'basic_authentication' => :'basicAuthentication', + :'created_date' => :'createdDate', + :'modified_date' => :'modifiedDate' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'account_id' => :'String', + :'callback_url' => :'String', + :'type' => :'WebhookSubscriptionTypeEnum', + :'basic_authentication' => :'WebhookSubscriptionBasicAuthentication', + :'created_date' => :'Time', + :'modified_date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'callback_url', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::WebhookSubscription` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::WebhookSubscription`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'callback_url') + self.callback_url = attributes[:'callback_url'] + else + self.callback_url = nil + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'basic_authentication') + self.basic_authentication = attributes[:'basic_authentication'] + end + + if attributes.key?(:'created_date') + self.created_date = attributes[:'created_date'] + end + + if attributes.key?(:'modified_date') + self.modified_date = attributes[:'modified_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @callback_url.to_s.length > 2000 + invalid_properties.push('invalid value for "callback_url", the character length must be smaller than or equal to 2000.') + end + + if @callback_url.to_s.length < 0 + invalid_properties.push('invalid value for "callback_url", the character length must be great than or equal to 0.') + end + + pattern = Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/) + if @callback_url !~ pattern + invalid_properties.push("invalid value for \"callback_url\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @callback_url.to_s.length > 2000 + return false if @callback_url.to_s.length < 0 + return false if @callback_url !~ Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/) + true + end + + # Custom attribute writer method with validation + # @param [Object] callback_url Value to be assigned + def callback_url=(callback_url) + if !callback_url.nil? && callback_url.to_s.length > 2000 + fail ArgumentError, 'invalid value for "callback_url", the character length must be smaller than or equal to 2000.' + end + + if !callback_url.nil? && callback_url.to_s.length < 0 + fail ArgumentError, 'invalid value for "callback_url", the character length must be great than or equal to 0.' + end + + pattern = Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/) + if !callback_url.nil? && callback_url !~ pattern + fail ArgumentError, "invalid value for \"callback_url\", must conform to the pattern #{pattern}." + end + + @callback_url = callback_url + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + account_id == o.account_id && + callback_url == o.callback_url && + type == o.type && + basic_authentication == o.basic_authentication && + created_date == o.created_date && + modified_date == o.modified_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, account_id, callback_url, type, basic_authentication, created_date, modified_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb b/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb new file mode 100644 index 00000000..665b2532 --- /dev/null +++ b/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb @@ -0,0 +1,274 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + # Basic authentication credentials are not required, but if present, both username and password must be provided. + class WebhookSubscriptionBasicAuthentication + attr_accessor :username + + attr_accessor :password + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'username' => :'username', + :'password' => :'password' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'username' => :'String', + :'password' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::WebhookSubscriptionBasicAuthentication` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::WebhookSubscriptionBasicAuthentication`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'username') + self.username = attributes[:'username'] + else + self.username = nil + end + + if attributes.key?(:'password') + self.password = attributes[:'password'] + else + self.password = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @username.nil? + invalid_properties.push('invalid value for "username", username cannot be nil.') + end + + if @username.to_s.length > 100 + invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 100.') + end + + if @password.nil? + invalid_properties.push('invalid value for "password", password cannot be nil.') + end + + if @password.to_s.length > 200 + invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 200.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @username.nil? + return false if @username.to_s.length > 100 + return false if @password.nil? + return false if @password.to_s.length > 200 + true + end + + # Custom attribute writer method with validation + # @param [Object] username Value to be assigned + def username=(username) + if username.nil? + fail ArgumentError, 'username cannot be nil' + end + + if username.to_s.length > 100 + fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 100.' + end + + @username = username + end + + # Custom attribute writer method with validation + # @param [Object] password Value to be assigned + def password=(password) + if password.nil? + fail ArgumentError, 'password cannot be nil' + end + + if password.to_s.length > 200 + fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 200.' + end + + @password = password + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + username == o.username && + password == o.password + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [username, password].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb b/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb new file mode 100644 index 00000000..250af09b --- /dev/null +++ b/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb @@ -0,0 +1,306 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class WebhookSubscriptionRequestSchema + attr_accessor :basic_authentication + + # Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. + attr_accessor :callback_url + + # An ASCII string submitted by the user as a shared secret key for generating an HMAC header for callbacks. + attr_accessor :shared_secret_key + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'basic_authentication' => :'basicAuthentication', + :'callback_url' => :'callbackUrl', + :'shared_secret_key' => :'sharedSecretKey' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'basic_authentication' => :'TfvBasicAuthentication', + :'callback_url' => :'String', + :'shared_secret_key' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'callback_url', + :'shared_secret_key' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::WebhookSubscriptionRequestSchema` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::WebhookSubscriptionRequestSchema`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'basic_authentication') + self.basic_authentication = attributes[:'basic_authentication'] + end + + if attributes.key?(:'callback_url') + self.callback_url = attributes[:'callback_url'] + else + self.callback_url = nil + end + + if attributes.key?(:'shared_secret_key') + self.shared_secret_key = attributes[:'shared_secret_key'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @callback_url.to_s.length > 2000 + invalid_properties.push('invalid value for "callback_url", the character length must be smaller than or equal to 2000.') + end + + if @callback_url.to_s.length < 0 + invalid_properties.push('invalid value for "callback_url", the character length must be great than or equal to 0.') + end + + pattern = Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/) + if @callback_url !~ pattern + invalid_properties.push("invalid value for \"callback_url\", must conform to the pattern #{pattern}.") + end + + if !@shared_secret_key.nil? && @shared_secret_key.to_s.length > 64 + invalid_properties.push('invalid value for "shared_secret_key", the character length must be smaller than or equal to 64.') + end + + if !@shared_secret_key.nil? && @shared_secret_key.to_s.length < 16 + invalid_properties.push('invalid value for "shared_secret_key", the character length must be great than or equal to 16.') + end + + pattern = Regexp.new(/^[ -~]{16,64}$/) + if !@shared_secret_key.nil? && @shared_secret_key !~ pattern + invalid_properties.push("invalid value for \"shared_secret_key\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @callback_url.to_s.length > 2000 + return false if @callback_url.to_s.length < 0 + return false if @callback_url !~ Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/) + return false if !@shared_secret_key.nil? && @shared_secret_key.to_s.length > 64 + return false if !@shared_secret_key.nil? && @shared_secret_key.to_s.length < 16 + return false if !@shared_secret_key.nil? && @shared_secret_key !~ Regexp.new(/^[ -~]{16,64}$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] callback_url Value to be assigned + def callback_url=(callback_url) + if !callback_url.nil? && callback_url.to_s.length > 2000 + fail ArgumentError, 'invalid value for "callback_url", the character length must be smaller than or equal to 2000.' + end + + if !callback_url.nil? && callback_url.to_s.length < 0 + fail ArgumentError, 'invalid value for "callback_url", the character length must be great than or equal to 0.' + end + + pattern = Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/) + if !callback_url.nil? && callback_url !~ pattern + fail ArgumentError, "invalid value for \"callback_url\", must conform to the pattern #{pattern}." + end + + @callback_url = callback_url + end + + # Custom attribute writer method with validation + # @param [Object] shared_secret_key Value to be assigned + def shared_secret_key=(shared_secret_key) + if !shared_secret_key.nil? && shared_secret_key.to_s.length > 64 + fail ArgumentError, 'invalid value for "shared_secret_key", the character length must be smaller than or equal to 64.' + end + + if !shared_secret_key.nil? && shared_secret_key.to_s.length < 16 + fail ArgumentError, 'invalid value for "shared_secret_key", the character length must be great than or equal to 16.' + end + + pattern = Regexp.new(/^[ -~]{16,64}$/) + if !shared_secret_key.nil? && shared_secret_key !~ pattern + fail ArgumentError, "invalid value for \"shared_secret_key\", must conform to the pattern #{pattern}." + end + + @shared_secret_key = shared_secret_key + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + basic_authentication == o.basic_authentication && + callback_url == o.callback_url && + shared_secret_key == o.shared_secret_key + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [basic_authentication, callback_url, shared_secret_key].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb b/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb new file mode 100644 index 00000000..c9a7b765 --- /dev/null +++ b/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb @@ -0,0 +1,40 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class WebhookSubscriptionTypeEnum + TOLLFREE_VERIFICATION_STATUS = 'TOLLFREE_VERIFICATION_STATUS'.freeze + MESSAGING_PORTOUT_APPROVAL_STATUS = 'MESSAGING_PORTOUT_APPROVAL_STATUS'.freeze + + def self.all_vars + @all_vars ||= [TOLLFREE_VERIFICATION_STATUS, MESSAGING_PORTOUT_APPROVAL_STATUS].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if WebhookSubscriptionTypeEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #WebhookSubscriptionTypeEnum" + end + end +end diff --git a/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb b/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb new file mode 100644 index 00000000..e35aa8c3 --- /dev/null +++ b/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb @@ -0,0 +1,242 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + # A list of all webhook subscriptions registered for this account ID for this particular feature (unpaginated). + class WebhookSubscriptionsListBody + attr_accessor :links + + attr_accessor :errors + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'links' => :'links', + :'errors' => :'errors', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'links' => :'LinksObject', + :'errors' => :'Array', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::WebhookSubscriptionsListBody` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::WebhookSubscriptionsListBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'links') + self.links = attributes[:'links'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + else + self.data = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @data.nil? + invalid_properties.push('invalid value for "data", data cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @data.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + links == o.links && + errors == o.errors && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [links, errors, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/version.rb b/lib/bandwidth-sdk/version.rb index fff09434..41b71509 100644 --- a/lib/bandwidth-sdk/version.rb +++ b/lib/bandwidth-sdk/version.rb @@ -11,5 +11,5 @@ =end module Bandwidth - VERSION = '1.0.0-dev' + VERSION = '1.0.0' end diff --git a/openapi-config.yml b/openapi-config.yml index c19e56ee..b0fa9345 100644 --- a/openapi-config.yml +++ b/openapi-config.yml @@ -6,7 +6,7 @@ gemLicense: MIT gemName: bandwidth-sdk gemRequiredRubyVersion: '>=2.7' gemSummary: Bandwidth Ruby SDK -gemVersion: 11.0.0 +gemVersion: 1.0.0 library: faraday moduleName: Bandwidth templateDir: custom_templates diff --git a/spec/call_utils.rb b/spec/call_utils.rb index 9832aad7..0a97ea4f 100644 --- a/spec/call_utils.rb +++ b/spec/call_utils.rb @@ -41,13 +41,13 @@ def get_manteca_test_status(test_id) def cleanup_calls(calls, calls_api) attempts = 0 - while (calls.length > 0 && attempts < 10) + while (calls&.length > 0 && attempts < 10) calls.delete_if { |call_id| call_ended(call_id, calls_api) } sleep(SLEEP_TIME_S) attempts += 1 end - if (calls.length > 0) + if (calls&.length > 0) error_message = 'Failed to terminate all calls' + calls.to_s raise StandardError.new error_message end diff --git a/spec/smoke/toll_free_verification_api_spec.rb b/spec/smoke/toll_free_verification_api_spec.rb new file mode 100644 index 00000000..84243c5e --- /dev/null +++ b/spec/smoke/toll_free_verification_api_spec.rb @@ -0,0 +1,69 @@ +# Integration tests for Bandwidth::TollFreeVerificationApi +describe 'TollFreeVerificationApi' do + before(:all) do + Bandwidth.configure do |config| + config.username = BW_USERNAME + config.password = BW_PASSWORD + end + @tfv_api_instance = Bandwidth::TollFreeVerificationApi.new + end + + # Create Webhook Subscription + describe 'create_webhook_subscription test' do + it 'creates webhook subscription' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # Delete Webhook Subscription + describe 'delete_webhook_subscription test' do + it 'deletes webhook subscription' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # Get Toll-Free Verification Status + describe 'get_toll_free_verification_status test' do + it 'gets toll free verification status' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # List Toll-Free Use Cases + describe 'list_toll_free_use_cases test' do + it 'lists toll free use cases' do + data, status_code = @tfv_api_instance.list_toll_free_use_cases_with_http_info + + expect(status_code).to eq(200) + expect(data).to be_instance_of(Array) + end + end + + # List Webhook Subscriptions + describe 'list_webhook_subscriptions test' do + it 'lists webhook subscriptions' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # Request Toll-Free Verification + describe 'request_toll_free_verification test' do + it 'requests toll free verification' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # Update Toll-Free Verification Request + describe 'update_toll_free_verification_request test' do + it 'updates toll free verification request' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # Update Webhook Subscription + describe 'update_webhook_subscription test' do + it 'updates webhook subscription' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bf28477e..a790b41f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,7 +17,7 @@ end add_group 'Models', 'lib/bandwidth-sdk/models/' add_group 'APIs', 'lib/bandwidth-sdk/api/' - add_group 'Client', ['api_client.rb', 'api_error.rb', 'configuration.rb', 'bandwidth-sdk.rb'] + add_group 'Client', ['api_client.rb', 'api_error.rb', 'configuration.rb', 'version.rb', 'bandwidth-sdk.rb'] add_group 'Tests', 'spec' end diff --git a/spec/unit/api/mfa_api_spec.rb b/spec/unit/api/mfa_api_spec.rb index 64035661..c15b1ccf 100644 --- a/spec/unit/api/mfa_api_spec.rb +++ b/spec/unit/api/mfa_api_spec.rb @@ -105,7 +105,7 @@ }.to raise_error(ArgumentError) end - it 'causes an ArgumentError for a missing cvarify_ode_request' do + it 'causes an ArgumentError for a missing verify_code_request' do expect { @mfa_api_instance.verify_code(BW_ACCOUNT_ID, nil) }.to raise_error(ArgumentError) diff --git a/spec/unit/api/toll_free_verification_api_spec.rb b/spec/unit/api/toll_free_verification_api_spec.rb new file mode 100644 index 00000000..483f2e6a --- /dev/null +++ b/spec/unit/api/toll_free_verification_api_spec.rb @@ -0,0 +1,278 @@ +# Unit tests for Bandwidth::TollFreeVerificationApi +describe 'TollFreeVerificationApi' do + let (:webhook_subscription_request_schema) { Bandwidth::WebhookSubscriptionRequestSchema.new( + basic_authentication: { + username: 'username', + password: 'password' + }, + callback_url: 'https://example.com', + shared_secret_key: 'shared-secret-key' + ) } + let (:verification) { { + business_address: Bandwidth::Address.new( + name: 'name', + addr1: 'addr1', + addr2: 'addr2', + city: 'city', + state: 'state', + zip: 'zip', + url: 'https://example.com' + ), + business_contact: Bandwidth::Contact.new( + first_name: 'first-name', + last_name: 'last-name', + email: 'email@email.com', + phone_number: '+19195551234' + ), + message_volume: 12, + use_case: 'useCase', + use_case_summary: 'useCaseSummary', + production_message_content: 'productionMessageContent', + opt_in_workflow: Bandwidth::OptInWorkflow.new( + description: 'description', + image_urls: ['https://example.com'] + ), + additional_information: 'additionalInformation', + isv_reseller: 'isvReseller' + } } + let (:subscription_id) { 'test-id-1234' } + let (:tf_phone_number) { '+18005551234' } + + before(:all) do + Bandwidth.configure do |config| + config.debugging = true + config.username = BW_USERNAME + config.password = BW_PASSWORD + config.ignore_operation_servers = true + config.host = '127.0.0.1:4010' + end + @tfv_api_instance = Bandwidth::TollFreeVerificationApi.new + end + + describe 'test an instance of TollFreeVerificationApi' do + it 'should create an instance of TollFreeVerificationApi' do + expect(@tfv_api_instance).to be_instance_of(Bandwidth::TollFreeVerificationApi) + end + end + + # Create Webhook Subscription + describe 'create_webhook_subscription test' do + it 'creates webhook subscription' do + data, status_code = @tfv_api_instance.create_webhook_subscription_with_http_info(BW_ACCOUNT_ID, webhook_subscription_request_schema) + + expect(status_code).to eq(201) + expect(data).to be_instance_of(Bandwidth::WebhookSubscription) + expect(data.id).to be_instance_of(String) + expect(data.account_id.length).to eq(7) + expect(data.callback_url).to be_instance_of(String) + expect(data.type).to be_one_of(Bandwidth::WebhookSubscriptionTypeEnum.all_vars) + expect(data.basic_authentication).to be_instance_of(Bandwidth::WebhookSubscriptionBasicAuthentication) + expect(data.basic_authentication.username).to be_instance_of(String) + expect(data.basic_authentication.password).to be_instance_of(String) + expect(data.created_date).to be_instance_of(Time) + expect(data.modified_date).to be_instance_of(Time) + end + + it 'causes an ArgumentError for a missing account_id' do + expect { + @tfv_api_instance.create_webhook_subscription(nil, {}) + }.to raise_error(ArgumentError) + end + + it 'causes an ArgumentError for a missing webhook_subscription_request_schema' do + expect { + @tfv_api_instance.create_webhook_subscription(BW_ACCOUNT_ID, nil) + }.to raise_error(ArgumentError) + end + end + + # Delete Webhook Subscription + describe 'delete_webhook_subscription test' do + it 'deletes webhook subscription' do + _data, status_code = @tfv_api_instance.delete_webhook_subscription_with_http_info(BW_ACCOUNT_ID, subscription_id) + + expect(status_code).to eq(204) + end + + it 'causes an ArgumentError for a missing account_id' do + expect { + @tfv_api_instance.delete_webhook_subscription(nil, subscription_id) + }.to raise_error(ArgumentError) + end + + it 'causes an ArgumentError for a missing subscription_id' do + expect { + @tfv_api_instance.delete_webhook_subscription(BW_ACCOUNT_ID, nil) + }.to raise_error(ArgumentError) + end + end + + # Get Toll-Free Verification Status + describe 'get_toll_free_verification_status test' do + it 'gets toll free verification status' do + data, status_code = @tfv_api_instance.get_toll_free_verification_status_with_http_info(BW_ACCOUNT_ID, tf_phone_number) + + expect(status_code).to eq(200) + expect(data).to be_instance_of(Bandwidth::TfvStatus) + expect(data.phone_number).to be_instance_of(String) + expect(data.status).to be_one_of(Bandwidth::TfvStatusEnum.all_vars) + expect(data.internal_ticket_number).to be_instance_of(String) + expect(data.decline_reason_description).to be_instance_of(String) + expect(data.resubmit_allowed).to be_one_of([true, false]) + expect(data.created_date_time).to be_instance_of(Time) + expect(data.modified_date_time).to be_instance_of(Time) + end + + it 'causes an ArgumentError for a missing account_id' do + expect { + @tfv_api_instance.get_toll_free_verification_status(nil, tf_phone_number) + }.to raise_error(ArgumentError) + end + + it 'causes an ArgumentError for a missing phone_number' do + expect { + @tfv_api_instance.get_toll_free_verification_status(BW_ACCOUNT_ID, nil) + }.to raise_error(ArgumentError) + end + end + + # List Toll-Free Use Cases + describe 'list_toll_free_use_cases test' do + it 'lists toll free use cases' do + data, status_code = @tfv_api_instance.list_toll_free_use_cases_with_http_info + + expect(status_code).to eq(200) + expect(data).to be_instance_of(Array) + expect(data.length).to be > 0 + expect(data[0]).to be_instance_of(String) + end + end + + # List Webhook Subscriptions + describe 'list_webhook_subscriptions test' do + it 'lists webhook subscriptions' do + data, status_code = @tfv_api_instance.list_webhook_subscriptions_with_http_info(BW_ACCOUNT_ID) + + expect(status_code).to eq(200) + expect(data).to be_instance_of(Bandwidth::WebhookSubscriptionsListBody) + expect(data.links).to be_instance_of(Bandwidth::LinksObject) + expect(data.links.first).to be_instance_of(String) + expect(data.links._next).to be_instance_of(String) + expect(data.links.previous).to be_instance_of(String) + expect(data.links.last).to be_instance_of(String) + expect(data.errors).to be_instance_of(Array) + expect(data.errors[0].code).to be_instance_of(Integer) + expect(data.errors[0].description).to be_instance_of(String) + expect(data.errors[0].telephone_numbers).to be_instance_of(Array) + expect(data.errors[0].telephone_numbers[0]).to be_instance_of(Bandwidth::TelephoneNumber) + expect(data.errors[0].telephone_numbers[0].telephone_number).to be_instance_of(String) + expect(data.data).to be_instance_of(Array) + expect(data.data[0]).to be_instance_of(Bandwidth::WebhookSubscription) + expect(data.data[0].id).to be_instance_of(String) + expect(data.data[0].account_id).to be_instance_of(String) + expect(data.data[0].callback_url).to be_instance_of(String) + expect(data.data[0].type).to be_one_of(Bandwidth::WebhookSubscriptionTypeEnum.all_vars) + expect(data.data[0].basic_authentication).to be_instance_of(Bandwidth::WebhookSubscriptionBasicAuthentication) + expect(data.data[0].basic_authentication.username).to be_instance_of(String) + expect(data.data[0].basic_authentication.password).to be_instance_of(String) + expect(data.data[0].created_date).to be_instance_of(Time) + expect(data.data[0].modified_date).to be_instance_of(Time) + end + + it 'causes an ArgumentError for a missing account_id' do + expect { + @tfv_api_instance.list_webhook_subscriptions(nil) + }.to raise_error(ArgumentError) + end + end + + # Request Toll-Free Verification + describe 'request_toll_free_verification test' do + it 'requests toll free verification' do + verification_request = Bandwidth::VerificationRequest.new(verification.merge(phone_numbers: [tf_phone_number])) + _data, status_code = @tfv_api_instance.request_toll_free_verification_with_http_info(BW_ACCOUNT_ID, verification_request) + + expect(status_code).to eq(202) + end + + it 'causes an ArgumentError for a missing account_id' do + expect { + @tfv_api_instance.request_toll_free_verification(nil, {}) + }.to raise_error(ArgumentError) + end + + it 'causes an ArgumentError for a missing verification_request' do + expect { + @tfv_api_instance.request_toll_free_verification(BW_ACCOUNT_ID, nil) + }.to raise_error(ArgumentError) + end + end + + # Update Toll-Free Verification Request + describe 'update_toll_free_verification_request test' do + it 'updates toll free verification request' do + tfv_submission_wrapper = Bandwidth::TfvSubmissionWrapper.new( + submission: Bandwidth::VerificationUpdateRequest.new(verification) + ) + + _data, status_code = @tfv_api_instance.update_toll_free_verification_request_with_http_info(BW_ACCOUNT_ID, tf_phone_number, tfv_submission_wrapper) + + expect(status_code).to eq(202) + end + + it 'causes an ArgumentError for a missing account_id' do + expect { + @tfv_api_instance.update_toll_free_verification_request(nil, tf_phone_number, {}) + }.to raise_error(ArgumentError) + end + + it 'causes an ArgumentError for a missing phone_number' do + expect { + @tfv_api_instance.update_toll_free_verification_request(BW_ACCOUNT_ID, nil, {}) + }.to raise_error(ArgumentError) + end + + it 'causes an ArgumentError for a missing tfv_submission_wrapper' do + expect { + @tfv_api_instance.update_toll_free_verification_request(BW_ACCOUNT_ID, tf_phone_number, nil) + }.to raise_error(ArgumentError) + end + end + + # Update Webhook Subscription + describe 'update_webhook_subscription test' do + it 'updates webhook subscription' do + data, status_code = @tfv_api_instance.update_webhook_subscription_with_http_info(BW_ACCOUNT_ID, subscription_id, webhook_subscription_request_schema) + + expect(status_code).to eq(200) + expect(data).to be_instance_of(Bandwidth::WebhookSubscription) + expect(data.id).to be_instance_of(String) + expect(data.account_id.length).to eq(7) + expect(data.callback_url).to be_instance_of(String) + expect(data.type).to be_one_of(Bandwidth::WebhookSubscriptionTypeEnum.all_vars) + expect(data.basic_authentication).to be_instance_of(Bandwidth::WebhookSubscriptionBasicAuthentication) + expect(data.basic_authentication.username).to be_instance_of(String) + expect(data.basic_authentication.password).to be_instance_of(String) + expect(data.created_date).to be_instance_of(Time) + expect(data.modified_date).to be_instance_of(Time) + end + + it 'causes an ArgumentError for a missing account_id' do + expect { + @tfv_api_instance.update_webhook_subscription(nil, subscription_id, {}) + }.to raise_error(ArgumentError) + end + + it 'causes an ArgumentError for a missing subscription_id' do + expect { + @tfv_api_instance.update_webhook_subscription(BW_ACCOUNT_ID, nil, {}) + }.to raise_error(ArgumentError) + end + + it 'causes an ArgumentError for a missing webhook_subscription_request_schema' do + expect { + @tfv_api_instance.update_webhook_subscription(BW_ACCOUNT_ID, subscription_id, nil) + }.to raise_error(ArgumentError) + end + end +end