From b9b6e65acc8d0da9e37ddd35ad37fdf453e347ec Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 12:03:19 -0500 Subject: [PATCH 01/16] add oauth --- README.md | 15 ++++++ bandwidth.yml | 7 +++ docs/CallsApi.md | 25 ++++++++-- docs/ConferencesApi.md | 45 +++++++++++++---- docs/MFAApi.md | 15 ++++-- docs/MediaApi.md | 20 ++++++-- docs/MessagesApi.md | 10 +++- docs/MultiChannelApi.md | 5 +- docs/PhoneNumberLookupApi.md | 15 ++++-- docs/RecordingsApi.md | 50 +++++++++++++++---- docs/StatisticsApi.md | 5 +- docs/TollFreeVerificationApi.md | 45 +++++++++++++---- docs/TranscriptionsApi.md | 15 ++++-- lib/bandwidth-sdk/api/calls_api.rb | 10 ++-- lib/bandwidth-sdk/api/conferences_api.rb | 18 +++---- lib/bandwidth-sdk/api/media_api.rb | 8 +-- lib/bandwidth-sdk/api/messages_api.rb | 4 +- lib/bandwidth-sdk/api/mfa_api.rb | 6 +-- lib/bandwidth-sdk/api/multi_channel_api.rb | 2 +- .../api/phone_number_lookup_api.rb | 6 +-- lib/bandwidth-sdk/api/recordings_api.rb | 20 ++++---- lib/bandwidth-sdk/api/statistics_api.rb | 2 +- .../api/toll_free_verification_api.rb | 18 +++---- lib/bandwidth-sdk/api/transcriptions_api.rb | 6 +-- lib/bandwidth-sdk/configuration.rb | 7 +++ 25 files changed, 279 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index c95fdaf2..d3ed8e50 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,13 @@ Bandwidth.configure do |config| config.password = 'YOUR_PASSWORD' # Configure faraday connection config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' } + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } + # Configure faraday connection + config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' } end api_instance = Bandwidth::CallsApi.new @@ -345,3 +352,11 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication +### OAuth2 + + +- **Type**: OAuth +- **Flow**: application +- **Authorization URL**: +- **Scopes**: N/A + diff --git a/bandwidth.yml b/bandwidth.yml index 6ee15ae1..9ab77fd9 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -9,6 +9,7 @@ info: version: 1.0.0 security: - Basic: [] + - OAuth2: [] tags: - name: Messages - name: Media @@ -8427,6 +8428,12 @@ components: - Example: `Authorization: Basic ZGVtbZpwQDU1dzByZA==` + OAuth2: + type: oauth2 + flows: + clientCredentials: + tokenUrl: https://api.bandwidth.com/api/v1/oauth2/token + scopes: {} callbacks: inboundCallback: '{inboundCallbackUrl}': diff --git a/docs/CallsApi.md b/docs/CallsApi.md index 373b645f..b0f61d3e 100644 --- a/docs/CallsApi.md +++ b/docs/CallsApi.md @@ -29,6 +29,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::CallsApi.new @@ -75,7 +78,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -101,6 +104,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::CallsApi.new @@ -147,7 +153,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -173,6 +179,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::CallsApi.new @@ -233,7 +242,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -259,6 +268,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::CallsApi.new @@ -306,7 +318,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -332,6 +344,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::CallsApi.new @@ -382,7 +397,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers diff --git a/docs/ConferencesApi.md b/docs/ConferencesApi.md index a0a012d4..743ef413 100644 --- a/docs/ConferencesApi.md +++ b/docs/ConferencesApi.md @@ -33,6 +33,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::ConferencesApi.new @@ -81,7 +84,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -107,6 +110,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::ConferencesApi.new @@ -153,7 +159,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -179,6 +185,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::ConferencesApi.new @@ -227,7 +236,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -253,6 +262,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::ConferencesApi.new @@ -301,7 +313,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -327,6 +339,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::ConferencesApi.new @@ -373,7 +388,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -399,6 +414,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::ConferencesApi.new @@ -455,7 +473,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -481,6 +499,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::ConferencesApi.new @@ -528,7 +549,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -554,6 +575,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::ConferencesApi.new @@ -604,7 +628,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -630,6 +654,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::ConferencesApi.new @@ -679,7 +706,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers diff --git a/docs/MFAApi.md b/docs/MFAApi.md index bef6c1fb..96b14b48 100644 --- a/docs/MFAApi.md +++ b/docs/MFAApi.md @@ -27,6 +27,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::MFAApi.new @@ -73,7 +76,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -99,6 +102,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::MFAApi.new @@ -145,7 +151,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -171,6 +177,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::MFAApi.new @@ -217,7 +226,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers diff --git a/docs/MediaApi.md b/docs/MediaApi.md index 6d1c2e09..14f2e546 100644 --- a/docs/MediaApi.md +++ b/docs/MediaApi.md @@ -28,6 +28,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::MediaApi.new @@ -73,7 +76,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -99,6 +102,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::MediaApi.new @@ -145,7 +151,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -171,6 +177,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::MediaApi.new @@ -219,7 +228,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -245,6 +254,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::MediaApi.new @@ -298,7 +310,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers diff --git a/docs/MessagesApi.md b/docs/MessagesApi.md index c0616667..e4920eff 100644 --- a/docs/MessagesApi.md +++ b/docs/MessagesApi.md @@ -26,6 +26,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::MessagesApi.new @@ -72,7 +75,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -98,6 +101,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::MessagesApi.new @@ -198,7 +204,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers diff --git a/docs/MultiChannelApi.md b/docs/MultiChannelApi.md index 0ad03b20..0d45bf96 100644 --- a/docs/MultiChannelApi.md +++ b/docs/MultiChannelApi.md @@ -25,6 +25,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::MultiChannelApi.new @@ -71,7 +74,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers diff --git a/docs/PhoneNumberLookupApi.md b/docs/PhoneNumberLookupApi.md index 9bd235c2..b3c38843 100644 --- a/docs/PhoneNumberLookupApi.md +++ b/docs/PhoneNumberLookupApi.md @@ -27,6 +27,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::PhoneNumberLookupApi.new @@ -73,7 +76,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -99,6 +102,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::PhoneNumberLookupApi.new @@ -145,7 +151,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -171,6 +177,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::PhoneNumberLookupApi.new @@ -217,7 +226,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers diff --git a/docs/RecordingsApi.md b/docs/RecordingsApi.md index 4adccb20..f95bf9f0 100644 --- a/docs/RecordingsApi.md +++ b/docs/RecordingsApi.md @@ -34,6 +34,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::RecordingsApi.new @@ -81,7 +84,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -107,6 +110,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::RecordingsApi.new @@ -154,7 +160,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -180,6 +186,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::RecordingsApi.new @@ -227,7 +236,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -253,6 +262,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::RecordingsApi.new @@ -301,7 +313,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -327,6 +339,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::RecordingsApi.new @@ -375,7 +390,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -401,6 +416,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::RecordingsApi.new @@ -449,7 +467,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -475,6 +493,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::RecordingsApi.new @@ -529,7 +550,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -555,6 +576,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::RecordingsApi.new @@ -601,7 +625,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -627,6 +651,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::RecordingsApi.new @@ -676,7 +703,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -702,6 +729,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::RecordingsApi.new @@ -749,7 +779,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers diff --git a/docs/StatisticsApi.md b/docs/StatisticsApi.md index 8809fd44..15fa3fcb 100644 --- a/docs/StatisticsApi.md +++ b/docs/StatisticsApi.md @@ -25,6 +25,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::StatisticsApi.new @@ -69,7 +72,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers diff --git a/docs/TollFreeVerificationApi.md b/docs/TollFreeVerificationApi.md index 54908a44..c5a1bd84 100644 --- a/docs/TollFreeVerificationApi.md +++ b/docs/TollFreeVerificationApi.md @@ -33,6 +33,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TollFreeVerificationApi.new @@ -79,7 +82,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -105,6 +108,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TollFreeVerificationApi.new @@ -150,7 +156,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -176,6 +182,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TollFreeVerificationApi.new @@ -221,7 +230,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -247,6 +256,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TollFreeVerificationApi.new @@ -293,7 +305,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -319,6 +331,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TollFreeVerificationApi.new @@ -360,7 +375,7 @@ This endpoint does not need any parameter. ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -386,6 +401,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TollFreeVerificationApi.new @@ -430,7 +448,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -456,6 +474,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TollFreeVerificationApi.new @@ -501,7 +522,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -527,6 +548,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TollFreeVerificationApi.new @@ -574,7 +598,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -600,6 +624,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TollFreeVerificationApi.new @@ -648,7 +675,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers diff --git a/docs/TranscriptionsApi.md b/docs/TranscriptionsApi.md index b58e2adc..ea2a4beb 100644 --- a/docs/TranscriptionsApi.md +++ b/docs/TranscriptionsApi.md @@ -27,6 +27,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TranscriptionsApi.new @@ -74,7 +77,7 @@ nil (empty response body) ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -100,6 +103,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TranscriptionsApi.new @@ -148,7 +154,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers @@ -174,6 +180,9 @@ Bandwidth.configure do |config| # Configure HTTP basic authorization: Basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' + + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Bandwidth::TranscriptionsApi.new @@ -220,7 +229,7 @@ end ### Authorization -[Basic](../README.md#Basic) +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) ### HTTP request headers diff --git a/lib/bandwidth-sdk/api/calls_api.rb b/lib/bandwidth-sdk/api/calls_api.rb index 876a329f..05fec04a 100644 --- a/lib/bandwidth-sdk/api/calls_api.rb +++ b/lib/bandwidth-sdk/api/calls_api.rb @@ -74,7 +74,7 @@ def create_call_with_http_info(account_id, create_call, opts = {}) return_type = opts[:debug_return_type] || 'CreateCallResponse' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"CallsApi.create_call", @@ -143,7 +143,7 @@ def get_call_state_with_http_info(account_id, call_id, opts = {}) return_type = opts[:debug_return_type] || 'CallState' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"CallsApi.get_call_state", @@ -235,7 +235,7 @@ def list_calls_with_http_info(account_id, opts = {}) return_type = opts[:debug_return_type] || 'Array' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"CallsApi.list_calls", @@ -315,7 +315,7 @@ def update_call_with_http_info(account_id, call_id, update_call, opts = {}) return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"CallsApi.update_call", @@ -395,7 +395,7 @@ def update_call_bxml_with_http_info(account_id, call_id, body, opts = {}) return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"CallsApi.update_call_bxml", diff --git a/lib/bandwidth-sdk/api/conferences_api.rb b/lib/bandwidth-sdk/api/conferences_api.rb index ca1ee830..7f48a975 100644 --- a/lib/bandwidth-sdk/api/conferences_api.rb +++ b/lib/bandwidth-sdk/api/conferences_api.rb @@ -75,7 +75,7 @@ def download_conference_recording_with_http_info(account_id, conference_id, reco return_type = opts[:debug_return_type] || 'File' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"ConferencesApi.download_conference_recording", @@ -144,7 +144,7 @@ def get_conference_with_http_info(account_id, conference_id, opts = {}) return_type = opts[:debug_return_type] || 'Conference' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"ConferencesApi.get_conference", @@ -219,7 +219,7 @@ def get_conference_member_with_http_info(account_id, conference_id, member_id, o return_type = opts[:debug_return_type] || 'ConferenceMember' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"ConferencesApi.get_conference_member", @@ -294,7 +294,7 @@ def get_conference_recording_with_http_info(account_id, conference_id, recording return_type = opts[:debug_return_type] || 'ConferenceRecordingMetadata' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"ConferencesApi.get_conference_recording", @@ -363,7 +363,7 @@ def list_conference_recordings_with_http_info(account_id, conference_id, opts = return_type = opts[:debug_return_type] || 'Array' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"ConferencesApi.list_conference_recordings", @@ -449,7 +449,7 @@ def list_conferences_with_http_info(account_id, opts = {}) return_type = opts[:debug_return_type] || 'Array' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"ConferencesApi.list_conferences", @@ -529,7 +529,7 @@ def update_conference_with_http_info(account_id, conference_id, update_conferenc return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"ConferencesApi.update_conference", @@ -609,7 +609,7 @@ def update_conference_bxml_with_http_info(account_id, conference_id, body, opts return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"ConferencesApi.update_conference_bxml", @@ -695,7 +695,7 @@ def update_conference_member_with_http_info(account_id, conference_id, member_id return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"ConferencesApi.update_conference_member", diff --git a/lib/bandwidth-sdk/api/media_api.rb b/lib/bandwidth-sdk/api/media_api.rb index 1b98dec4..388e7793 100644 --- a/lib/bandwidth-sdk/api/media_api.rb +++ b/lib/bandwidth-sdk/api/media_api.rb @@ -69,7 +69,7 @@ def delete_media_with_http_info(account_id, media_id, opts = {}) return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"MediaApi.delete_media", @@ -138,7 +138,7 @@ def get_media_with_http_info(account_id, media_id, opts = {}) return_type = opts[:debug_return_type] || 'File' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"MediaApi.get_media", @@ -204,7 +204,7 @@ def list_media_with_http_info(account_id, opts = {}) return_type = opts[:debug_return_type] || 'Array' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"MediaApi.list_media", @@ -290,7 +290,7 @@ def upload_media_with_http_info(account_id, media_id, body, opts = {}) return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"MediaApi.upload_media", diff --git a/lib/bandwidth-sdk/api/messages_api.rb b/lib/bandwidth-sdk/api/messages_api.rb index 608c19af..92bdf75e 100644 --- a/lib/bandwidth-sdk/api/messages_api.rb +++ b/lib/bandwidth-sdk/api/messages_api.rb @@ -74,7 +74,7 @@ def create_message_with_http_info(account_id, message_request, opts = {}) return_type = opts[:debug_return_type] || 'Message' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"MessagesApi.create_message", @@ -218,7 +218,7 @@ def list_messages_with_http_info(account_id, opts = {}) return_type = opts[:debug_return_type] || 'MessagesList' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"MessagesApi.list_messages", diff --git a/lib/bandwidth-sdk/api/mfa_api.rb b/lib/bandwidth-sdk/api/mfa_api.rb index e32a6438..f86884a5 100644 --- a/lib/bandwidth-sdk/api/mfa_api.rb +++ b/lib/bandwidth-sdk/api/mfa_api.rb @@ -74,7 +74,7 @@ def generate_messaging_code_with_http_info(account_id, code_request, opts = {}) return_type = opts[:debug_return_type] || 'MessagingCodeResponse' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"MFAApi.generate_messaging_code", @@ -148,7 +148,7 @@ def generate_voice_code_with_http_info(account_id, code_request, opts = {}) return_type = opts[:debug_return_type] || 'VoiceCodeResponse' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"MFAApi.generate_voice_code", @@ -222,7 +222,7 @@ def verify_code_with_http_info(account_id, verify_code_request, opts = {}) return_type = opts[:debug_return_type] || 'VerifyCodeResponse' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"MFAApi.verify_code", diff --git a/lib/bandwidth-sdk/api/multi_channel_api.rb b/lib/bandwidth-sdk/api/multi_channel_api.rb index e29a2e2c..8a6b76fb 100644 --- a/lib/bandwidth-sdk/api/multi_channel_api.rb +++ b/lib/bandwidth-sdk/api/multi_channel_api.rb @@ -74,7 +74,7 @@ def create_multi_channel_message_with_http_info(account_id, multi_channel_messag return_type = opts[:debug_return_type] || 'CreateMultiChannelMessageResponse' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"MultiChannelApi.create_multi_channel_message", diff --git a/lib/bandwidth-sdk/api/phone_number_lookup_api.rb b/lib/bandwidth-sdk/api/phone_number_lookup_api.rb index 611a44dd..95d0dac3 100644 --- a/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +++ b/lib/bandwidth-sdk/api/phone_number_lookup_api.rb @@ -74,7 +74,7 @@ def create_async_bulk_lookup_with_http_info(account_id, async_lookup_request, op return_type = opts[:debug_return_type] || 'CreateAsyncBulkLookupResponse' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"PhoneNumberLookupApi.create_async_bulk_lookup", @@ -148,7 +148,7 @@ def create_sync_lookup_with_http_info(account_id, sync_lookup_request, opts = {} return_type = opts[:debug_return_type] || 'CreateSyncLookupResponse' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"PhoneNumberLookupApi.create_sync_lookup", @@ -217,7 +217,7 @@ def get_async_bulk_lookup_with_http_info(account_id, request_id, opts = {}) return_type = opts[:debug_return_type] || 'GetAsyncBulkLookupResponse' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"PhoneNumberLookupApi.get_async_bulk_lookup", diff --git a/lib/bandwidth-sdk/api/recordings_api.rb b/lib/bandwidth-sdk/api/recordings_api.rb index 9df9bd1e..eea51be0 100644 --- a/lib/bandwidth-sdk/api/recordings_api.rb +++ b/lib/bandwidth-sdk/api/recordings_api.rb @@ -75,7 +75,7 @@ def delete_recording_with_http_info(account_id, call_id, recording_id, opts = {} return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"RecordingsApi.delete_recording", @@ -150,7 +150,7 @@ def delete_recording_media_with_http_info(account_id, call_id, recording_id, opt return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"RecordingsApi.delete_recording_media", @@ -225,7 +225,7 @@ def delete_recording_transcription_with_http_info(account_id, call_id, recording return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"RecordingsApi.delete_recording_transcription", @@ -300,7 +300,7 @@ def download_call_recording_with_http_info(account_id, call_id, recording_id, op return_type = opts[:debug_return_type] || 'File' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"RecordingsApi.download_call_recording", @@ -375,7 +375,7 @@ def get_call_recording_with_http_info(account_id, call_id, recording_id, opts = return_type = opts[:debug_return_type] || 'CallRecordingMetadata' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"RecordingsApi.get_call_recording", @@ -450,7 +450,7 @@ def get_recording_transcription_with_http_info(account_id, call_id, recording_id return_type = opts[:debug_return_type] || 'RecordingTranscriptions' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"RecordingsApi.get_recording_transcription", @@ -525,7 +525,7 @@ def list_account_call_recordings_with_http_info(account_id, opts = {}) return_type = opts[:debug_return_type] || 'Array' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"RecordingsApi.list_account_call_recordings", @@ -594,7 +594,7 @@ def list_call_recordings_with_http_info(account_id, call_id, opts = {}) return_type = opts[:debug_return_type] || 'Array' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"RecordingsApi.list_call_recordings", @@ -680,7 +680,7 @@ def transcribe_call_recording_with_http_info(account_id, call_id, recording_id, return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"RecordingsApi.transcribe_call_recording", @@ -760,7 +760,7 @@ def update_call_recording_state_with_http_info(account_id, call_id, update_call_ return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"RecordingsApi.update_call_recording_state", diff --git a/lib/bandwidth-sdk/api/statistics_api.rb b/lib/bandwidth-sdk/api/statistics_api.rb index 76f399dd..b8d745d7 100644 --- a/lib/bandwidth-sdk/api/statistics_api.rb +++ b/lib/bandwidth-sdk/api/statistics_api.rb @@ -63,7 +63,7 @@ def get_statistics_with_http_info(account_id, opts = {}) return_type = opts[:debug_return_type] || 'AccountStatistics' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"StatisticsApi.get_statistics", diff --git a/lib/bandwidth-sdk/api/toll_free_verification_api.rb b/lib/bandwidth-sdk/api/toll_free_verification_api.rb index 5940f24a..ec1ef0f3 100644 --- a/lib/bandwidth-sdk/api/toll_free_verification_api.rb +++ b/lib/bandwidth-sdk/api/toll_free_verification_api.rb @@ -74,7 +74,7 @@ def create_webhook_subscription_with_http_info(account_id, webhook_subscription_ return_type = opts[:debug_return_type] || 'WebhookSubscription' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TollFreeVerificationApi.create_webhook_subscription", @@ -156,7 +156,7 @@ def delete_verification_request_with_http_info(account_id, phone_number, opts = return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TollFreeVerificationApi.delete_verification_request", @@ -225,7 +225,7 @@ def delete_webhook_subscription_with_http_info(account_id, id, opts = {}) return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TollFreeVerificationApi.delete_webhook_subscription", @@ -307,7 +307,7 @@ def get_toll_free_verification_status_with_http_info(account_id, phone_number, o return_type = opts[:debug_return_type] || 'TfvStatus' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TollFreeVerificationApi.get_toll_free_verification_status", @@ -364,7 +364,7 @@ def list_toll_free_use_cases_with_http_info(opts = {}) return_type = opts[:debug_return_type] || 'Array' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TollFreeVerificationApi.list_toll_free_use_cases", @@ -427,7 +427,7 @@ def list_webhook_subscriptions_with_http_info(account_id, opts = {}) return_type = opts[:debug_return_type] || 'WebhookSubscriptionsListBody' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TollFreeVerificationApi.list_webhook_subscriptions", @@ -501,7 +501,7 @@ def request_toll_free_verification_with_http_info(account_id, verification_reque return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TollFreeVerificationApi.request_toll_free_verification", @@ -594,7 +594,7 @@ def update_toll_free_verification_request_with_http_info(account_id, phone_numbe return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TollFreeVerificationApi.update_toll_free_verification_request", @@ -674,7 +674,7 @@ def update_webhook_subscription_with_http_info(account_id, id, webhook_subscript return_type = opts[:debug_return_type] || 'WebhookSubscription' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TollFreeVerificationApi.update_webhook_subscription", diff --git a/lib/bandwidth-sdk/api/transcriptions_api.rb b/lib/bandwidth-sdk/api/transcriptions_api.rb index d8adb7fb..f7643cdb 100644 --- a/lib/bandwidth-sdk/api/transcriptions_api.rb +++ b/lib/bandwidth-sdk/api/transcriptions_api.rb @@ -75,7 +75,7 @@ def delete_real_time_transcription_with_http_info(account_id, call_id, transcrip return_type = opts[:debug_return_type] # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TranscriptionsApi.delete_real_time_transcription", @@ -150,7 +150,7 @@ def get_real_time_transcription_with_http_info(account_id, call_id, transcriptio return_type = opts[:debug_return_type] || 'CallTranscriptionResponse' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TranscriptionsApi.get_real_time_transcription", @@ -219,7 +219,7 @@ def list_real_time_transcriptions_with_http_info(account_id, call_id, opts = {}) return_type = opts[:debug_return_type] || 'Array' # auth_names - auth_names = opts[:debug_auth_names] || ['Basic'] + auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2'] new_options = opts.merge( :operation => :"TranscriptionsApi.list_real_time_transcriptions", diff --git a/lib/bandwidth-sdk/configuration.rb b/lib/bandwidth-sdk/configuration.rb index 07792627..f76f367d 100644 --- a/lib/bandwidth-sdk/configuration.rb +++ b/lib/bandwidth-sdk/configuration.rb @@ -255,6 +255,13 @@ def auth_settings key: 'Authorization', value: basic_auth_token }, + 'OAuth2' => + { + type: 'oauth2', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, } end From f5eb8b7a8c54ba9db3ccd39babdb7d2efdcf6f0f Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 12:12:12 -0500 Subject: [PATCH 02/16] update generator version --- .openapi-generator/FILES | 1 + .openapi-generator/VERSION | 2 +- bandwidth-sdk.gemspec | 3 +- custom_templates/gem.mustache | 2 + lib/bandwidth-sdk.rb | 3 +- lib/bandwidth-sdk/api/calls_api.rb | 2 +- lib/bandwidth-sdk/api/conferences_api.rb | 2 +- lib/bandwidth-sdk/api/media_api.rb | 2 +- lib/bandwidth-sdk/api/messages_api.rb | 2 +- lib/bandwidth-sdk/api/mfa_api.rb | 2 +- lib/bandwidth-sdk/api/multi_channel_api.rb | 2 +- .../api/phone_number_lookup_api.rb | 2 +- lib/bandwidth-sdk/api/recordings_api.rb | 2 +- lib/bandwidth-sdk/api/statistics_api.rb | 2 +- .../api/toll_free_verification_api.rb | 8 +- lib/bandwidth-sdk/api/transcriptions_api.rb | 2 +- lib/bandwidth-sdk/api_client.rb | 2 +- lib/bandwidth-sdk/api_error.rb | 2 +- lib/bandwidth-sdk/api_model_base.rb | 88 ++++++++++ lib/bandwidth-sdk/configuration.rb | 2 +- .../models/account_statistics.rb | 89 ++-------- .../models/additional_denial_reason.rb | 119 +++++-------- lib/bandwidth-sdk/models/address.rb | 113 +++---------- lib/bandwidth-sdk/models/answer_callback.rb | 89 ++-------- .../models/async_lookup_request.rb | 89 ++-------- lib/bandwidth-sdk/models/blocked_webhook.rb | 93 ++-------- .../models/bridge_complete_callback.rb | 89 ++-------- .../models/bridge_target_complete_callback.rb | 89 ++-------- .../models/business_entity_type_enum.rb | 2 +- .../models/business_registration_type_enum.rb | 2 +- .../models/call_direction_enum.rb | 2 +- .../models/call_recording_metadata.rb | 89 ++-------- lib/bandwidth-sdk/models/call_state.rb | 89 ++-------- lib/bandwidth-sdk/models/call_state_enum.rb | 2 +- .../models/call_transcription.rb | 89 ++-------- ...ll_transcription_detected_language_enum.rb | 2 +- .../models/call_transcription_metadata.rb | 89 ++-------- .../models/call_transcription_response.rb | 89 ++-------- .../models/call_transcription_track_enum.rb | 2 +- lib/bandwidth-sdk/models/callback.rb | 2 +- .../models/callback_method_enum.rb | 2 +- lib/bandwidth-sdk/models/card_width_enum.rb | 2 +- lib/bandwidth-sdk/models/code_request.rb | 89 ++-------- .../models/completed_lookup_status_enum.rb | 2 +- lib/bandwidth-sdk/models/conference.rb | 89 ++-------- .../models/conference_completed_callback.rb | 89 ++-------- .../models/conference_created_callback.rb | 89 ++-------- lib/bandwidth-sdk/models/conference_member.rb | 89 ++-------- .../models/conference_member_exit_callback.rb | 89 ++-------- .../models/conference_member_join_callback.rb | 89 ++-------- ...conference_recording_available_callback.rb | 89 ++-------- .../models/conference_recording_metadata.rb | 89 ++-------- .../models/conference_redirect_callback.rb | 89 ++-------- .../models/conference_state_enum.rb | 2 +- lib/bandwidth-sdk/models/contact.rb | 105 +++--------- .../create_async_bulk_lookup_response.rb | 89 ++-------- .../create_async_bulk_lookup_response_data.rb | 89 ++-------- lib/bandwidth-sdk/models/create_call.rb | 119 +++++-------- .../models/create_call_response.rb | 159 +++++++++--------- .../models/create_message_request_error.rb | 109 ++++-------- .../create_multi_channel_message_response.rb | 89 ++-------- .../models/create_sync_lookup_response.rb | 89 ++-------- .../create_sync_lookup_response_data.rb | 89 ++-------- .../models/deactivation_event_enum.rb | 2 +- .../models/disconnect_callback.rb | 89 ++-------- lib/bandwidth-sdk/models/diversion.rb | 89 ++-------- lib/bandwidth-sdk/models/dtmf_callback.rb | 89 ++-------- lib/bandwidth-sdk/models/error.rb | 89 ++-------- lib/bandwidth-sdk/models/error_object.rb | 119 +++++-------- lib/bandwidth-sdk/models/error_source.rb | 89 ++-------- lib/bandwidth-sdk/models/failure_webhook.rb | 93 ++-------- lib/bandwidth-sdk/models/field_error.rb | 89 ++-------- lib/bandwidth-sdk/models/file_format_enum.rb | 2 +- lib/bandwidth-sdk/models/gather_callback.rb | 89 ++-------- .../models/get_async_bulk_lookup_response.rb | 89 ++-------- .../get_async_bulk_lookup_response_data.rb | 89 ++-------- .../models/in_progress_lookup_status_enum.rb | 2 +- lib/bandwidth-sdk/models/inbound_callback.rb | 139 +++++++-------- .../models/inbound_callback_message.rb | 159 +++++++++--------- .../models/inbound_callback_type_enum.rb | 2 +- lib/bandwidth-sdk/models/initiate_callback.rb | 89 ++-------- .../latest_message_delivery_status_enum.rb | 2 +- lib/bandwidth-sdk/models/line_type_enum.rb | 2 +- lib/bandwidth-sdk/models/link.rb | 89 ++-------- lib/bandwidth-sdk/models/link_schema.rb | 89 ++-------- lib/bandwidth-sdk/models/links_object.rb | 89 ++-------- .../models/list_message_direction_enum.rb | 2 +- lib/bandwidth-sdk/models/list_message_item.rb | 89 ++-------- .../models/lookup_error_response.rb | 89 ++-------- .../models/lookup_error_schema.rb | 89 ++-------- .../models/lookup_error_schema_meta.rb | 89 ++-------- lib/bandwidth-sdk/models/lookup_result.rb | 89 ++-------- .../machine_detection_complete_callback.rb | 89 ++-------- .../models/machine_detection_configuration.rb | 89 ++-------- .../models/machine_detection_mode_enum.rb | 2 +- .../models/machine_detection_result.rb | 89 ++-------- lib/bandwidth-sdk/models/media.rb | 89 ++-------- lib/bandwidth-sdk/models/message.rb | 89 ++-------- .../models/message_direction_enum.rb | 2 +- lib/bandwidth-sdk/models/message_request.rb | 109 ++++-------- .../models/message_status_enum.rb | 2 +- lib/bandwidth-sdk/models/message_type_enum.rb | 2 +- lib/bandwidth-sdk/models/messages_list.rb | 89 ++-------- .../models/messaging_code_response.rb | 89 ++-------- .../models/messaging_request_error.rb | 109 ++++-------- .../models/mfa_forbidden_request_error.rb | 89 ++-------- lib/bandwidth-sdk/models/mfa_request_error.rb | 89 ++-------- .../models/mfa_unauthorized_request_error.rb | 89 ++-------- .../models/mms_message_content.rb | 89 ++-------- .../models/mms_message_content_file.rb | 89 ++-------- .../models/multi_channel_action.rb | 7 +- .../multi_channel_action_calendar_event.rb | 119 +++++-------- .../multi_channel_channel_list_mms_object.rb | 129 ++++++-------- ...hannel_channel_list_mms_response_object.rb | 139 +++++++-------- .../multi_channel_channel_list_object_base.rb | 119 +++++-------- ...multi_channel_channel_list_owner_object.rb | 99 +++-------- .../multi_channel_channel_list_rbm_object.rb | 129 ++++++-------- ..._channel_list_rbm_object_all_of_content.rb | 7 +- ...hannel_channel_list_rbm_response_object.rb | 139 +++++++-------- ...lti_channel_channel_list_request_object.rb | 7 +- ...ti_channel_channel_list_response_object.rb | 7 +- .../multi_channel_channel_list_sms_object.rb | 129 ++++++-------- ...hannel_channel_list_sms_response_object.rb | 139 +++++++-------- .../models/multi_channel_error.rb | 89 ++-------- .../multi_channel_message_channel_enum.rb | 2 +- .../models/multi_channel_message_content.rb | 89 ++-------- .../models/multi_channel_message_request.rb | 99 +++-------- .../multi_channel_message_response_data.rb | 119 +++++-------- lib/bandwidth-sdk/models/opt_in_workflow.rb | 107 +++--------- lib/bandwidth-sdk/models/page_info.rb | 89 ++-------- lib/bandwidth-sdk/models/priority_enum.rb | 2 +- lib/bandwidth-sdk/models/product_type_enum.rb | 2 +- lib/bandwidth-sdk/models/rbm_action_base.rb | 99 +++-------- lib/bandwidth-sdk/models/rbm_action_dial.rb | 109 ++++-------- .../models/rbm_action_open_url.rb | 99 +++-------- .../models/rbm_action_type_enum.rb | 2 +- .../models/rbm_action_view_location.rb | 119 +++++-------- lib/bandwidth-sdk/models/rbm_card_content.rb | 89 ++-------- .../models/rbm_card_content_media.rb | 99 +++-------- .../models/rbm_location_response.rb | 89 ++-------- .../models/rbm_media_height_enum.rb | 2 +- .../models/rbm_message_carousel_card.rb | 99 +++-------- .../models/rbm_message_content_file.rb | 89 ++-------- .../models/rbm_message_content_rich_card.rb | 7 +- .../models/rbm_message_content_text.rb | 89 ++-------- lib/bandwidth-sdk/models/rbm_message_media.rb | 99 +++-------- .../models/rbm_standalone_card.rb | 119 +++++-------- .../models/rbm_suggestion_response.rb | 89 ++-------- .../models/recording_available_callback.rb | 89 ++-------- .../models/recording_complete_callback.rb | 89 ++-------- .../models/recording_state_enum.rb | 2 +- .../recording_transcription_metadata.rb | 89 ++-------- .../models/recording_transcriptions.rb | 89 ++-------- lib/bandwidth-sdk/models/redirect_callback.rb | 89 ++-------- .../models/redirect_method_enum.rb | 2 +- .../models/sms_message_content.rb | 89 ++-------- .../standalone_card_orientation_enum.rb | 2 +- lib/bandwidth-sdk/models/status_callback.rb | 139 +++++++-------- .../models/status_callback_message.rb | 159 +++++++++--------- .../models/status_callback_type_enum.rb | 12 +- lib/bandwidth-sdk/models/stir_shaken.rb | 89 ++-------- .../models/sync_lookup_request.rb | 89 ++-------- lib/bandwidth-sdk/models/telephone_number.rb | 89 ++-------- .../models/tfv_basic_authentication.rb | 89 ++-------- .../models/tfv_callback_status_enum.rb | 2 +- lib/bandwidth-sdk/models/tfv_error.rb | 89 ++-------- lib/bandwidth-sdk/models/tfv_status.rb | 93 ++-------- lib/bandwidth-sdk/models/tfv_status_enum.rb | 2 +- .../models/tfv_submission_info.rb | 109 +++--------- .../models/tfv_submission_wrapper.rb | 89 ++-------- .../models/thumbnail_alignment_enum.rb | 2 +- .../models/transcribe_recording.rb | 89 ++-------- lib/bandwidth-sdk/models/transcription.rb | 89 ++-------- .../transcription_available_callback.rb | 89 ++-------- .../models/transfer_answer_callback.rb | 89 ++-------- .../models/transfer_complete_callback.rb | 89 ++-------- .../models/transfer_disconnect_callback.rb | 89 ++-------- lib/bandwidth-sdk/models/update_call.rb | 89 ++-------- .../models/update_call_recording.rb | 99 +++-------- lib/bandwidth-sdk/models/update_conference.rb | 89 ++-------- .../models/update_conference_member.rb | 89 ++-------- .../models/verification_denial_webhook.rb | 93 ++-------- .../models/verification_request.rb | 139 ++++++--------- .../models/verification_update_request.rb | 139 ++++++--------- .../models/verification_webhook.rb | 93 ++-------- .../models/verify_code_request.rb | 93 ++-------- .../models/verify_code_response.rb | 89 ++-------- lib/bandwidth-sdk/models/voice_api_error.rb | 89 ++-------- .../models/voice_code_response.rb | 89 ++-------- .../models/webhook_subscription.rb | 93 ++-------- ...bhook_subscription_basic_authentication.rb | 89 ++-------- .../webhook_subscription_request_schema.rb | 97 ++--------- .../models/webhook_subscription_type_enum.rb | 2 +- .../models/webhook_subscriptions_list_body.rb | 99 +++-------- lib/bandwidth-sdk/version.rb | 2 +- openapitools.json | 2 +- 196 files changed, 2775 insertions(+), 10607 deletions(-) create mode 100644 lib/bandwidth-sdk/api_model_base.rb diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 2f0b52e6..ae7c3813 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -204,6 +204,7 @@ 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/api_model_base.rb lib/bandwidth-sdk/configuration.rb lib/bandwidth-sdk/models/account_statistics.rb lib/bandwidth-sdk/models/additional_denial_reason.rb diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 09a6d308..6328c542 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.8.0 +7.17.0 diff --git a/bandwidth-sdk.gemspec b/bandwidth-sdk.gemspec index f8c0e888..bdae4356 100644 --- a/bandwidth-sdk.gemspec +++ b/bandwidth-sdk.gemspec @@ -8,8 +8,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 - +Generator version: 7.17.0 =end $:.push File.expand_path('../lib', __FILE__) diff --git a/custom_templates/gem.mustache b/custom_templates/gem.mustache index ed66ea55..cd6eeb59 100644 --- a/custom_templates/gem.mustache +++ b/custom_templates/gem.mustache @@ -1,10 +1,12 @@ =begin {{> api_info}} + =end # Common files require '{{gemName}}/api_client' require '{{gemName}}/api_error' +require '{{gemName}}/api_model_base' require '{{gemName}}/version' require '{{gemName}}/configuration' diff --git a/lib/bandwidth-sdk.rb b/lib/bandwidth-sdk.rb index 4947a5d8..03069cd2 100644 --- a/lib/bandwidth-sdk.rb +++ b/lib/bandwidth-sdk.rb @@ -6,13 +6,14 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end # Common files require 'bandwidth-sdk/api_client' require 'bandwidth-sdk/api_error' +require 'bandwidth-sdk/api_model_base' require 'bandwidth-sdk/version' require 'bandwidth-sdk/configuration' diff --git a/lib/bandwidth-sdk/api/calls_api.rb b/lib/bandwidth-sdk/api/calls_api.rb index 05fec04a..a50de839 100644 --- a/lib/bandwidth-sdk/api/calls_api.rb +++ b/lib/bandwidth-sdk/api/calls_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api/conferences_api.rb b/lib/bandwidth-sdk/api/conferences_api.rb index 7f48a975..ddd6755a 100644 --- a/lib/bandwidth-sdk/api/conferences_api.rb +++ b/lib/bandwidth-sdk/api/conferences_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api/media_api.rb b/lib/bandwidth-sdk/api/media_api.rb index 388e7793..28b69c8c 100644 --- a/lib/bandwidth-sdk/api/media_api.rb +++ b/lib/bandwidth-sdk/api/media_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api/messages_api.rb b/lib/bandwidth-sdk/api/messages_api.rb index 92bdf75e..b38beb87 100644 --- a/lib/bandwidth-sdk/api/messages_api.rb +++ b/lib/bandwidth-sdk/api/messages_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api/mfa_api.rb b/lib/bandwidth-sdk/api/mfa_api.rb index f86884a5..66049f23 100644 --- a/lib/bandwidth-sdk/api/mfa_api.rb +++ b/lib/bandwidth-sdk/api/mfa_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api/multi_channel_api.rb b/lib/bandwidth-sdk/api/multi_channel_api.rb index 8a6b76fb..04b771e2 100644 --- a/lib/bandwidth-sdk/api/multi_channel_api.rb +++ b/lib/bandwidth-sdk/api/multi_channel_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api/phone_number_lookup_api.rb b/lib/bandwidth-sdk/api/phone_number_lookup_api.rb index 95d0dac3..a633c1e3 100644 --- a/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +++ b/lib/bandwidth-sdk/api/phone_number_lookup_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api/recordings_api.rb b/lib/bandwidth-sdk/api/recordings_api.rb index eea51be0..1c7eb8b4 100644 --- a/lib/bandwidth-sdk/api/recordings_api.rb +++ b/lib/bandwidth-sdk/api/recordings_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api/statistics_api.rb b/lib/bandwidth-sdk/api/statistics_api.rb index b8d745d7..8bd59fe7 100644 --- a/lib/bandwidth-sdk/api/statistics_api.rb +++ b/lib/bandwidth-sdk/api/statistics_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api/toll_free_verification_api.rb b/lib/bandwidth-sdk/api/toll_free_verification_api.rb index ec1ef0f3..62160ffd 100644 --- a/lib/bandwidth-sdk/api/toll_free_verification_api.rb +++ b/lib/bandwidth-sdk/api/toll_free_verification_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -127,7 +127,7 @@ def delete_verification_request_with_http_info(account_id, phone_number, opts = end if @api_client.config.client_side_validation && phone_number.to_s.length < 12 - fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.delete_verification_request, the character length must be great than or equal to 12.' + fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.delete_verification_request, the character length must be greater than or equal to 12.' end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -278,7 +278,7 @@ def get_toll_free_verification_status_with_http_info(account_id, phone_number, o 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.' + fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.get_toll_free_verification_status, the character length must be greater than or equal to 12.' end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -556,7 +556,7 @@ def update_toll_free_verification_request_with_http_info(account_id, phone_numbe 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.' + fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.update_toll_free_verification_request, the character length must be greater than or equal to 12.' end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) diff --git a/lib/bandwidth-sdk/api/transcriptions_api.rb b/lib/bandwidth-sdk/api/transcriptions_api.rb index f7643cdb..a0cf25ee 100644 --- a/lib/bandwidth-sdk/api/transcriptions_api.rb +++ b/lib/bandwidth-sdk/api/transcriptions_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api_client.rb b/lib/bandwidth-sdk/api_client.rb index ec7b706a..eaa8cc2b 100644 --- a/lib/bandwidth-sdk/api_client.rb +++ b/lib/bandwidth-sdk/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api_error.rb b/lib/bandwidth-sdk/api_error.rb index c4fd1a8b..9738f360 100644 --- a/lib/bandwidth-sdk/api_error.rb +++ b/lib/bandwidth-sdk/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/api_model_base.rb b/lib/bandwidth-sdk/api_model_base.rb new file mode 100644 index 00000000..fe11aac8 --- /dev/null +++ b/lib/bandwidth-sdk/api_model_base.rb @@ -0,0 +1,88 @@ +=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.17.0 + +=end + +module Bandwidth + class ApiModelBase + # 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 + + # 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/configuration.rb b/lib/bandwidth-sdk/configuration.rb index f76f367d..c0e9ba15 100644 --- a/lib/bandwidth-sdk/configuration.rb +++ b/lib/bandwidth-sdk/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/account_statistics.rb b/lib/bandwidth-sdk/models/account_statistics.rb index d4f03c86..a3f1aeb5 100644 --- a/lib/bandwidth-sdk/models/account_statistics.rb +++ b/lib/bandwidth-sdk/models/account_statistics.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class AccountStatistics + class AccountStatistics < ApiModelBase # The number of calls currently enqueued. attr_accessor :current_call_queue_size @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::AccountStatistics`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AccountStatistics`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -131,61 +137,6 @@ def self.build_from_hash(attributes) 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 @@ -201,23 +152,5 @@ def to_hash 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/additional_denial_reason.rb b/lib/bandwidth-sdk/models/additional_denial_reason.rb index 34e39447..8c73287b 100644 --- a/lib/bandwidth-sdk/models/additional_denial_reason.rb +++ b/lib/bandwidth-sdk/models/additional_denial_reason.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class AdditionalDenialReason + class AdditionalDenialReason < ApiModelBase # Reason code for denial. attr_accessor :status_code @@ -33,9 +33,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -61,9 +66,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -117,6 +123,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] status_code Value to be assigned + def status_code=(status_code) + if status_code.nil? + fail ArgumentError, 'status_code cannot be nil' + end + + @status_code = status_code + end + + # Custom attribute writer method with validation + # @param [Object] reason Value to be assigned + def reason=(reason) + if reason.nil? + fail ArgumentError, 'reason cannot be nil' + end + + @reason = reason + end + + # Custom attribute writer method with validation + # @param [Object] resubmit_allowed Value to be assigned + def resubmit_allowed=(resubmit_allowed) + if resubmit_allowed.nil? + fail ArgumentError, 'resubmit_allowed cannot be nil' + end + + @resubmit_allowed = resubmit_allowed + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -162,61 +198,6 @@ def self.build_from_hash(attributes) 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 @@ -232,23 +213,5 @@ def to_hash 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 index 2403803c..5c7c4f6d 100644 --- a/lib/bandwidth-sdk/models/address.rb +++ b/lib/bandwidth-sdk/models/address.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class Address + class Address < ApiModelBase # The name of the business using the toll-free number. attr_accessor :name @@ -49,9 +49,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -82,9 +87,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -144,7 +150,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end if @addr1.nil? @@ -156,7 +162,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "addr1", the character length must be greater than or equal to 1.') end if !@addr2.nil? && @addr2.to_s.length > 500 @@ -164,7 +170,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "addr2", the character length must be greater than or equal to 0.') end if @city.nil? @@ -176,7 +182,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "city", the character length must be greater than or equal to 1.') end if @state.nil? @@ -188,7 +194,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "state", the character length must be greater than or equal to 1.') end if @zip.nil? @@ -209,7 +215,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "url", the character length must be greater than or equal to 1.') end invalid_properties @@ -253,7 +259,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end @name = name @@ -271,7 +277,7 @@ def addr1=(addr1) end if addr1.to_s.length < 1 - fail ArgumentError, 'invalid value for "addr1", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "addr1", the character length must be greater than or equal to 1.' end @addr1 = addr1 @@ -285,7 +291,7 @@ def addr2=(addr2) 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.' + fail ArgumentError, 'invalid value for "addr2", the character length must be greater than or equal to 0.' end @addr2 = addr2 @@ -303,7 +309,7 @@ def city=(city) end if city.to_s.length < 1 - fail ArgumentError, 'invalid value for "city", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "city", the character length must be greater than or equal to 1.' end @city = city @@ -321,7 +327,7 @@ def state=(state) end if state.to_s.length < 1 - fail ArgumentError, 'invalid value for "state", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "state", the character length must be greater than or equal to 1.' end @state = state @@ -354,7 +360,7 @@ def url=(url) end if url.to_s.length < 1 - fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "url", the character length must be greater than or equal to 1.' end @url = url @@ -409,61 +415,6 @@ def self.build_from_hash(attributes) 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 @@ -479,23 +430,5 @@ def to_hash 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/answer_callback.rb b/lib/bandwidth-sdk/models/answer_callback.rb index 69a86a7e..29f9d8d1 100644 --- a/lib/bandwidth-sdk/models/answer_callback.rb +++ b/lib/bandwidth-sdk/models/answer_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Answer event is sent to the answerUrl specified in the createCall request when an outbound call is answered. - class AnswerCallback + class AnswerCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -98,9 +98,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -141,9 +146,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::AnswerCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AnswerCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -276,61 +282,6 @@ def self.build_from_hash(attributes) 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 @@ -346,23 +297,5 @@ def to_hash 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/async_lookup_request.rb b/lib/bandwidth-sdk/models/async_lookup_request.rb index 81f63e47..bd389196 100644 --- a/lib/bandwidth-sdk/models/async_lookup_request.rb +++ b/lib/bandwidth-sdk/models/async_lookup_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class AsyncLookupRequest + class AsyncLookupRequest < ApiModelBase # Telephone numbers in E.164 format. attr_accessor :phone_numbers @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::AsyncLookupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AsyncLookupRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -140,61 +146,6 @@ def self.build_from_hash(attributes) 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 @@ -210,23 +161,5 @@ def to_hash 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/blocked_webhook.rb b/lib/bandwidth-sdk/models/blocked_webhook.rb index 28ff31b5..32875b4b 100644 --- a/lib/bandwidth-sdk/models/blocked_webhook.rb +++ b/lib/bandwidth-sdk/models/blocked_webhook.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class BlockedWebhook + class BlockedWebhook < ApiModelBase # User's account ID. attr_accessor :account_id @@ -66,9 +66,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -97,9 +102,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::BlockedWebhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::BlockedWebhook`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -139,7 +145,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 12.') end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -172,7 +178,7 @@ def phone_number=(phone_number) 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.' + fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.' end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -231,61 +237,6 @@ def self.build_from_hash(attributes) 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 @@ -301,23 +252,5 @@ def to_hash 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/bridge_complete_callback.rb b/lib/bandwidth-sdk/models/bridge_complete_callback.rb index dfe2c3ca..c5a9ae19 100644 --- a/lib/bandwidth-sdk/models/bridge_complete_callback.rb +++ b/lib/bandwidth-sdk/models/bridge_complete_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # If the target call leaves the , then this callback is sent to the bridgeCompleteUrl, and the BXML returned in it is executed on the call. If this webhook is sent, the Bridge Target Complete webhook is NOT sent. This callback is also sent if any problem occurs that prevents the calls to be bridged. - class BridgeCompleteCallback + class BridgeCompleteCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -107,9 +107,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -153,9 +158,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::BridgeCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::BridgeCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -298,61 +304,6 @@ def self.build_from_hash(attributes) 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 @@ -368,23 +319,5 @@ def to_hash 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/bridge_target_complete_callback.rb b/lib/bandwidth-sdk/models/bridge_target_complete_callback.rb index 33235d33..f38e105f 100644 --- a/lib/bandwidth-sdk/models/bridge_target_complete_callback.rb +++ b/lib/bandwidth-sdk/models/bridge_target_complete_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # If the originating call leaves the , then this callback is sent to the bridgeTargetCompleteUrl, and the BXML returned in it is executed on the target call. If this webhook is sent, the Bridge Complete webhook is NOT sent. - class BridgeTargetCompleteCallback + class BridgeTargetCompleteCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -95,9 +95,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -136,9 +141,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::BridgeTargetCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::BridgeTargetCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -266,61 +272,6 @@ def self.build_from_hash(attributes) 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 @@ -336,23 +287,5 @@ def to_hash 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/business_entity_type_enum.rb b/lib/bandwidth-sdk/models/business_entity_type_enum.rb index 0f01f9ec..1c91beff 100644 --- a/lib/bandwidth-sdk/models/business_entity_type_enum.rb +++ b/lib/bandwidth-sdk/models/business_entity_type_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/business_registration_type_enum.rb b/lib/bandwidth-sdk/models/business_registration_type_enum.rb index 6b89e45b..340eddeb 100644 --- a/lib/bandwidth-sdk/models/business_registration_type_enum.rb +++ b/lib/bandwidth-sdk/models/business_registration_type_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/call_direction_enum.rb b/lib/bandwidth-sdk/models/call_direction_enum.rb index 7c7aa20c..6b5071ed 100644 --- a/lib/bandwidth-sdk/models/call_direction_enum.rb +++ b/lib/bandwidth-sdk/models/call_direction_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/call_recording_metadata.rb b/lib/bandwidth-sdk/models/call_recording_metadata.rb index 4df0d6ff..7107c398 100644 --- a/lib/bandwidth-sdk/models/call_recording_metadata.rb +++ b/lib/bandwidth-sdk/models/call_recording_metadata.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CallRecordingMetadata + class CallRecordingMetadata < ApiModelBase # The id of the application associated with the call. attr_accessor :application_id @@ -116,9 +116,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -162,9 +167,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CallRecordingMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallRecordingMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -322,61 +328,6 @@ def self.build_from_hash(attributes) 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 @@ -392,23 +343,5 @@ def to_hash 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/call_state.rb b/lib/bandwidth-sdk/models/call_state.rb index 44c22f29..1b79604c 100644 --- a/lib/bandwidth-sdk/models/call_state.rb +++ b/lib/bandwidth-sdk/models/call_state.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CallState + class CallState < ApiModelBase # The application id associated with the call. attr_accessor :application_id @@ -114,9 +114,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -167,9 +172,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CallState`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallState`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -324,61 +330,6 @@ def self.build_from_hash(attributes) 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 @@ -394,23 +345,5 @@ def to_hash 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/call_state_enum.rb b/lib/bandwidth-sdk/models/call_state_enum.rb index 4535e63a..d1767cdc 100644 --- a/lib/bandwidth-sdk/models/call_state_enum.rb +++ b/lib/bandwidth-sdk/models/call_state_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/call_transcription.rb b/lib/bandwidth-sdk/models/call_transcription.rb index c5d498bc..7152acaa 100644 --- a/lib/bandwidth-sdk/models/call_transcription.rb +++ b/lib/bandwidth-sdk/models/call_transcription.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CallTranscription + class CallTranscription < ApiModelBase attr_accessor :detected_language attr_accessor :track @@ -57,9 +57,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -86,9 +91,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CallTranscription`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallTranscription`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -199,61 +205,6 @@ def self.build_from_hash(attributes) 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 @@ -269,23 +220,5 @@ def to_hash 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/call_transcription_detected_language_enum.rb b/lib/bandwidth-sdk/models/call_transcription_detected_language_enum.rb index d177547b..f0c67647 100644 --- a/lib/bandwidth-sdk/models/call_transcription_detected_language_enum.rb +++ b/lib/bandwidth-sdk/models/call_transcription_detected_language_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/call_transcription_metadata.rb b/lib/bandwidth-sdk/models/call_transcription_metadata.rb index 2a18bdc1..4f6753ec 100644 --- a/lib/bandwidth-sdk/models/call_transcription_metadata.rb +++ b/lib/bandwidth-sdk/models/call_transcription_metadata.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CallTranscriptionMetadata + class CallTranscriptionMetadata < ApiModelBase # The programmable voice API transcription ID. attr_accessor :transcription_id @@ -33,9 +33,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -61,9 +66,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CallTranscriptionMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallTranscriptionMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -141,61 +147,6 @@ def self.build_from_hash(attributes) 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 @@ -211,23 +162,5 @@ def to_hash 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/call_transcription_response.rb b/lib/bandwidth-sdk/models/call_transcription_response.rb index 0c20b9bf..81b0ada3 100644 --- a/lib/bandwidth-sdk/models/call_transcription_response.rb +++ b/lib/bandwidth-sdk/models/call_transcription_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CallTranscriptionResponse + class CallTranscriptionResponse < ApiModelBase # The user account associated with the call. attr_accessor :account_id @@ -36,9 +36,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -65,9 +70,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CallTranscriptionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CallTranscriptionResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -152,61 +158,6 @@ def self.build_from_hash(attributes) 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 @@ -222,23 +173,5 @@ def to_hash 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/call_transcription_track_enum.rb b/lib/bandwidth-sdk/models/call_transcription_track_enum.rb index d09ca316..c8b0e51d 100644 --- a/lib/bandwidth-sdk/models/call_transcription_track_enum.rb +++ b/lib/bandwidth-sdk/models/call_transcription_track_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/callback.rb b/lib/bandwidth-sdk/models/callback.rb index f1e78463..3ac6dbaa 100644 --- a/lib/bandwidth-sdk/models/callback.rb +++ b/lib/bandwidth-sdk/models/callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/callback_method_enum.rb b/lib/bandwidth-sdk/models/callback_method_enum.rb index 432ab823..51bbba44 100644 --- a/lib/bandwidth-sdk/models/callback_method_enum.rb +++ b/lib/bandwidth-sdk/models/callback_method_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/card_width_enum.rb b/lib/bandwidth-sdk/models/card_width_enum.rb index 8b75937a..caacb64b 100644 --- a/lib/bandwidth-sdk/models/card_width_enum.rb +++ b/lib/bandwidth-sdk/models/card_width_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/code_request.rb b/lib/bandwidth-sdk/models/code_request.rb index c248df15..d97ce1fc 100644 --- a/lib/bandwidth-sdk/models/code_request.rb +++ b/lib/bandwidth-sdk/models/code_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CodeRequest + class CodeRequest < ApiModelBase # The phone number to send the mfa code to. attr_accessor :to @@ -45,9 +45,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CodeRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CodeRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -342,61 +348,6 @@ def self.build_from_hash(attributes) 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 @@ -412,23 +363,5 @@ def to_hash 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/completed_lookup_status_enum.rb b/lib/bandwidth-sdk/models/completed_lookup_status_enum.rb index acc4e519..9a4cf8e4 100644 --- a/lib/bandwidth-sdk/models/completed_lookup_status_enum.rb +++ b/lib/bandwidth-sdk/models/completed_lookup_status_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/conference.rb b/lib/bandwidth-sdk/models/conference.rb index 0ab8bf8e..66672b7e 100644 --- a/lib/bandwidth-sdk/models/conference.rb +++ b/lib/bandwidth-sdk/models/conference.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class Conference + class Conference < ApiModelBase # The Bandwidth-generated conference ID. attr_accessor :id @@ -74,9 +74,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -112,9 +117,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::Conference`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Conference`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -221,61 +227,6 @@ def self.build_from_hash(attributes) 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 @@ -291,23 +242,5 @@ def to_hash 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/conference_completed_callback.rb b/lib/bandwidth-sdk/models/conference_completed_callback.rb index 44d822a9..0f01dec1 100644 --- a/lib/bandwidth-sdk/models/conference_completed_callback.rb +++ b/lib/bandwidth-sdk/models/conference_completed_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Conference Completed event is fired when the last member leaves the conference. The response to this event may not contain BXML. - class ConferenceCompletedCallback + class ConferenceCompletedCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -42,9 +42,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -73,9 +78,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::ConferenceCompletedCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceCompletedCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -163,61 +169,6 @@ def self.build_from_hash(attributes) 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 @@ -233,23 +184,5 @@ def to_hash 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/conference_created_callback.rb b/lib/bandwidth-sdk/models/conference_created_callback.rb index eb1a66ad..673119ea 100644 --- a/lib/bandwidth-sdk/models/conference_created_callback.rb +++ b/lib/bandwidth-sdk/models/conference_created_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Conference Created event is fired whenever a new conference that specified a callbackUrl is created. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. - class ConferenceCreatedCallback + class ConferenceCreatedCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -42,9 +42,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -73,9 +78,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::ConferenceCreatedCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceCreatedCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -163,61 +169,6 @@ def self.build_from_hash(attributes) 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 @@ -233,23 +184,5 @@ def to_hash 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/conference_member.rb b/lib/bandwidth-sdk/models/conference_member.rb index 6d4928ba..f4c44b2a 100644 --- a/lib/bandwidth-sdk/models/conference_member.rb +++ b/lib/bandwidth-sdk/models/conference_member.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class ConferenceMember + class ConferenceMember < ApiModelBase # The call id associated with the event. attr_accessor :call_id @@ -45,9 +45,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -77,9 +82,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::ConferenceMember`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceMember`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -174,61 +180,6 @@ def self.build_from_hash(attributes) 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 @@ -244,23 +195,5 @@ def to_hash 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/conference_member_exit_callback.rb b/lib/bandwidth-sdk/models/conference_member_exit_callback.rb index f0f32f4a..83770410 100644 --- a/lib/bandwidth-sdk/models/conference_member_exit_callback.rb +++ b/lib/bandwidth-sdk/models/conference_member_exit_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Conference Member Exit event is fired whenever a caller exits a conference that specified a callbackUrl. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. - class ConferenceMemberExitCallback + class ConferenceMemberExitCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -54,9 +54,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -88,9 +93,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::ConferenceMemberExitCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceMemberExitCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -193,61 +199,6 @@ def self.build_from_hash(attributes) 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 @@ -263,23 +214,5 @@ def to_hash 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/conference_member_join_callback.rb b/lib/bandwidth-sdk/models/conference_member_join_callback.rb index ad3a5416..2220cdbd 100644 --- a/lib/bandwidth-sdk/models/conference_member_join_callback.rb +++ b/lib/bandwidth-sdk/models/conference_member_join_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Conference Member Join event is fired whenever a caller joins a conference that specified a callbackUrl. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. - class ConferenceMemberJoinCallback + class ConferenceMemberJoinCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -54,9 +54,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -88,9 +93,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::ConferenceMemberJoinCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceMemberJoinCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -193,61 +199,6 @@ def self.build_from_hash(attributes) 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 @@ -263,23 +214,5 @@ def to_hash 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/conference_recording_available_callback.rb b/lib/bandwidth-sdk/models/conference_recording_available_callback.rb index 0fda6447..b7e3dcbc 100644 --- a/lib/bandwidth-sdk/models/conference_recording_available_callback.rb +++ b/lib/bandwidth-sdk/models/conference_recording_available_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Conference Recording Available event is sent after a conference recording has been processed. It indicates that the recording is available for download. - class ConferenceRecordingAvailableCallback + class ConferenceRecordingAvailableCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -99,9 +99,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -140,9 +145,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::ConferenceRecordingAvailableCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceRecordingAvailableCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -275,61 +281,6 @@ def self.build_from_hash(attributes) 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 @@ -345,23 +296,5 @@ def to_hash 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/conference_recording_metadata.rb b/lib/bandwidth-sdk/models/conference_recording_metadata.rb index 76233926..cfe850ac 100644 --- a/lib/bandwidth-sdk/models/conference_recording_metadata.rb +++ b/lib/bandwidth-sdk/models/conference_recording_metadata.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class ConferenceRecordingMetadata + class ConferenceRecordingMetadata < ApiModelBase # The user account associated with the call. attr_accessor :account_id @@ -90,9 +90,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -128,9 +133,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::ConferenceRecordingMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceRecordingMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -253,61 +259,6 @@ def self.build_from_hash(attributes) 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 @@ -323,23 +274,5 @@ def to_hash 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/conference_redirect_callback.rb b/lib/bandwidth-sdk/models/conference_redirect_callback.rb index a6d3e28a..3ce09403 100644 --- a/lib/bandwidth-sdk/models/conference_redirect_callback.rb +++ b/lib/bandwidth-sdk/models/conference_redirect_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Conference Redirect event is fired whenever an existing conference is modified via a POST request made to the /conferences/{conferenceId} endpoint. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. - class ConferenceRedirectCallback + class ConferenceRedirectCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -42,9 +42,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -73,9 +78,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::ConferenceRedirectCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ConferenceRedirectCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -163,61 +169,6 @@ def self.build_from_hash(attributes) 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 @@ -233,23 +184,5 @@ def to_hash 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/conference_state_enum.rb b/lib/bandwidth-sdk/models/conference_state_enum.rb index 5c01c899..5f11882e 100644 --- a/lib/bandwidth-sdk/models/conference_state_enum.rb +++ b/lib/bandwidth-sdk/models/conference_state_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/contact.rb b/lib/bandwidth-sdk/models/contact.rb index 510e5957..48271bd2 100644 --- a/lib/bandwidth-sdk/models/contact.rb +++ b/lib/bandwidth-sdk/models/contact.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class Contact + class Contact < ApiModelBase # The first name of the business contact using the toll-free number. attr_accessor :first_name @@ -36,9 +36,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -65,9 +70,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -111,7 +117,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "first_name", the character length must be greater than or equal to 1.') end if @last_name.nil? @@ -123,7 +129,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "last_name", the character length must be greater than or equal to 1.') end if @email.nil? @@ -135,7 +141,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "email", the character length must be greater 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])+)\])$/) @@ -152,7 +158,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 1.') end invalid_properties @@ -190,7 +196,7 @@ def first_name=(first_name) 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.' + fail ArgumentError, 'invalid value for "first_name", the character length must be greater than or equal to 1.' end @first_name = first_name @@ -208,7 +214,7 @@ def last_name=(last_name) 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.' + fail ArgumentError, 'invalid value for "last_name", the character length must be greater than or equal to 1.' end @last_name = last_name @@ -226,7 +232,7 @@ def email=(email) end if email.to_s.length < 0 - fail ArgumentError, 'invalid value for "email", the character length must be great than or equal to 0.' + fail ArgumentError, 'invalid value for "email", the character length must be greater 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])+)\])$/) @@ -249,7 +255,7 @@ def phone_number=(phone_number) 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.' + fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 1.' end @phone_number = phone_number @@ -301,61 +307,6 @@ def self.build_from_hash(attributes) 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 @@ -371,23 +322,5 @@ def to_hash 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/create_async_bulk_lookup_response.rb b/lib/bandwidth-sdk/models/create_async_bulk_lookup_response.rb index 4211079b..0860e9f2 100644 --- a/lib/bandwidth-sdk/models/create_async_bulk_lookup_response.rb +++ b/lib/bandwidth-sdk/models/create_async_bulk_lookup_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CreateAsyncBulkLookupResponse + class CreateAsyncBulkLookupResponse < ApiModelBase # Links for pagination (if applicable) attr_accessor :links @@ -31,9 +31,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CreateAsyncBulkLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateAsyncBulkLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -143,61 +149,6 @@ def self.build_from_hash(attributes) 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 @@ -213,23 +164,5 @@ def to_hash 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/create_async_bulk_lookup_response_data.rb b/lib/bandwidth-sdk/models/create_async_bulk_lookup_response_data.rb index 84b9277b..ff1e8961 100644 --- a/lib/bandwidth-sdk/models/create_async_bulk_lookup_response_data.rb +++ b/lib/bandwidth-sdk/models/create_async_bulk_lookup_response_data.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The phone number lookup response data - class CreateAsyncBulkLookupResponseData + class CreateAsyncBulkLookupResponseData < ApiModelBase # The phone number lookup request ID from Bandwidth. attr_accessor :request_id @@ -51,9 +51,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -78,9 +83,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CreateAsyncBulkLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateAsyncBulkLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -153,61 +159,6 @@ def self.build_from_hash(attributes) 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 @@ -223,23 +174,5 @@ def to_hash 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/create_call.rb b/lib/bandwidth-sdk/models/create_call.rb index 32acc113..8cb833a9 100644 --- a/lib/bandwidth-sdk/models/create_call.rb +++ b/lib/bandwidth-sdk/models/create_call.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CreateCall + class CreateCall < ApiModelBase # The destination to call (must be an E.164 formatted number (e.g. `+15555551212`) or a SIP URI (e.g. `sip:user@server.example`)). attr_accessor :to @@ -123,9 +123,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -185,9 +190,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CreateCall`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateCall`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -407,6 +413,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] to Value to be assigned + def to=(to) + if to.nil? + fail ArgumentError, 'to cannot be nil' + end + + @to = to + end + + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + # Custom attribute writer method with validation # @param [Object] display_name Value to be assigned def display_name=(display_name) @@ -417,6 +443,16 @@ def display_name=(display_name) @display_name = display_name end + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + # Custom attribute writer method with validation # @param [Object] answer_url Value to be assigned def answer_url=(answer_url) @@ -606,61 +642,6 @@ def self.build_from_hash(attributes) 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 @@ -676,23 +657,5 @@ def to_hash 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/create_call_response.rb b/lib/bandwidth-sdk/models/create_call_response.rb index b35994e5..d2fe06c1 100644 --- a/lib/bandwidth-sdk/models/create_call_response.rb +++ b/lib/bandwidth-sdk/models/create_call_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CreateCallResponse + class CreateCallResponse < ApiModelBase # The id of the application associated with the `from` number. attr_accessor :application_id @@ -124,9 +124,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -182,9 +187,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CreateCallResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateCallResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -364,6 +370,76 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + + # Custom attribute writer method with validation + # @param [Object] account_id Value to be assigned + def account_id=(account_id) + if account_id.nil? + fail ArgumentError, 'account_id cannot be nil' + end + + @account_id = account_id + end + + # Custom attribute writer method with validation + # @param [Object] call_id Value to be assigned + def call_id=(call_id) + if call_id.nil? + fail ArgumentError, 'call_id cannot be nil' + end + + @call_id = call_id + end + + # Custom attribute writer method with validation + # @param [Object] to Value to be assigned + def to=(to) + if to.nil? + fail ArgumentError, 'to cannot be nil' + end + + @to = to + end + + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + + # Custom attribute writer method with validation + # @param [Object] call_url Value to be assigned + def call_url=(call_url) + if call_url.nil? + fail ArgumentError, 'call_url cannot be nil' + end + + @call_url = call_url + end + + # Custom attribute writer method with validation + # @param [Object] answer_url Value to be assigned + def answer_url=(answer_url) + if answer_url.nil? + fail ArgumentError, 'answer_url cannot be nil' + end + + @answer_url = answer_url + end + # Custom attribute writer method with validation # @param [Object] username Value to be assigned def username=(username) @@ -467,61 +543,6 @@ def self.build_from_hash(attributes) 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 @@ -537,23 +558,5 @@ def to_hash 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/create_message_request_error.rb b/lib/bandwidth-sdk/models/create_message_request_error.rb index 12be3a00..03c8fb46 100644 --- a/lib/bandwidth-sdk/models/create_message_request_error.rb +++ b/lib/bandwidth-sdk/models/create_message_request_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CreateMessageRequestError + class CreateMessageRequestError < ApiModelBase attr_accessor :type attr_accessor :description @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CreateMessageRequestError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateMessageRequestError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -109,6 +115,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + 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 + + @description = description + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -154,61 +180,6 @@ def self.build_from_hash(attributes) 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 @@ -224,23 +195,5 @@ def to_hash 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/create_multi_channel_message_response.rb b/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb index 7fea85ab..5787f125 100644 --- a/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb +++ b/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CreateMultiChannelMessageResponse + class CreateMultiChannelMessageResponse < ApiModelBase attr_accessor :links attr_accessor :data @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CreateMultiChannelMessageResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateMultiChannelMessageResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -142,61 +148,6 @@ def self.build_from_hash(attributes) 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 @@ -212,23 +163,5 @@ def to_hash 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/create_sync_lookup_response.rb b/lib/bandwidth-sdk/models/create_sync_lookup_response.rb index 4182bb86..c6f7b0d6 100644 --- a/lib/bandwidth-sdk/models/create_sync_lookup_response.rb +++ b/lib/bandwidth-sdk/models/create_sync_lookup_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class CreateSyncLookupResponse + class CreateSyncLookupResponse < ApiModelBase attr_accessor :links attr_accessor :data @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CreateSyncLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateSyncLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -142,61 +148,6 @@ def self.build_from_hash(attributes) 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 @@ -212,23 +163,5 @@ def to_hash 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/create_sync_lookup_response_data.rb b/lib/bandwidth-sdk/models/create_sync_lookup_response_data.rb index 4465ab3f..bd3a8465 100644 --- a/lib/bandwidth-sdk/models/create_sync_lookup_response_data.rb +++ b/lib/bandwidth-sdk/models/create_sync_lookup_response_data.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The phone number lookup response data - class CreateSyncLookupResponseData + class CreateSyncLookupResponseData < ApiModelBase # The phone number lookup request ID from Bandwidth. attr_accessor :request_id @@ -55,9 +55,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -83,9 +88,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::CreateSyncLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateSyncLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -165,61 +171,6 @@ def self.build_from_hash(attributes) 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 @@ -235,23 +186,5 @@ def to_hash 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/deactivation_event_enum.rb b/lib/bandwidth-sdk/models/deactivation_event_enum.rb index 02e45555..2569f83c 100644 --- a/lib/bandwidth-sdk/models/deactivation_event_enum.rb +++ b/lib/bandwidth-sdk/models/deactivation_event_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/disconnect_callback.rb b/lib/bandwidth-sdk/models/disconnect_callback.rb index 021f105f..fdad845b 100644 --- a/lib/bandwidth-sdk/models/disconnect_callback.rb +++ b/lib/bandwidth-sdk/models/disconnect_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Disconnect event is fired when a call ends, for any reason. - class DisconnectCallback + class DisconnectCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -111,9 +111,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -158,9 +163,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::DisconnectCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::DisconnectCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -308,61 +314,6 @@ def self.build_from_hash(attributes) 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 @@ -378,23 +329,5 @@ def to_hash 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/diversion.rb b/lib/bandwidth-sdk/models/diversion.rb index 2cb77aa7..a4c3ea1b 100644 --- a/lib/bandwidth-sdk/models/diversion.rb +++ b/lib/bandwidth-sdk/models/diversion.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class Diversion + class Diversion < ApiModelBase # The reason for the diversion. Common values: unknown, user-busy, no-answer, unavailable, unconditional, time-of-day, do-not-disturb, deflection, follow-me, out-of-service, away. attr_accessor :reason @@ -49,9 +49,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -81,9 +86,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::Diversion`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Diversion`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -181,61 +187,6 @@ def self.build_from_hash(attributes) 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 @@ -251,23 +202,5 @@ def to_hash 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/dtmf_callback.rb b/lib/bandwidth-sdk/models/dtmf_callback.rb index 28fa9d0a..24af28a7 100644 --- a/lib/bandwidth-sdk/models/dtmf_callback.rb +++ b/lib/bandwidth-sdk/models/dtmf_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The DTMF event is sent for every digit detected after a verb is executed. You may not respond to this event with BXML. - class DtmfCallback + class DtmfCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -111,9 +111,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -156,9 +161,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::DtmfCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::DtmfCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -306,61 +312,6 @@ def self.build_from_hash(attributes) 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 @@ -376,23 +327,5 @@ def to_hash 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 index c5cac684..a8e6b7f6 100644 --- a/lib/bandwidth-sdk/models/error.rb +++ b/lib/bandwidth-sdk/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class Error + class Error < ApiModelBase attr_accessor :code attr_accessor :description @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -140,61 +146,6 @@ def self.build_from_hash(attributes) 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 @@ -210,23 +161,5 @@ def to_hash 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_object.rb b/lib/bandwidth-sdk/models/error_object.rb index b4445297..fadca5e3 100644 --- a/lib/bandwidth-sdk/models/error_object.rb +++ b/lib/bandwidth-sdk/models/error_object.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class ErrorObject + class ErrorObject < ApiModelBase # A concise summary of the error used for categorization. attr_accessor :type @@ -32,9 +32,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -60,9 +65,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::ErrorObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ErrorObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -116,6 +122,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + 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 + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] source Value to be assigned + def source=(source) + if source.nil? + fail ArgumentError, 'source cannot be nil' + end + + @source = source + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -161,61 +197,6 @@ def self.build_from_hash(attributes) 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 @@ -231,23 +212,5 @@ def to_hash 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_source.rb b/lib/bandwidth-sdk/models/error_source.rb index d54fcd89..15566749 100644 --- a/lib/bandwidth-sdk/models/error_source.rb +++ b/lib/bandwidth-sdk/models/error_source.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # Specifies relevant sources of the error, if any. - class ErrorSource + class ErrorSource < ApiModelBase # The relevant URI query parameter causing the error attr_accessor :parameter @@ -38,9 +38,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -67,9 +72,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::ErrorSource`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ErrorSource`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -152,61 +158,6 @@ def self.build_from_hash(attributes) 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 @@ -222,23 +173,5 @@ def to_hash 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 index 2b84ef8c..6f78e04b 100644 --- a/lib/bandwidth-sdk/models/failure_webhook.rb +++ b/lib/bandwidth-sdk/models/failure_webhook.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class FailureWebhook + class FailureWebhook < ApiModelBase # User's account ID. attr_accessor :account_id @@ -45,9 +45,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -120,7 +126,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 12.') end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -153,7 +159,7 @@ def phone_number=(phone_number) 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.' + fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.' end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -212,61 +218,6 @@ def self.build_from_hash(attributes) 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 @@ -282,23 +233,5 @@ def to_hash 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/field_error.rb b/lib/bandwidth-sdk/models/field_error.rb index 1f7c03f6..9e9c09c8 100644 --- a/lib/bandwidth-sdk/models/field_error.rb +++ b/lib/bandwidth-sdk/models/field_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class FieldError + class FieldError < ApiModelBase # The name of the field that contains the error attr_accessor :field_name @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::FieldError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::FieldError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -131,61 +137,6 @@ def self.build_from_hash(attributes) 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 @@ -201,23 +152,5 @@ def to_hash 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/file_format_enum.rb b/lib/bandwidth-sdk/models/file_format_enum.rb index 88926490..d56d2ea6 100644 --- a/lib/bandwidth-sdk/models/file_format_enum.rb +++ b/lib/bandwidth-sdk/models/file_format_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/gather_callback.rb b/lib/bandwidth-sdk/models/gather_callback.rb index b410ebe3..1da0e118 100644 --- a/lib/bandwidth-sdk/models/gather_callback.rb +++ b/lib/bandwidth-sdk/models/gather_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The gather event is sent after a verb is executed. Its purpose is to report the gathered digits to the calling application. - class GatherCallback + class GatherCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -115,9 +115,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -161,9 +166,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::GatherCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::GatherCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -316,61 +322,6 @@ def self.build_from_hash(attributes) 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 @@ -386,23 +337,5 @@ def to_hash 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/get_async_bulk_lookup_response.rb b/lib/bandwidth-sdk/models/get_async_bulk_lookup_response.rb index 7b51cda2..2fb43065 100644 --- a/lib/bandwidth-sdk/models/get_async_bulk_lookup_response.rb +++ b/lib/bandwidth-sdk/models/get_async_bulk_lookup_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class GetAsyncBulkLookupResponse + class GetAsyncBulkLookupResponse < ApiModelBase attr_accessor :links attr_accessor :data @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::GetAsyncBulkLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::GetAsyncBulkLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -142,61 +148,6 @@ def self.build_from_hash(attributes) 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 @@ -212,23 +163,5 @@ def to_hash 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/get_async_bulk_lookup_response_data.rb b/lib/bandwidth-sdk/models/get_async_bulk_lookup_response_data.rb index 1ae2ba30..7c72dc25 100644 --- a/lib/bandwidth-sdk/models/get_async_bulk_lookup_response_data.rb +++ b/lib/bandwidth-sdk/models/get_async_bulk_lookup_response_data.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The phone number lookup response data - class GetAsyncBulkLookupResponseData + class GetAsyncBulkLookupResponseData < ApiModelBase # The phone number lookup request ID from Bandwidth. attr_accessor :request_id @@ -55,9 +55,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -83,9 +88,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::GetAsyncBulkLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::GetAsyncBulkLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -165,61 +171,6 @@ def self.build_from_hash(attributes) 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 @@ -235,23 +186,5 @@ def to_hash 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/in_progress_lookup_status_enum.rb b/lib/bandwidth-sdk/models/in_progress_lookup_status_enum.rb index ee8e3e90..2deaa9ec 100644 --- a/lib/bandwidth-sdk/models/in_progress_lookup_status_enum.rb +++ b/lib/bandwidth-sdk/models/in_progress_lookup_status_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/inbound_callback.rb b/lib/bandwidth-sdk/models/inbound_callback.rb index 94d914a2..9f4bedb2 100644 --- a/lib/bandwidth-sdk/models/inbound_callback.rb +++ b/lib/bandwidth-sdk/models/inbound_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # Represents an inbound callback. - class InboundCallback + class InboundCallback < ApiModelBase attr_accessor :time attr_accessor :type @@ -65,9 +65,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -96,9 +101,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::InboundCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::InboundCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -178,6 +184,56 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] time Value to be assigned + def time=(time) + if time.nil? + fail ArgumentError, 'time cannot be nil' + end + + @time = time + end + + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + + # Custom attribute writer method with validation + # @param [Object] to Value to be assigned + def to=(to) + if to.nil? + fail ArgumentError, 'to cannot be nil' + end + + @to = to + 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 + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -226,61 +282,6 @@ def self.build_from_hash(attributes) 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 @@ -296,23 +297,5 @@ def to_hash 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/inbound_callback_message.rb b/lib/bandwidth-sdk/models/inbound_callback_message.rb index 933622b4..3c2356c7 100644 --- a/lib/bandwidth-sdk/models/inbound_callback_message.rb +++ b/lib/bandwidth-sdk/models/inbound_callback_message.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class InboundCallbackMessage + class InboundCallbackMessage < ApiModelBase # A unique identifier of the message. attr_accessor :id @@ -99,9 +99,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -147,9 +152,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::InboundCallbackMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::InboundCallbackMessage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -294,6 +300,66 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] owner Value to be assigned + def owner=(owner) + if owner.nil? + fail ArgumentError, 'owner cannot be nil' + end + + @owner = owner + end + + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + + # Custom attribute writer method with validation + # @param [Object] time Value to be assigned + def time=(time) + if time.nil? + fail ArgumentError, 'time cannot be nil' + end + + @time = time + end + + # Custom attribute writer method with validation + # @param [Object] segment_count Value to be assigned + def segment_count=(segment_count) + if segment_count.nil? + fail ArgumentError, 'segment_count cannot be nil' + end + + @segment_count = segment_count + end + + # Custom attribute writer method with validation + # @param [Object] direction Value to be assigned + def direction=(direction) + if direction.nil? + fail ArgumentError, 'direction cannot be nil' + end + + @direction = direction + end + # Custom attribute writer method with validation # @param [Object] to Value to be assigned def to=(to) @@ -304,6 +370,16 @@ def to=(to) @to = to end + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -362,61 +438,6 @@ def self.build_from_hash(attributes) 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 @@ -432,23 +453,5 @@ def to_hash 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/inbound_callback_type_enum.rb b/lib/bandwidth-sdk/models/inbound_callback_type_enum.rb index 78721cea..c0f2e285 100644 --- a/lib/bandwidth-sdk/models/inbound_callback_type_enum.rb +++ b/lib/bandwidth-sdk/models/inbound_callback_type_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/initiate_callback.rb b/lib/bandwidth-sdk/models/initiate_callback.rb index bb2257ee..45292da7 100644 --- a/lib/bandwidth-sdk/models/initiate_callback.rb +++ b/lib/bandwidth-sdk/models/initiate_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Initiate event is fired when an inbound call is received for a Telephone Number on your Account. It is sent to the URL specified in the application associated with the location (sip-peer) that the called telephone number belongs to. - class InitiateCallback + class InitiateCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -93,9 +93,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -131,9 +136,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::InitiateCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::InitiateCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -280,61 +286,6 @@ def self.build_from_hash(attributes) 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 @@ -350,23 +301,5 @@ def to_hash 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/latest_message_delivery_status_enum.rb b/lib/bandwidth-sdk/models/latest_message_delivery_status_enum.rb index a12caa2d..98cb6723 100644 --- a/lib/bandwidth-sdk/models/latest_message_delivery_status_enum.rb +++ b/lib/bandwidth-sdk/models/latest_message_delivery_status_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/line_type_enum.rb b/lib/bandwidth-sdk/models/line_type_enum.rb index 9503fe1a..bb7e31b7 100644 --- a/lib/bandwidth-sdk/models/line_type_enum.rb +++ b/lib/bandwidth-sdk/models/line_type_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/link.rb b/lib/bandwidth-sdk/models/link.rb index 49e34481..6de73728 100644 --- a/lib/bandwidth-sdk/models/link.rb +++ b/lib/bandwidth-sdk/models/link.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class Link + class Link < ApiModelBase attr_accessor :rel attr_accessor :href @@ -27,9 +27,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::Link`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Link`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -129,61 +135,6 @@ def self.build_from_hash(attributes) 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 @@ -199,23 +150,5 @@ def to_hash 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/link_schema.rb b/lib/bandwidth-sdk/models/link_schema.rb index ce6132cb..256639cc 100644 --- a/lib/bandwidth-sdk/models/link_schema.rb +++ b/lib/bandwidth-sdk/models/link_schema.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class LinkSchema + class LinkSchema < ApiModelBase # URI of the link. attr_accessor :href @@ -33,9 +33,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -61,9 +66,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::LinkSchema`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LinkSchema`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -141,61 +147,6 @@ def self.build_from_hash(attributes) 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 @@ -211,23 +162,5 @@ def to_hash 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 index 2d6181e9..16e11dfa 100644 --- a/lib/bandwidth-sdk/models/links_object.rb +++ b/lib/bandwidth-sdk/models/links_object.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class LinksObject + class LinksObject < ApiModelBase # The first (or only) page of results matching the query. attr_accessor :first @@ -37,9 +37,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -66,9 +71,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -151,61 +157,6 @@ def self.build_from_hash(attributes) 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 @@ -221,23 +172,5 @@ def to_hash 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/list_message_direction_enum.rb b/lib/bandwidth-sdk/models/list_message_direction_enum.rb index 7255ff24..ca2dd890 100644 --- a/lib/bandwidth-sdk/models/list_message_direction_enum.rb +++ b/lib/bandwidth-sdk/models/list_message_direction_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/list_message_item.rb b/lib/bandwidth-sdk/models/list_message_item.rb index b121a706..29d0b52d 100644 --- a/lib/bandwidth-sdk/models/list_message_item.rb +++ b/lib/bandwidth-sdk/models/list_message_item.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class ListMessageItem + class ListMessageItem < ApiModelBase # The message id attr_accessor :message_id @@ -132,9 +132,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -192,9 +197,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::ListMessageItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::ListMessageItem`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -372,61 +378,6 @@ def self.build_from_hash(attributes) 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 @@ -442,23 +393,5 @@ def to_hash 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/lookup_error_response.rb b/lib/bandwidth-sdk/models/lookup_error_response.rb index 118a4572..bf555240 100644 --- a/lib/bandwidth-sdk/models/lookup_error_response.rb +++ b/lib/bandwidth-sdk/models/lookup_error_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class LookupErrorResponse + class LookupErrorResponse < ApiModelBase attr_accessor :links # The phone number lookup response data @@ -31,9 +31,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::LookupErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -143,61 +149,6 @@ def self.build_from_hash(attributes) 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 @@ -213,23 +164,5 @@ def to_hash 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/lookup_error_schema.rb b/lib/bandwidth-sdk/models/lookup_error_schema.rb index a48f08a1..c4ae5de3 100644 --- a/lib/bandwidth-sdk/models/lookup_error_schema.rb +++ b/lib/bandwidth-sdk/models/lookup_error_schema.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class LookupErrorSchema + class LookupErrorSchema < ApiModelBase # Validation error code attr_accessor :code @@ -36,9 +36,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -65,9 +70,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::LookupErrorSchema`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupErrorSchema`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -150,61 +156,6 @@ def self.build_from_hash(attributes) 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 @@ -220,23 +171,5 @@ def to_hash 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/lookup_error_schema_meta.rb b/lib/bandwidth-sdk/models/lookup_error_schema_meta.rb index 6fe60570..b0cb9730 100644 --- a/lib/bandwidth-sdk/models/lookup_error_schema_meta.rb +++ b/lib/bandwidth-sdk/models/lookup_error_schema_meta.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class LookupErrorSchemaMeta + class LookupErrorSchemaMeta < ApiModelBase attr_accessor :phone_numbers # Message describing the error @@ -32,9 +32,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -60,9 +65,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::LookupErrorSchemaMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupErrorSchemaMeta`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -142,61 +148,6 @@ def self.build_from_hash(attributes) 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 @@ -212,23 +163,5 @@ def to_hash 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/lookup_result.rb b/lib/bandwidth-sdk/models/lookup_result.rb index 5a036e72..b7def89e 100644 --- a/lib/bandwidth-sdk/models/lookup_result.rb +++ b/lib/bandwidth-sdk/models/lookup_result.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # Carrier information results for the specified telephone number. - class LookupResult + class LookupResult < ApiModelBase # The telephone number in E.164 format. attr_accessor :phone_number @@ -85,9 +85,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -121,9 +126,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::LookupResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -241,61 +247,6 @@ def self.build_from_hash(attributes) 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 @@ -311,23 +262,5 @@ def to_hash 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/machine_detection_complete_callback.rb b/lib/bandwidth-sdk/models/machine_detection_complete_callback.rb index 69675e73..e9b88153 100644 --- a/lib/bandwidth-sdk/models/machine_detection_complete_callback.rb +++ b/lib/bandwidth-sdk/models/machine_detection_complete_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # This event is sent to the url informed when requesting a machine detection operation. It contains the machine detection operation result, which can be: human, answering-machine, silence, timeout, error. This event is not sent when sync answering machine detection mode is chosen. - class MachineDetectionCompleteCallback + class MachineDetectionCompleteCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -98,9 +98,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -141,9 +146,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MachineDetectionCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MachineDetectionCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -276,61 +282,6 @@ def self.build_from_hash(attributes) 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 @@ -346,23 +297,5 @@ def to_hash 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/machine_detection_configuration.rb b/lib/bandwidth-sdk/models/machine_detection_configuration.rb index 7b61a7e3..52f44aef 100644 --- a/lib/bandwidth-sdk/models/machine_detection_configuration.rb +++ b/lib/bandwidth-sdk/models/machine_detection_configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The machine detection request used to perform machine detection on the call. Currently, there is an issue where decimal values are not getting processed correctly. Please use whole number values. We are working to resolve this issue. Please contact Bandwidth Support if you need more information. - class MachineDetectionConfiguration + class MachineDetectionConfiguration < ApiModelBase attr_accessor :mode # The timeout used for the whole operation, in seconds. If no result is determined in this period, a callback with a `timeout` result is sent. @@ -101,9 +101,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -155,9 +160,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MachineDetectionConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MachineDetectionConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -401,61 +407,6 @@ def self.build_from_hash(attributes) 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 @@ -471,23 +422,5 @@ def to_hash 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/machine_detection_mode_enum.rb b/lib/bandwidth-sdk/models/machine_detection_mode_enum.rb index cd64e339..94ef5ed1 100644 --- a/lib/bandwidth-sdk/models/machine_detection_mode_enum.rb +++ b/lib/bandwidth-sdk/models/machine_detection_mode_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/machine_detection_result.rb b/lib/bandwidth-sdk/models/machine_detection_result.rb index 42c57a7f..052ca36a 100644 --- a/lib/bandwidth-sdk/models/machine_detection_result.rb +++ b/lib/bandwidth-sdk/models/machine_detection_result.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # (optional) if machine detection was requested in sync mode, the result will be specified here. Possible values are the same as the async counterpart: Machine Detection Complete - class MachineDetectionResult + class MachineDetectionResult < ApiModelBase # Possible values are answering-machine, human, silence, timeout, or error. attr_accessor :value @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MachineDetectionResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MachineDetectionResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -132,61 +138,6 @@ def self.build_from_hash(attributes) 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 @@ -202,23 +153,5 @@ def to_hash 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/media.rb b/lib/bandwidth-sdk/models/media.rb index b939af38..7a4158c6 100644 --- a/lib/bandwidth-sdk/models/media.rb +++ b/lib/bandwidth-sdk/models/media.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class Media + class Media < ApiModelBase attr_accessor :content attr_accessor :content_length @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -58,9 +63,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::Media`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Media`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -138,61 +144,6 @@ def self.build_from_hash(attributes) 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 @@ -208,23 +159,5 @@ def to_hash 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/message.rb b/lib/bandwidth-sdk/models/message.rb index 288f81ff..8eae1dba 100644 --- a/lib/bandwidth-sdk/models/message.rb +++ b/lib/bandwidth-sdk/models/message.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class Message + class Message < ApiModelBase # The id of the message. attr_accessor :id @@ -93,9 +93,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -131,9 +136,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::Message`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Message`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -285,61 +291,6 @@ def self.build_from_hash(attributes) 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 @@ -355,23 +306,5 @@ def to_hash 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/message_direction_enum.rb b/lib/bandwidth-sdk/models/message_direction_enum.rb index 86aa0cc0..d9ec797d 100644 --- a/lib/bandwidth-sdk/models/message_direction_enum.rb +++ b/lib/bandwidth-sdk/models/message_direction_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/message_request.rb b/lib/bandwidth-sdk/models/message_request.rb index 6fdc3c6b..41e51cff 100644 --- a/lib/bandwidth-sdk/models/message_request.rb +++ b/lib/bandwidth-sdk/models/message_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MessageRequest + class MessageRequest < ApiModelBase # The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. attr_accessor :application_id @@ -74,9 +74,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -107,9 +112,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MessageRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessageRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -192,6 +198,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + # Custom attribute writer method with validation # @param [Object] to Value to be assigned def to=(to) @@ -202,6 +218,16 @@ def to=(to) @to = to end + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + # Custom attribute writer method with validation # @param [Object] text Value to be assigned def text=(text) @@ -266,61 +292,6 @@ def self.build_from_hash(attributes) 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 @@ -336,23 +307,5 @@ def to_hash 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/message_status_enum.rb b/lib/bandwidth-sdk/models/message_status_enum.rb index 148292a7..40906cf3 100644 --- a/lib/bandwidth-sdk/models/message_status_enum.rb +++ b/lib/bandwidth-sdk/models/message_status_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/message_type_enum.rb b/lib/bandwidth-sdk/models/message_type_enum.rb index 1398db84..d7e5306d 100644 --- a/lib/bandwidth-sdk/models/message_type_enum.rb +++ b/lib/bandwidth-sdk/models/message_type_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/messages_list.rb b/lib/bandwidth-sdk/models/messages_list.rb index e1eacd7d..1f48381a 100644 --- a/lib/bandwidth-sdk/models/messages_list.rb +++ b/lib/bandwidth-sdk/models/messages_list.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MessagesList + class MessagesList < ApiModelBase # The total number of messages matched by the search. When the request has limitTotalCount set to true this value is limited to 10,000. attr_accessor :total_count @@ -31,9 +31,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MessagesList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessagesList`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -141,61 +147,6 @@ def self.build_from_hash(attributes) 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 @@ -211,23 +162,5 @@ def to_hash 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/messaging_code_response.rb b/lib/bandwidth-sdk/models/messaging_code_response.rb index f6cbc716..a2095777 100644 --- a/lib/bandwidth-sdk/models/messaging_code_response.rb +++ b/lib/bandwidth-sdk/models/messaging_code_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MessagingCodeResponse + class MessagingCodeResponse < ApiModelBase # Messaging API Message ID. attr_accessor :message_id @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MessagingCodeResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessagingCodeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) 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 @@ -191,23 +142,5 @@ def to_hash 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/messaging_request_error.rb b/lib/bandwidth-sdk/models/messaging_request_error.rb index af181381..081e1887 100644 --- a/lib/bandwidth-sdk/models/messaging_request_error.rb +++ b/lib/bandwidth-sdk/models/messaging_request_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MessagingRequestError + class MessagingRequestError < ApiModelBase attr_accessor :type attr_accessor :description @@ -27,9 +27,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MessagingRequestError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessagingRequestError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -99,6 +105,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + 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 + + @description = description + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -143,61 +169,6 @@ def self.build_from_hash(attributes) 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 @@ -213,23 +184,5 @@ def to_hash 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/mfa_forbidden_request_error.rb b/lib/bandwidth-sdk/models/mfa_forbidden_request_error.rb index 74b288e1..e2becb95 100644 --- a/lib/bandwidth-sdk/models/mfa_forbidden_request_error.rb +++ b/lib/bandwidth-sdk/models/mfa_forbidden_request_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MfaForbiddenRequestError + class MfaForbiddenRequestError < ApiModelBase # The message containing the reason behind the request being forbidden. attr_accessor :message @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MfaForbiddenRequestError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MfaForbiddenRequestError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) 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 @@ -191,23 +142,5 @@ def to_hash 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/mfa_request_error.rb b/lib/bandwidth-sdk/models/mfa_request_error.rb index 40e3b912..3a97771b 100644 --- a/lib/bandwidth-sdk/models/mfa_request_error.rb +++ b/lib/bandwidth-sdk/models/mfa_request_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MfaRequestError + class MfaRequestError < ApiModelBase # A message describing the error with your request. attr_accessor :error @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MfaRequestError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MfaRequestError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -131,61 +137,6 @@ def self.build_from_hash(attributes) 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 @@ -201,23 +152,5 @@ def to_hash 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/mfa_unauthorized_request_error.rb b/lib/bandwidth-sdk/models/mfa_unauthorized_request_error.rb index 80b47460..ad5c1cd2 100644 --- a/lib/bandwidth-sdk/models/mfa_unauthorized_request_error.rb +++ b/lib/bandwidth-sdk/models/mfa_unauthorized_request_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MfaUnauthorizedRequestError + class MfaUnauthorizedRequestError < ApiModelBase # Unauthorized attr_accessor :message @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MfaUnauthorizedRequestError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MfaUnauthorizedRequestError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) 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 @@ -191,23 +142,5 @@ def to_hash 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/mms_message_content.rb b/lib/bandwidth-sdk/models/mms_message_content.rb index f66a7c40..46265feb 100644 --- a/lib/bandwidth-sdk/models/mms_message_content.rb +++ b/lib/bandwidth-sdk/models/mms_message_content.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MmsMessageContent + class MmsMessageContent < ApiModelBase # The contents of the text message. Must be 2048 characters or less. attr_accessor :text @@ -28,9 +28,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -55,9 +60,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MmsMessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MmsMessageContent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -151,61 +157,6 @@ def self.build_from_hash(attributes) 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 @@ -221,23 +172,5 @@ def to_hash 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/mms_message_content_file.rb b/lib/bandwidth-sdk/models/mms_message_content_file.rb index 3b132260..73265f8b 100644 --- a/lib/bandwidth-sdk/models/mms_message_content_file.rb +++ b/lib/bandwidth-sdk/models/mms_message_content_file.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MmsMessageContentFile + class MmsMessageContentFile < ApiModelBase # The URL of a media attachment. For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see [here](https://support.bandwidth.com/hc/en-us/articles/360014235473-What-are-the-MMS-file-size-limits) for more details. attr_accessor :file_url @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MmsMessageContentFile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MmsMessageContentFile`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -147,61 +153,6 @@ def self.build_from_hash(attributes) 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 @@ -217,23 +168,5 @@ def to_hash 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/multi_channel_action.rb b/lib/bandwidth-sdk/models/multi_channel_action.rb index 2b71d865..3be5f102 100644 --- a/lib/bandwidth-sdk/models/multi_channel_action.rb +++ b/lib/bandwidth-sdk/models/multi_channel_action.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -40,8 +40,7 @@ def build(data) openapi_any_of.each do |klass| begin next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data + return find_and_cast_into_type(klass, data) rescue # rescue all errors so we keep iterating even if the current item lookup raises end end @@ -67,7 +66,7 @@ def find_and_cast_into_type(klass, data) when 'Time' return Time.parse(data) when 'Date' - return Date.parse(data) + return Date.iso8601(data) when 'String' return data if data.instance_of?(String) when 'Object' # "type: object" diff --git a/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb b/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb index 02e9351b..b1818806 100644 --- a/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb +++ b/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MultiChannelActionCalendarEvent + class MultiChannelActionCalendarEvent < ApiModelBase attr_accessor :type # Displayed text for user to click @@ -70,9 +70,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -109,9 +114,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelActionCalendarEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelActionCalendarEvent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -222,6 +228,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + # Custom attribute writer method with validation # @param [Object] text Value to be assigned def text=(text) @@ -264,6 +280,26 @@ def title=(title) @title = title end + # Custom attribute writer method with validation + # @param [Object] start_time Value to be assigned + def start_time=(start_time) + if start_time.nil? + fail ArgumentError, 'start_time cannot be nil' + end + + @start_time = start_time + end + + # Custom attribute writer method with validation + # @param [Object] end_time Value to be assigned + def end_time=(end_time) + if end_time.nil? + fail ArgumentError, 'end_time cannot be nil' + end + + @end_time = end_time + end + # Custom attribute writer method with validation # @param [Object] description Value to be assigned def description=(description) @@ -327,61 +363,6 @@ def self.build_from_hash(attributes) 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 @@ -397,23 +378,5 @@ def to_hash 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/multi_channel_channel_list_mms_object.rb b/lib/bandwidth-sdk/models/multi_channel_channel_list_mms_object.rb index 0c88d652..84a15dc3 100644 --- a/lib/bandwidth-sdk/models/multi_channel_channel_list_mms_object.rb +++ b/lib/bandwidth-sdk/models/multi_channel_channel_list_mms_object.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MultiChannelChannelListMMSObject + class MultiChannelChannelListMMSObject < ApiModelBase # The sender ID of the message. This could be an alphanumeric sender ID. attr_accessor :from @@ -57,9 +57,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelChannelListMMSObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListMMSObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,46 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + + # Custom attribute writer method with validation + # @param [Object] channel Value to be assigned + def channel=(channel) + if channel.nil? + fail ArgumentError, 'channel cannot be nil' + end + + @channel = channel + end + + # Custom attribute writer method with validation + # @param [Object] content Value to be assigned + def content=(content) + if content.nil? + fail ArgumentError, 'content cannot be nil' + end + + @content = content + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -206,61 +252,6 @@ def self.build_from_hash(attributes) 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 @@ -276,23 +267,5 @@ def to_hash 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/multi_channel_channel_list_mms_response_object.rb b/lib/bandwidth-sdk/models/multi_channel_channel_list_mms_response_object.rb index b99ff2f1..18d4c66b 100644 --- a/lib/bandwidth-sdk/models/multi_channel_channel_list_mms_response_object.rb +++ b/lib/bandwidth-sdk/models/multi_channel_channel_list_mms_response_object.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MultiChannelChannelListMMSResponseObject + class MultiChannelChannelListMMSResponseObject < ApiModelBase # The sender ID of the message. This could be an alphanumeric sender ID. attr_accessor :from @@ -61,9 +61,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -99,9 +104,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelChannelListMMSResponseObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListMMSResponseObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -177,6 +183,56 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + + # Custom attribute writer method with validation + # @param [Object] channel Value to be assigned + def channel=(channel) + if channel.nil? + fail ArgumentError, 'channel cannot be nil' + end + + @channel = channel + end + + # Custom attribute writer method with validation + # @param [Object] content Value to be assigned + def content=(content) + if content.nil? + fail ArgumentError, 'content cannot be nil' + end + + @content = content + end + + # Custom attribute writer method with validation + # @param [Object] owner Value to be assigned + def owner=(owner) + if owner.nil? + fail ArgumentError, 'owner cannot be nil' + end + + @owner = owner + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -224,61 +280,6 @@ def self.build_from_hash(attributes) 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 @@ -294,23 +295,5 @@ def to_hash 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/multi_channel_channel_list_object_base.rb b/lib/bandwidth-sdk/models/multi_channel_channel_list_object_base.rb index 6d4b1146..f3f08827 100644 --- a/lib/bandwidth-sdk/models/multi_channel_channel_list_object_base.rb +++ b/lib/bandwidth-sdk/models/multi_channel_channel_list_object_base.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MultiChannelChannelListObjectBase + class MultiChannelChannelListObjectBase < ApiModelBase # The sender ID of the message. This could be an alphanumeric sender ID. attr_accessor :from @@ -54,9 +54,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -82,9 +87,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelChannelListObjectBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListObjectBase`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -138,6 +144,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + + # Custom attribute writer method with validation + # @param [Object] channel Value to be assigned + def channel=(channel) + if channel.nil? + fail ArgumentError, 'channel cannot be nil' + end + + @channel = channel + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -183,61 +219,6 @@ def self.build_from_hash(attributes) 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 @@ -253,23 +234,5 @@ def to_hash 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/multi_channel_channel_list_owner_object.rb b/lib/bandwidth-sdk/models/multi_channel_channel_list_owner_object.rb index 00e437e8..bf5a9de4 100644 --- a/lib/bandwidth-sdk/models/multi_channel_channel_list_owner_object.rb +++ b/lib/bandwidth-sdk/models/multi_channel_channel_list_owner_object.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MultiChannelChannelListOwnerObject + class MultiChannelChannelListOwnerObject < ApiModelBase # The Bandwidth senderId associated with the message. Identical to 'from'. attr_accessor :owner @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelChannelListOwnerObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListOwnerObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -85,6 +91,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] owner Value to be assigned + def owner=(owner) + if owner.nil? + fail ArgumentError, 'owner cannot be nil' + end + + @owner = owner + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -128,61 +144,6 @@ def self.build_from_hash(attributes) 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 @@ -198,23 +159,5 @@ def to_hash 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/multi_channel_channel_list_rbm_object.rb b/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_object.rb index f26514a8..1e3f7524 100644 --- a/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_object.rb +++ b/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_object.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MultiChannelChannelListRBMObject + class MultiChannelChannelListRBMObject < ApiModelBase # The sender ID of the message. This could be an alphanumeric sender ID. attr_accessor :from @@ -57,9 +57,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelChannelListRBMObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListRBMObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,46 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + + # Custom attribute writer method with validation + # @param [Object] channel Value to be assigned + def channel=(channel) + if channel.nil? + fail ArgumentError, 'channel cannot be nil' + end + + @channel = channel + end + + # Custom attribute writer method with validation + # @param [Object] content Value to be assigned + def content=(content) + if content.nil? + fail ArgumentError, 'content cannot be nil' + end + + @content = content + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -206,61 +252,6 @@ def self.build_from_hash(attributes) 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 @@ -276,23 +267,5 @@ def to_hash 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/multi_channel_channel_list_rbm_object_all_of_content.rb b/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_object_all_of_content.rb index 99e7e8fe..76f9b410 100644 --- a/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_object_all_of_content.rb +++ b/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_object_all_of_content.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -40,8 +40,7 @@ def build(data) openapi_one_of.each do |klass| begin next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data + return find_and_cast_into_type(klass, data) rescue # rescue all errors so we keep iterating even if the current item lookup raises end end @@ -67,7 +66,7 @@ def find_and_cast_into_type(klass, data) when 'Time' return Time.parse(data) when 'Date' - return Date.parse(data) + return Date.iso8601(data) when 'String' return data if data.instance_of?(String) when 'Object' # "type: object" diff --git a/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_response_object.rb b/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_response_object.rb index 0b69ccaf..25fc366d 100644 --- a/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_response_object.rb +++ b/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_response_object.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MultiChannelChannelListRBMResponseObject + class MultiChannelChannelListRBMResponseObject < ApiModelBase # The sender ID of the message. This could be an alphanumeric sender ID. attr_accessor :from @@ -61,9 +61,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -99,9 +104,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelChannelListRBMResponseObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListRBMResponseObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -177,6 +183,56 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + + # Custom attribute writer method with validation + # @param [Object] channel Value to be assigned + def channel=(channel) + if channel.nil? + fail ArgumentError, 'channel cannot be nil' + end + + @channel = channel + end + + # Custom attribute writer method with validation + # @param [Object] content Value to be assigned + def content=(content) + if content.nil? + fail ArgumentError, 'content cannot be nil' + end + + @content = content + end + + # Custom attribute writer method with validation + # @param [Object] owner Value to be assigned + def owner=(owner) + if owner.nil? + fail ArgumentError, 'owner cannot be nil' + end + + @owner = owner + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -224,61 +280,6 @@ def self.build_from_hash(attributes) 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 @@ -294,23 +295,5 @@ def to_hash 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/multi_channel_channel_list_request_object.rb b/lib/bandwidth-sdk/models/multi_channel_channel_list_request_object.rb index 92362082..2e030080 100644 --- a/lib/bandwidth-sdk/models/multi_channel_channel_list_request_object.rb +++ b/lib/bandwidth-sdk/models/multi_channel_channel_list_request_object.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -38,8 +38,7 @@ def build(data) openapi_any_of.each do |klass| begin next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data + return find_and_cast_into_type(klass, data) rescue # rescue all errors so we keep iterating even if the current item lookup raises end end @@ -65,7 +64,7 @@ def find_and_cast_into_type(klass, data) when 'Time' return Time.parse(data) when 'Date' - return Date.parse(data) + return Date.iso8601(data) when 'String' return data if data.instance_of?(String) when 'Object' # "type: object" diff --git a/lib/bandwidth-sdk/models/multi_channel_channel_list_response_object.rb b/lib/bandwidth-sdk/models/multi_channel_channel_list_response_object.rb index d31bbcfc..eb5346eb 100644 --- a/lib/bandwidth-sdk/models/multi_channel_channel_list_response_object.rb +++ b/lib/bandwidth-sdk/models/multi_channel_channel_list_response_object.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -38,8 +38,7 @@ def build(data) openapi_any_of.each do |klass| begin next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data + return find_and_cast_into_type(klass, data) rescue # rescue all errors so we keep iterating even if the current item lookup raises end end @@ -65,7 +64,7 @@ def find_and_cast_into_type(klass, data) when 'Time' return Time.parse(data) when 'Date' - return Date.parse(data) + return Date.iso8601(data) when 'String' return data if data.instance_of?(String) when 'Object' # "type: object" diff --git a/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_object.rb b/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_object.rb index 678f93a9..a678bc0c 100644 --- a/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_object.rb +++ b/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_object.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MultiChannelChannelListSMSObject + class MultiChannelChannelListSMSObject < ApiModelBase # The sender ID of the message. This could be an alphanumeric sender ID. attr_accessor :from @@ -57,9 +57,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelChannelListSMSObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListSMSObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,46 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + + # Custom attribute writer method with validation + # @param [Object] channel Value to be assigned + def channel=(channel) + if channel.nil? + fail ArgumentError, 'channel cannot be nil' + end + + @channel = channel + end + + # Custom attribute writer method with validation + # @param [Object] content Value to be assigned + def content=(content) + if content.nil? + fail ArgumentError, 'content cannot be nil' + end + + @content = content + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -206,61 +252,6 @@ def self.build_from_hash(attributes) 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 @@ -276,23 +267,5 @@ def to_hash 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/multi_channel_channel_list_sms_response_object.rb b/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_response_object.rb index 86c518bf..a526fed1 100644 --- a/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_response_object.rb +++ b/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_response_object.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MultiChannelChannelListSMSResponseObject + class MultiChannelChannelListSMSResponseObject < ApiModelBase # The sender ID of the message. This could be an alphanumeric sender ID. attr_accessor :from @@ -61,9 +61,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -99,9 +104,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelChannelListSMSResponseObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListSMSResponseObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -177,6 +183,56 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + + # Custom attribute writer method with validation + # @param [Object] channel Value to be assigned + def channel=(channel) + if channel.nil? + fail ArgumentError, 'channel cannot be nil' + end + + @channel = channel + end + + # Custom attribute writer method with validation + # @param [Object] content Value to be assigned + def content=(content) + if content.nil? + fail ArgumentError, 'content cannot be nil' + end + + @content = content + end + + # Custom attribute writer method with validation + # @param [Object] owner Value to be assigned + def owner=(owner) + if owner.nil? + fail ArgumentError, 'owner cannot be nil' + end + + @owner = owner + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -224,61 +280,6 @@ def self.build_from_hash(attributes) 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 @@ -294,23 +295,5 @@ def to_hash 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/multi_channel_error.rb b/lib/bandwidth-sdk/models/multi_channel_error.rb index 051d2a11..2091505a 100644 --- a/lib/bandwidth-sdk/models/multi_channel_error.rb +++ b/lib/bandwidth-sdk/models/multi_channel_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class MultiChannelError + class MultiChannelError < ApiModelBase attr_accessor :links attr_accessor :data @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -143,61 +149,6 @@ def self.build_from_hash(attributes) 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 @@ -213,23 +164,5 @@ def to_hash 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/multi_channel_message_channel_enum.rb b/lib/bandwidth-sdk/models/multi_channel_message_channel_enum.rb index 721422a1..706cd836 100644 --- a/lib/bandwidth-sdk/models/multi_channel_message_channel_enum.rb +++ b/lib/bandwidth-sdk/models/multi_channel_message_channel_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/multi_channel_message_content.rb b/lib/bandwidth-sdk/models/multi_channel_message_content.rb index 9a2f4e31..5c17f2d2 100644 --- a/lib/bandwidth-sdk/models/multi_channel_message_content.rb +++ b/lib/bandwidth-sdk/models/multi_channel_message_content.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The structure of the content field of a multichannel message. - class MultiChannelMessageContent + class MultiChannelMessageContent < ApiModelBase attr_accessor :text attr_accessor :media @@ -28,9 +28,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -55,9 +60,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelMessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelMessageContent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -130,61 +136,6 @@ def self.build_from_hash(attributes) 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 @@ -200,23 +151,5 @@ def to_hash 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/multi_channel_message_request.rb b/lib/bandwidth-sdk/models/multi_channel_message_request.rb index 0aac7430..59268a13 100644 --- a/lib/bandwidth-sdk/models/multi_channel_message_request.rb +++ b/lib/bandwidth-sdk/models/multi_channel_message_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # Multi-Channel Message Request - class MultiChannelMessageRequest + class MultiChannelMessageRequest < ApiModelBase # The phone number the message should be sent to in E164 format. attr_accessor :to @@ -63,9 +63,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -93,9 +98,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelMessageRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelMessageRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -157,6 +163,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] to Value to be assigned + def to=(to) + if to.nil? + fail ArgumentError, 'to cannot be nil' + end + + @to = to + end + # Custom attribute writer method with validation # @param [Object] channel_list Value to be assigned def channel_list=(channel_list) @@ -218,61 +234,6 @@ def self.build_from_hash(attributes) 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 @@ -288,23 +249,5 @@ def to_hash 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/multi_channel_message_response_data.rb b/lib/bandwidth-sdk/models/multi_channel_message_response_data.rb index 5b18789c..47c41a93 100644 --- a/lib/bandwidth-sdk/models/multi_channel_message_response_data.rb +++ b/lib/bandwidth-sdk/models/multi_channel_message_response_data.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The data returned in a multichannel message response. - class MultiChannelMessageResponseData + class MultiChannelMessageResponseData < ApiModelBase # The ID of the message. attr_accessor :id @@ -74,9 +74,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -107,9 +112,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::MultiChannelMessageResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelMessageResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -206,6 +212,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] time Value to be assigned + def time=(time) + if time.nil? + fail ArgumentError, 'time cannot be nil' + end + + @time = time + end + + # Custom attribute writer method with validation + # @param [Object] direction Value to be assigned + def direction=(direction) + if direction.nil? + fail ArgumentError, 'direction cannot be nil' + end + + @direction = direction + end + # Custom attribute writer method with validation # @param [Object] to Value to be assigned def to=(to) @@ -280,61 +316,6 @@ def self.build_from_hash(attributes) 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 @@ -350,23 +331,5 @@ def to_hash 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 index 0bb00c69..33e6b608 100644 --- a/lib/bandwidth-sdk/models/opt_in_workflow.rb +++ b/lib/bandwidth-sdk/models/opt_in_workflow.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class OptInWorkflow + class OptInWorkflow < ApiModelBase attr_accessor :description attr_accessor :image_urls @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -99,7 +105,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "description", the character length must be greater than or equal to 1.') end if @image_urls.nil? @@ -111,7 +117,7 @@ def list_invalid_properties end if !@confirmation_response.nil? && @confirmation_response.to_s.length < 0 - invalid_properties.push('invalid value for "confirmation_response", the character length must be great than or equal to 0.') + invalid_properties.push('invalid value for "confirmation_response", the character length must be greater than or equal to 0.') end invalid_properties @@ -142,12 +148,22 @@ def description=(description) end if description.to_s.length < 1 - fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "description", the character length must be greater than or equal to 1.' end @description = description end + # Custom attribute writer method with validation + # @param [Object] image_urls Value to be assigned + def image_urls=(image_urls) + if image_urls.nil? + fail ArgumentError, 'image_urls cannot be nil' + end + + @image_urls = image_urls + end + # Custom attribute writer method with validation # @param [Object] confirmation_response Value to be assigned def confirmation_response=(confirmation_response) @@ -156,7 +172,7 @@ def confirmation_response=(confirmation_response) end if !confirmation_response.nil? && confirmation_response.to_s.length < 0 - fail ArgumentError, 'invalid value for "confirmation_response", the character length must be great than or equal to 0.' + fail ArgumentError, 'invalid value for "confirmation_response", the character length must be greater than or equal to 0.' end @confirmation_response = confirmation_response @@ -207,61 +223,6 @@ def self.build_from_hash(attributes) 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 @@ -277,23 +238,5 @@ def to_hash 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/page_info.rb b/lib/bandwidth-sdk/models/page_info.rb index 5722c302..7da0e273 100644 --- a/lib/bandwidth-sdk/models/page_info.rb +++ b/lib/bandwidth-sdk/models/page_info.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class PageInfo + class PageInfo < ApiModelBase # The link to the previous page for pagination. attr_accessor :prev_page @@ -37,9 +37,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -66,9 +71,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::PageInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::PageInfo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -151,61 +157,6 @@ def self.build_from_hash(attributes) 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 @@ -221,23 +172,5 @@ def to_hash 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/priority_enum.rb b/lib/bandwidth-sdk/models/priority_enum.rb index 537efc58..541c1d53 100644 --- a/lib/bandwidth-sdk/models/priority_enum.rb +++ b/lib/bandwidth-sdk/models/priority_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/product_type_enum.rb b/lib/bandwidth-sdk/models/product_type_enum.rb index 53bdbcb7..8fbc31c4 100644 --- a/lib/bandwidth-sdk/models/product_type_enum.rb +++ b/lib/bandwidth-sdk/models/product_type_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/rbm_action_base.rb b/lib/bandwidth-sdk/models/rbm_action_base.rb index 2fdf7d30..8b9cc12b 100644 --- a/lib/bandwidth-sdk/models/rbm_action_base.rb +++ b/lib/bandwidth-sdk/models/rbm_action_base.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmActionBase + class RbmActionBase < ApiModelBase attr_accessor :type # Displayed text for user to click @@ -54,9 +54,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -82,9 +87,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmActionBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmActionBase`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -148,6 +154,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + # Custom attribute writer method with validation # @param [Object] text Value to be assigned def text=(text) @@ -221,61 +237,6 @@ def self.build_from_hash(attributes) 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 @@ -291,23 +252,5 @@ def to_hash 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/rbm_action_dial.rb b/lib/bandwidth-sdk/models/rbm_action_dial.rb index b57f202c..1b8745dd 100644 --- a/lib/bandwidth-sdk/models/rbm_action_dial.rb +++ b/lib/bandwidth-sdk/models/rbm_action_dial.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmActionDial + class RbmActionDial < ApiModelBase attr_accessor :type # Displayed text for user to click @@ -58,9 +58,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -94,9 +99,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmActionDial`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmActionDial`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -171,6 +177,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + # Custom attribute writer method with validation # @param [Object] text Value to be assigned def text=(text) @@ -199,6 +215,16 @@ def postback_data=(postback_data) @postback_data = postback_data 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 + + @phone_number = phone_number + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -245,61 +271,6 @@ def self.build_from_hash(attributes) 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 @@ -315,23 +286,5 @@ def to_hash 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/rbm_action_open_url.rb b/lib/bandwidth-sdk/models/rbm_action_open_url.rb index e8e2c5c1..cdf04458 100644 --- a/lib/bandwidth-sdk/models/rbm_action_open_url.rb +++ b/lib/bandwidth-sdk/models/rbm_action_open_url.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmActionOpenUrl + class RbmActionOpenUrl < ApiModelBase attr_accessor :type # Displayed text for user to click @@ -58,9 +58,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -94,9 +99,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmActionOpenUrl`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmActionOpenUrl`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -176,6 +182,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + # Custom attribute writer method with validation # @param [Object] text Value to be assigned def text=(text) @@ -264,61 +280,6 @@ def self.build_from_hash(attributes) 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 @@ -334,23 +295,5 @@ def to_hash 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/rbm_action_type_enum.rb b/lib/bandwidth-sdk/models/rbm_action_type_enum.rb index ab0e2f40..2d74827e 100644 --- a/lib/bandwidth-sdk/models/rbm_action_type_enum.rb +++ b/lib/bandwidth-sdk/models/rbm_action_type_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/rbm_action_view_location.rb b/lib/bandwidth-sdk/models/rbm_action_view_location.rb index 54acf9fa..90dd45f5 100644 --- a/lib/bandwidth-sdk/models/rbm_action_view_location.rb +++ b/lib/bandwidth-sdk/models/rbm_action_view_location.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmActionViewLocation + class RbmActionViewLocation < ApiModelBase attr_accessor :type # Displayed text for user to click @@ -66,9 +66,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -104,9 +109,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmActionViewLocation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmActionViewLocation`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -201,6 +207,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + # Custom attribute writer method with validation # @param [Object] text Value to be assigned def text=(text) @@ -229,6 +245,26 @@ def postback_data=(postback_data) @postback_data = postback_data end + # Custom attribute writer method with validation + # @param [Object] latitude Value to be assigned + def latitude=(latitude) + if latitude.nil? + fail ArgumentError, 'latitude cannot be nil' + end + + @latitude = latitude + end + + # Custom attribute writer method with validation + # @param [Object] longitude Value to be assigned + def longitude=(longitude) + if longitude.nil? + fail ArgumentError, 'longitude cannot be nil' + end + + @longitude = longitude + end + # Custom attribute writer method with validation # @param [Object] label Value to be assigned def label=(label) @@ -291,61 +327,6 @@ def self.build_from_hash(attributes) 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 @@ -361,23 +342,5 @@ def to_hash 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/rbm_card_content.rb b/lib/bandwidth-sdk/models/rbm_card_content.rb index c643f435..bcbbe75b 100644 --- a/lib/bandwidth-sdk/models/rbm_card_content.rb +++ b/lib/bandwidth-sdk/models/rbm_card_content.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmCardContent + class RbmCardContent < ApiModelBase # The title of the card. Must be 200 characters or less. attr_accessor :title @@ -36,9 +36,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -65,9 +70,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmCardContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmCardContent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -209,61 +215,6 @@ def self.build_from_hash(attributes) 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 @@ -279,23 +230,5 @@ def to_hash 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/rbm_card_content_media.rb b/lib/bandwidth-sdk/models/rbm_card_content_media.rb index a38f55a2..544d3adb 100644 --- a/lib/bandwidth-sdk/models/rbm_card_content_media.rb +++ b/lib/bandwidth-sdk/models/rbm_card_content_media.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmCardContentMedia + class RbmCardContentMedia < ApiModelBase # The URL of the media file. 100MB is the maximum file size. attr_accessor :file_url @@ -54,9 +54,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -89,9 +94,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmCardContentMedia`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmCardContentMedia`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -176,6 +182,16 @@ def thumbnail_url=(thumbnail_url) @thumbnail_url = thumbnail_url end + # Custom attribute writer method with validation + # @param [Object] height Value to be assigned + def height=(height) + if height.nil? + fail ArgumentError, 'height cannot be nil' + end + + @height = height + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -221,61 +237,6 @@ def self.build_from_hash(attributes) 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 @@ -291,23 +252,5 @@ def to_hash 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/rbm_location_response.rb b/lib/bandwidth-sdk/models/rbm_location_response.rb index 0fa253af..b246a462 100644 --- a/lib/bandwidth-sdk/models/rbm_location_response.rb +++ b/lib/bandwidth-sdk/models/rbm_location_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmLocationResponse + class RbmLocationResponse < ApiModelBase # The latitude of the client's location. attr_accessor :latitude @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmLocationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmLocationResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -131,61 +137,6 @@ def self.build_from_hash(attributes) 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 @@ -201,23 +152,5 @@ def to_hash 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/rbm_media_height_enum.rb b/lib/bandwidth-sdk/models/rbm_media_height_enum.rb index 7cd2a174..3830c66b 100644 --- a/lib/bandwidth-sdk/models/rbm_media_height_enum.rb +++ b/lib/bandwidth-sdk/models/rbm_media_height_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/rbm_message_carousel_card.rb b/lib/bandwidth-sdk/models/rbm_message_carousel_card.rb index 62261052..31e1e335 100644 --- a/lib/bandwidth-sdk/models/rbm_message_carousel_card.rb +++ b/lib/bandwidth-sdk/models/rbm_message_carousel_card.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmMessageCarouselCard + class RbmMessageCarouselCard < ApiModelBase attr_accessor :card_width attr_accessor :card_contents @@ -53,9 +53,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -81,9 +86,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmMessageCarouselCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmMessageCarouselCard`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -144,6 +150,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] card_width Value to be assigned + def card_width=(card_width) + if card_width.nil? + fail ArgumentError, 'card_width cannot be nil' + end + + @card_width = card_width + end + # Custom attribute writer method with validation # @param [Object] card_contents Value to be assigned def card_contents=(card_contents) @@ -217,61 +233,6 @@ def self.build_from_hash(attributes) 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 @@ -287,23 +248,5 @@ def to_hash 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/rbm_message_content_file.rb b/lib/bandwidth-sdk/models/rbm_message_content_file.rb index ecb2e81c..50f41554 100644 --- a/lib/bandwidth-sdk/models/rbm_message_content_file.rb +++ b/lib/bandwidth-sdk/models/rbm_message_content_file.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmMessageContentFile + class RbmMessageContentFile < ApiModelBase # The URL of the media file. 100MB is the maximum file size. attr_accessor :file_url @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmMessageContentFile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmMessageContentFile`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -176,61 +182,6 @@ def self.build_from_hash(attributes) 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 @@ -246,23 +197,5 @@ def to_hash 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/rbm_message_content_rich_card.rb b/lib/bandwidth-sdk/models/rbm_message_content_rich_card.rb index ee6ea216..60983200 100644 --- a/lib/bandwidth-sdk/models/rbm_message_content_rich_card.rb +++ b/lib/bandwidth-sdk/models/rbm_message_content_rich_card.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -38,8 +38,7 @@ def build(data) openapi_one_of.each do |klass| begin next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data + return find_and_cast_into_type(klass, data) rescue # rescue all errors so we keep iterating even if the current item lookup raises end end @@ -65,7 +64,7 @@ def find_and_cast_into_type(klass, data) when 'Time' return Time.parse(data) when 'Date' - return Date.parse(data) + return Date.iso8601(data) when 'String' return data if data.instance_of?(String) when 'Object' # "type: object" diff --git a/lib/bandwidth-sdk/models/rbm_message_content_text.rb b/lib/bandwidth-sdk/models/rbm_message_content_text.rb index f5707134..50650c66 100644 --- a/lib/bandwidth-sdk/models/rbm_message_content_text.rb +++ b/lib/bandwidth-sdk/models/rbm_message_content_text.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmMessageContentText + class RbmMessageContentText < ApiModelBase # The text associated with the message. Must be 3270 characters or less attr_accessor :text @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmMessageContentText`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmMessageContentText`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -178,61 +184,6 @@ def self.build_from_hash(attributes) 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 @@ -248,23 +199,5 @@ def to_hash 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/rbm_message_media.rb b/lib/bandwidth-sdk/models/rbm_message_media.rb index c2641de9..438dba18 100644 --- a/lib/bandwidth-sdk/models/rbm_message_media.rb +++ b/lib/bandwidth-sdk/models/rbm_message_media.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmMessageMedia + class RbmMessageMedia < ApiModelBase attr_accessor :media # An array of suggested actions for the recipient. @@ -28,9 +28,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -55,9 +60,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmMessageMedia`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmMessageMedia`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -100,6 +106,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] media Value to be assigned + def media=(media) + if media.nil? + fail ArgumentError, 'media cannot be nil' + end + + @media = media + end + # Custom attribute writer method with validation # @param [Object] suggestions Value to be assigned def suggestions=(suggestions) @@ -158,61 +174,6 @@ def self.build_from_hash(attributes) 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 @@ -228,23 +189,5 @@ def to_hash 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/rbm_standalone_card.rb b/lib/bandwidth-sdk/models/rbm_standalone_card.rb index 2c0ff724..e2dcc85a 100644 --- a/lib/bandwidth-sdk/models/rbm_standalone_card.rb +++ b/lib/bandwidth-sdk/models/rbm_standalone_card.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmStandaloneCard + class RbmStandaloneCard < ApiModelBase attr_accessor :orientation attr_accessor :thumbnail_image_alignment @@ -56,9 +56,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -85,9 +90,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmStandaloneCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmStandaloneCard`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -152,6 +158,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] orientation Value to be assigned + def orientation=(orientation) + if orientation.nil? + fail ArgumentError, 'orientation cannot be nil' + end + + @orientation = orientation + end + + # Custom attribute writer method with validation + # @param [Object] thumbnail_image_alignment Value to be assigned + def thumbnail_image_alignment=(thumbnail_image_alignment) + if thumbnail_image_alignment.nil? + fail ArgumentError, 'thumbnail_image_alignment cannot be nil' + end + + @thumbnail_image_alignment = thumbnail_image_alignment + end + + # Custom attribute writer method with validation + # @param [Object] card_content Value to be assigned + def card_content=(card_content) + if card_content.nil? + fail ArgumentError, 'card_content cannot be nil' + end + + @card_content = card_content + end + # Custom attribute writer method with validation # @param [Object] suggestions Value to be assigned def suggestions=(suggestions) @@ -212,61 +248,6 @@ def self.build_from_hash(attributes) 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 @@ -282,23 +263,5 @@ def to_hash 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/rbm_suggestion_response.rb b/lib/bandwidth-sdk/models/rbm_suggestion_response.rb index 7435e6d1..720250f0 100644 --- a/lib/bandwidth-sdk/models/rbm_suggestion_response.rb +++ b/lib/bandwidth-sdk/models/rbm_suggestion_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RbmSuggestionResponse + class RbmSuggestionResponse < ApiModelBase # The text associated with the suggestion response. attr_accessor :text @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RbmSuggestionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RbmSuggestionResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -150,61 +156,6 @@ def self.build_from_hash(attributes) 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 @@ -220,23 +171,5 @@ def to_hash 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/recording_available_callback.rb b/lib/bandwidth-sdk/models/recording_available_callback.rb index 65201b01..5ae929ff 100644 --- a/lib/bandwidth-sdk/models/recording_available_callback.rb +++ b/lib/bandwidth-sdk/models/recording_available_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Recording Available event is sent after a recording has been processed. It indicates that the recording is available for download. - class RecordingAvailableCallback + class RecordingAvailableCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -130,9 +130,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -180,9 +185,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RecordingAvailableCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RecordingAvailableCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -355,61 +361,6 @@ def self.build_from_hash(attributes) 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 @@ -425,23 +376,5 @@ def to_hash 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/recording_complete_callback.rb b/lib/bandwidth-sdk/models/recording_complete_callback.rb index 810a36c6..d2225279 100644 --- a/lib/bandwidth-sdk/models/recording_complete_callback.rb +++ b/lib/bandwidth-sdk/models/recording_complete_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Record Complete event is sent after a verb has executed if the call is still active. The BXML returned by this callback is executed next. When the recording is available for download, a Recording Available event will be sent. - class RecordingCompleteCallback + class RecordingCompleteCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -130,9 +130,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -181,9 +186,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RecordingCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RecordingCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -356,61 +362,6 @@ def self.build_from_hash(attributes) 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 @@ -426,23 +377,5 @@ def to_hash 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/recording_state_enum.rb b/lib/bandwidth-sdk/models/recording_state_enum.rb index 7827a386..6c8ee8c0 100644 --- a/lib/bandwidth-sdk/models/recording_state_enum.rb +++ b/lib/bandwidth-sdk/models/recording_state_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/recording_transcription_metadata.rb b/lib/bandwidth-sdk/models/recording_transcription_metadata.rb index 5c1ed1e8..9236fec9 100644 --- a/lib/bandwidth-sdk/models/recording_transcription_metadata.rb +++ b/lib/bandwidth-sdk/models/recording_transcription_metadata.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # If the recording was transcribed, metadata about the transcription - class RecordingTranscriptionMetadata + class RecordingTranscriptionMetadata < ApiModelBase # The unique transcription ID attr_accessor :id @@ -38,9 +38,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -67,9 +72,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RecordingTranscriptionMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RecordingTranscriptionMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -152,61 +158,6 @@ def self.build_from_hash(attributes) 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 @@ -222,23 +173,5 @@ def to_hash 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/recording_transcriptions.rb b/lib/bandwidth-sdk/models/recording_transcriptions.rb index d2821ab7..c82633a5 100644 --- a/lib/bandwidth-sdk/models/recording_transcriptions.rb +++ b/lib/bandwidth-sdk/models/recording_transcriptions.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class RecordingTranscriptions + class RecordingTranscriptions < ApiModelBase attr_accessor :transcripts # Attribute mapping from ruby-style variable name to JSON key. @@ -24,9 +24,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RecordingTranscriptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RecordingTranscriptions`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -122,61 +128,6 @@ def self.build_from_hash(attributes) 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 @@ -192,23 +143,5 @@ def to_hash 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/redirect_callback.rb b/lib/bandwidth-sdk/models/redirect_callback.rb index 7b7da865..84ede391 100644 --- a/lib/bandwidth-sdk/models/redirect_callback.rb +++ b/lib/bandwidth-sdk/models/redirect_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Redirect event is fired when a verb is executed. Its purpose is to get the next set of verbs from the calling application. - class RedirectCallback + class RedirectCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -107,9 +107,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -151,9 +156,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::RedirectCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::RedirectCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -296,61 +302,6 @@ def self.build_from_hash(attributes) 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 @@ -366,23 +317,5 @@ def to_hash 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/redirect_method_enum.rb b/lib/bandwidth-sdk/models/redirect_method_enum.rb index d71543d5..1f0361ed 100644 --- a/lib/bandwidth-sdk/models/redirect_method_enum.rb +++ b/lib/bandwidth-sdk/models/redirect_method_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/sms_message_content.rb b/lib/bandwidth-sdk/models/sms_message_content.rb index 7e55ec21..7098c384 100644 --- a/lib/bandwidth-sdk/models/sms_message_content.rb +++ b/lib/bandwidth-sdk/models/sms_message_content.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class SmsMessageContent + class SmsMessageContent < ApiModelBase # The contents of the text message. Must be 2048 characters or less. attr_accessor :text @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::SmsMessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::SmsMessageContent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -147,61 +153,6 @@ def self.build_from_hash(attributes) 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 @@ -217,23 +168,5 @@ def to_hash 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/standalone_card_orientation_enum.rb b/lib/bandwidth-sdk/models/standalone_card_orientation_enum.rb index 5617b64a..3a9ae076 100644 --- a/lib/bandwidth-sdk/models/standalone_card_orientation_enum.rb +++ b/lib/bandwidth-sdk/models/standalone_card_orientation_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/status_callback.rb b/lib/bandwidth-sdk/models/status_callback.rb index 78d3905b..f81d372e 100644 --- a/lib/bandwidth-sdk/models/status_callback.rb +++ b/lib/bandwidth-sdk/models/status_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # Represents a status callback for an outbound MT SMS or MMS or RBM message. - class StatusCallback + class StatusCallback < ApiModelBase attr_accessor :time # Represents the time at which the message was read, for `message-read` callbacks. @@ -73,9 +73,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -106,9 +111,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::StatusCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::StatusCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -196,6 +202,56 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] time Value to be assigned + def time=(time) + if time.nil? + fail ArgumentError, 'time cannot be nil' + end + + @time = time + end + + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + + # Custom attribute writer method with validation + # @param [Object] to Value to be assigned + def to=(to) + if to.nil? + fail ArgumentError, 'to cannot be nil' + end + + @to = to + 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 + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -246,61 +302,6 @@ def self.build_from_hash(attributes) 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 @@ -316,23 +317,5 @@ def to_hash 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/status_callback_message.rb b/lib/bandwidth-sdk/models/status_callback_message.rb index 2c8b2b8d..db75377a 100644 --- a/lib/bandwidth-sdk/models/status_callback_message.rb +++ b/lib/bandwidth-sdk/models/status_callback_message.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # Message payload schema within a callback - class StatusCallbackMessage + class StatusCallbackMessage < ApiModelBase # A unique identifier of the message. attr_accessor :id @@ -91,9 +91,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -129,9 +134,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::StatusCallbackMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::StatusCallbackMessage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -264,6 +270,66 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] owner Value to be assigned + def owner=(owner) + if owner.nil? + fail ArgumentError, 'owner cannot be nil' + end + + @owner = owner + end + + # Custom attribute writer method with validation + # @param [Object] application_id Value to be assigned + def application_id=(application_id) + if application_id.nil? + fail ArgumentError, 'application_id cannot be nil' + end + + @application_id = application_id + end + + # Custom attribute writer method with validation + # @param [Object] time Value to be assigned + def time=(time) + if time.nil? + fail ArgumentError, 'time cannot be nil' + end + + @time = time + end + + # Custom attribute writer method with validation + # @param [Object] segment_count Value to be assigned + def segment_count=(segment_count) + if segment_count.nil? + fail ArgumentError, 'segment_count cannot be nil' + end + + @segment_count = segment_count + end + + # Custom attribute writer method with validation + # @param [Object] direction Value to be assigned + def direction=(direction) + if direction.nil? + fail ArgumentError, 'direction cannot be nil' + end + + @direction = direction + end + # Custom attribute writer method with validation # @param [Object] to Value to be assigned def to=(to) @@ -274,6 +340,16 @@ def to=(to) @to = to end + # Custom attribute writer method with validation + # @param [Object] from Value to be assigned + def from=(from) + if from.nil? + fail ArgumentError, 'from cannot be nil' + end + + @from = from + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -329,61 +405,6 @@ def self.build_from_hash(attributes) 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 @@ -399,23 +420,5 @@ def to_hash 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/status_callback_type_enum.rb b/lib/bandwidth-sdk/models/status_callback_type_enum.rb index c2df50fe..269e5dce 100644 --- a/lib/bandwidth-sdk/models/status_callback_type_enum.rb +++ b/lib/bandwidth-sdk/models/status_callback_type_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,13 +15,13 @@ module Bandwidth class StatusCallbackTypeEnum - SENDING = 'message-sending'.freeze - DELIVERED = 'message-delivered'.freeze - FAILED = 'message-failed'.freeze - READ = 'message-read'.freeze + MESSAGE_SENDING = 'message-sending'.freeze + MESSAGE_DELIVERED = 'message-delivered'.freeze + MESSAGE_FAILED = 'message-failed'.freeze + MESSAGE_READ = 'message-read'.freeze def self.all_vars - @all_vars ||= [SENDING, DELIVERED, FAILED, READ].freeze + @all_vars ||= [MESSAGE_SENDING, MESSAGE_DELIVERED, MESSAGE_FAILED, MESSAGE_READ].freeze end # Builds the enum from string diff --git a/lib/bandwidth-sdk/models/stir_shaken.rb b/lib/bandwidth-sdk/models/stir_shaken.rb index 06dfc214..3c78ae1c 100644 --- a/lib/bandwidth-sdk/models/stir_shaken.rb +++ b/lib/bandwidth-sdk/models/stir_shaken.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class StirShaken + class StirShaken < ApiModelBase # (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Validation-Passed and TN-Validation-Failed. attr_accessor :verstat @@ -33,9 +33,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -61,9 +66,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::StirShaken`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::StirShaken`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -141,61 +147,6 @@ def self.build_from_hash(attributes) 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 @@ -211,23 +162,5 @@ def to_hash 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/sync_lookup_request.rb b/lib/bandwidth-sdk/models/sync_lookup_request.rb index 64b477cc..b83095b7 100644 --- a/lib/bandwidth-sdk/models/sync_lookup_request.rb +++ b/lib/bandwidth-sdk/models/sync_lookup_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class SyncLookupRequest + class SyncLookupRequest < ApiModelBase # Telephone numbers in E.164 format. attr_accessor :phone_numbers @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::SyncLookupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::SyncLookupRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -140,61 +146,6 @@ def self.build_from_hash(attributes) 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 @@ -210,23 +161,5 @@ def to_hash 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 index d350137f..e12cf510 100644 --- a/lib/bandwidth-sdk/models/telephone_number.rb +++ b/lib/bandwidth-sdk/models/telephone_number.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class TelephoneNumber + class TelephoneNumber < ApiModelBase # Simple Telephone Number. attr_accessor :telephone_number @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) 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 @@ -191,23 +142,5 @@ def to_hash 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 index a3ee757c..1b0893e3 100644 --- a/lib/bandwidth-sdk/models/tfv_basic_authentication.rb +++ b/lib/bandwidth-sdk/models/tfv_basic_authentication.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class TfvBasicAuthentication + class TfvBasicAuthentication < ApiModelBase attr_accessor :username attr_accessor :password @@ -27,9 +27,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -54,9 +59,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -181,61 +187,6 @@ def self.build_from_hash(attributes) 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 @@ -251,23 +202,5 @@ def to_hash 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 index 8a25dfe4..7bc4d3da 100644 --- a/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb +++ b/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/tfv_error.rb b/lib/bandwidth-sdk/models/tfv_error.rb index 3130ea66..dc0d56be 100644 --- a/lib/bandwidth-sdk/models/tfv_error.rb +++ b/lib/bandwidth-sdk/models/tfv_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # A generic error object. - class TfvError + class TfvError < ApiModelBase attr_accessor :type attr_accessor :description @@ -32,9 +32,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -60,9 +65,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -140,61 +146,6 @@ def self.build_from_hash(attributes) 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 @@ -210,23 +161,5 @@ def to_hash 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 index 1b12dc54..bbb41089 100644 --- a/lib/bandwidth-sdk/models/tfv_status.rb +++ b/lib/bandwidth-sdk/models/tfv_status.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class TfvStatus + class TfvStatus < ApiModelBase # Toll-free telephone number in E.164 format. attr_accessor :phone_number @@ -81,9 +81,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -116,9 +121,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -174,7 +180,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 12.') end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -207,7 +213,7 @@ def phone_number=(phone_number) 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.' + fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.' end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -270,61 +276,6 @@ def self.build_from_hash(attributes) 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 @@ -340,23 +291,5 @@ def to_hash 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 index b83c87c6..39a41e82 100644 --- a/lib/bandwidth-sdk/models/tfv_status_enum.rb +++ b/lib/bandwidth-sdk/models/tfv_status_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/tfv_submission_info.rb b/lib/bandwidth-sdk/models/tfv_submission_info.rb index e6bf148b..90d3d1ba 100644 --- a/lib/bandwidth-sdk/models/tfv_submission_info.rb +++ b/lib/bandwidth-sdk/models/tfv_submission_info.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class TfvSubmissionInfo + class TfvSubmissionInfo < ApiModelBase attr_accessor :business_address attr_accessor :business_contact @@ -98,9 +98,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -143,9 +148,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -229,7 +235,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "use_case", the character length must be greater than or equal to 0.') end if !@use_case_summary.nil? && @use_case_summary.to_s.length > 500 @@ -237,7 +243,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "use_case_summary", the character length must be greater than or equal to 0.') end if !@production_message_content.nil? && @production_message_content.to_s.length > 500 @@ -245,7 +251,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "production_message_content", the character length must be greater than or equal to 0.') end if !@additional_information.nil? && @additional_information.to_s.length > 500 @@ -253,7 +259,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "additional_information", the character length must be greater than or equal to 0.') end if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500 @@ -261,7 +267,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "isv_reseller", the character length must be greater than or equal to 0.') end if !@business_registration_number.nil? && @business_registration_number.to_s.length > 500 @@ -321,7 +327,7 @@ def use_case=(use_case) 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.' + fail ArgumentError, 'invalid value for "use_case", the character length must be greater than or equal to 0.' end @use_case = use_case @@ -339,7 +345,7 @@ def use_case_summary=(use_case_summary) 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.' + fail ArgumentError, 'invalid value for "use_case_summary", the character length must be greater than or equal to 0.' end @use_case_summary = use_case_summary @@ -357,7 +363,7 @@ def production_message_content=(production_message_content) 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.' + fail ArgumentError, 'invalid value for "production_message_content", the character length must be greater than or equal to 0.' end @production_message_content = production_message_content @@ -371,7 +377,7 @@ def additional_information=(additional_information) 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.' + fail ArgumentError, 'invalid value for "additional_information", the character length must be greater than or equal to 0.' end @additional_information = additional_information @@ -385,7 +391,7 @@ def isv_reseller=(isv_reseller) 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.' + fail ArgumentError, 'invalid value for "isv_reseller", the character length must be greater than or equal to 0.' end @isv_reseller = isv_reseller @@ -458,61 +464,6 @@ def self.build_from_hash(attributes) 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 @@ -528,23 +479,5 @@ def to_hash 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 index e413c786..17720fc5 100644 --- a/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb +++ b/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class TfvSubmissionWrapper + class TfvSubmissionWrapper < ApiModelBase attr_accessor :submission # Attribute mapping from ruby-style variable name to JSON key. @@ -24,9 +24,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -50,9 +55,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -120,61 +126,6 @@ def self.build_from_hash(attributes) 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 @@ -190,23 +141,5 @@ def to_hash 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/thumbnail_alignment_enum.rb b/lib/bandwidth-sdk/models/thumbnail_alignment_enum.rb index c354a8ab..0d8428c8 100644 --- a/lib/bandwidth-sdk/models/thumbnail_alignment_enum.rb +++ b/lib/bandwidth-sdk/models/thumbnail_alignment_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/transcribe_recording.rb b/lib/bandwidth-sdk/models/transcribe_recording.rb index 7a5a4b2d..c2f5c232 100644 --- a/lib/bandwidth-sdk/models/transcribe_recording.rb +++ b/lib/bandwidth-sdk/models/transcribe_recording.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class TranscribeRecording + class TranscribeRecording < ApiModelBase # The URL to send the [TranscriptionAvailable](/docs/voice/webhooks/transcriptionAvailable) event to. You should not include sensitive or personally-identifiable information in the callbackUrl field! Always use the proper username and password fields for authorization. attr_accessor :callback_url @@ -70,9 +70,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -108,9 +113,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::TranscribeRecording`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TranscribeRecording`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -268,61 +274,6 @@ def self.build_from_hash(attributes) 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 @@ -338,23 +289,5 @@ def to_hash 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/transcription.rb b/lib/bandwidth-sdk/models/transcription.rb index ca227c50..3b1008dd 100644 --- a/lib/bandwidth-sdk/models/transcription.rb +++ b/lib/bandwidth-sdk/models/transcription.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class Transcription + class Transcription < ApiModelBase # The transcribed text attr_accessor :text @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::Transcription`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::Transcription`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -131,61 +137,6 @@ def self.build_from_hash(attributes) 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 @@ -201,23 +152,5 @@ def to_hash 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/transcription_available_callback.rb b/lib/bandwidth-sdk/models/transcription_available_callback.rb index 8849a3db..b85dc2ac 100644 --- a/lib/bandwidth-sdk/models/transcription_available_callback.rb +++ b/lib/bandwidth-sdk/models/transcription_available_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # The Transcription Available event is sent when the recording transcription is available to be downloaded. - class TranscriptionAvailableCallback + class TranscriptionAvailableCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -125,9 +125,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -174,9 +179,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::TranscriptionAvailableCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TranscriptionAvailableCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -344,61 +350,6 @@ def self.build_from_hash(attributes) 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 @@ -414,23 +365,5 @@ def to_hash 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/transfer_answer_callback.rb b/lib/bandwidth-sdk/models/transfer_answer_callback.rb index 774c3b1e..50b061b6 100644 --- a/lib/bandwidth-sdk/models/transfer_answer_callback.rb +++ b/lib/bandwidth-sdk/models/transfer_answer_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # When processing a verb, this event is sent when a called party (B-leg) answers. The event is sent to the endpoint specified in the transferAnswerUrl attribute of the tag that answered. BXML returned by this callback will be executed for the called party only. After all BXML has been executed, the called party will be bridged to the original call. Most BXML verbs are allowed in response to a transferAnswer event, but some are not allowed. - class TransferAnswerCallback + class TransferAnswerCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -103,9 +103,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -146,9 +151,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::TransferAnswerCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TransferAnswerCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -286,61 +292,6 @@ def self.build_from_hash(attributes) 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 @@ -356,23 +307,5 @@ def to_hash 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/transfer_complete_callback.rb b/lib/bandwidth-sdk/models/transfer_complete_callback.rb index 74720560..55722353 100644 --- a/lib/bandwidth-sdk/models/transfer_complete_callback.rb +++ b/lib/bandwidth-sdk/models/transfer_complete_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # This event is sent to the transferCompleteUrl of the A-leg's verb when the transferred call (B-leg) completes. In a simultaneous ringing scenario, only one B-leg succeeds and this event corresponds to that successful leg. If none of the calls were answered, the transferComplete event corresponds to one of the legs. - class TransferCompleteCallback + class TransferCompleteCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -115,9 +115,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -163,9 +168,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::TransferCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TransferCompleteCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -318,61 +324,6 @@ def self.build_from_hash(attributes) 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 @@ -388,23 +339,5 @@ def to_hash 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/transfer_disconnect_callback.rb b/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb index b1374129..56ef3ab8 100644 --- a/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb +++ b/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # This event is sent to the transferDisconnectUrl of each tag when its respective call leg ends for any reason. The event is sent in the normal case, when the transferred leg is answered and later hung up, but is also sent if the new leg was never answered in the first place, if it was rejected, and if the original call leg hung up before the transferred leg. - class TransferDisconnectCallback + class TransferDisconnectCallback < ApiModelBase # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. attr_accessor :event_type @@ -123,9 +123,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -173,9 +178,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::TransferDisconnectCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TransferDisconnectCallback`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -338,61 +344,6 @@ def self.build_from_hash(attributes) 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 @@ -408,23 +359,5 @@ def to_hash 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/update_call.rb b/lib/bandwidth-sdk/models/update_call.rb index 783d7850..acb96d2b 100644 --- a/lib/bandwidth-sdk/models/update_call.rb +++ b/lib/bandwidth-sdk/models/update_call.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class UpdateCall + class UpdateCall < ApiModelBase attr_accessor :state # The URL to send the [Redirect](/docs/voice/bxml/redirect) event to which will provide new BXML. Required if `state` is `active`. Not allowed if `state` is `completed`. @@ -80,9 +80,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -125,9 +130,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::UpdateCall`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::UpdateCall`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -321,61 +327,6 @@ def self.build_from_hash(attributes) 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 @@ -391,23 +342,5 @@ def to_hash 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/update_call_recording.rb b/lib/bandwidth-sdk/models/update_call_recording.rb index 994f01e0..678aa449 100644 --- a/lib/bandwidth-sdk/models/update_call_recording.rb +++ b/lib/bandwidth-sdk/models/update_call_recording.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class UpdateCallRecording + class UpdateCallRecording < ApiModelBase attr_accessor :state class EnumAttributeValidator @@ -46,9 +46,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::UpdateCallRecording`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::UpdateCallRecording`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -106,6 +112,16 @@ def valid? true 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 + + @state = state + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -149,61 +165,6 @@ def self.build_from_hash(attributes) 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 @@ -219,23 +180,5 @@ def to_hash 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/update_conference.rb b/lib/bandwidth-sdk/models/update_conference.rb index 7b72726b..e840d9a1 100644 --- a/lib/bandwidth-sdk/models/update_conference.rb +++ b/lib/bandwidth-sdk/models/update_conference.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class UpdateConference + class UpdateConference < ApiModelBase attr_accessor :status # The URL to send the [conferenceRedirect](/docs/voice/webhooks/conferenceRedirect) event which will provide new BXML. Not allowed if `state` is `completed`, but required if `state` is `active`. @@ -76,9 +76,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -119,9 +124,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::UpdateConference`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::UpdateConference`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -295,61 +301,6 @@ def self.build_from_hash(attributes) 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 @@ -365,23 +316,5 @@ def to_hash 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/update_conference_member.rb b/lib/bandwidth-sdk/models/update_conference_member.rb index cfacf093..41f62599 100644 --- a/lib/bandwidth-sdk/models/update_conference_member.rb +++ b/lib/bandwidth-sdk/models/update_conference_member.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class UpdateConferenceMember + class UpdateConferenceMember < ApiModelBase # Whether or not this member is currently muted. Members who are muted are still able to hear other participants. Updates this member's mute status. Has no effect if omitted. attr_accessor :mute @@ -33,9 +33,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::UpdateConferenceMember`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::UpdateConferenceMember`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -144,61 +150,6 @@ def self.build_from_hash(attributes) 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 @@ -214,23 +165,5 @@ def to_hash 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 index eb223a4c..e9be8e28 100644 --- a/lib/bandwidth-sdk/models/verification_denial_webhook.rb +++ b/lib/bandwidth-sdk/models/verification_denial_webhook.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class VerificationDenialWebhook + class VerificationDenialWebhook < ApiModelBase # User's account ID. attr_accessor :account_id @@ -60,9 +60,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -95,9 +100,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -157,7 +163,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 12.') end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -190,7 +196,7 @@ def phone_number=(phone_number) 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.' + fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.' end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -253,61 +259,6 @@ def self.build_from_hash(attributes) 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 @@ -323,23 +274,5 @@ def to_hash 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 index 29364ba2..5d69597e 100644 --- a/lib/bandwidth-sdk/models/verification_request.rb +++ b/lib/bandwidth-sdk/models/verification_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class VerificationRequest + class VerificationRequest < ApiModelBase attr_accessor :business_address attr_accessor :business_contact @@ -109,9 +109,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -158,9 +163,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -302,7 +308,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "use_case", the character length must be greater than or equal to 0.') end if @use_case_summary.nil? @@ -314,7 +320,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "use_case_summary", the character length must be greater than or equal to 0.') end if @production_message_content.nil? @@ -326,7 +332,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "production_message_content", the character length must be greater than or equal to 0.') end if @opt_in_workflow.nil? @@ -338,7 +344,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "additional_information", the character length must be greater than or equal to 0.') end if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500 @@ -346,7 +352,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "isv_reseller", the character length must be greater than or equal to 0.') end if !@business_registration_number.nil? && @business_registration_number.to_s.length > 500 @@ -391,6 +397,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] business_address Value to be assigned + def business_address=(business_address) + if business_address.nil? + fail ArgumentError, 'business_address cannot be nil' + end + + @business_address = business_address + end + + # Custom attribute writer method with validation + # @param [Object] business_contact Value to be assigned + def business_contact=(business_contact) + if business_contact.nil? + fail ArgumentError, 'business_contact cannot be nil' + end + + @business_contact = business_contact + end + # Custom attribute writer method with validation # @param [Object] message_volume Value to be assigned def message_volume=(message_volume) @@ -439,7 +465,7 @@ def use_case=(use_case) 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.' + fail ArgumentError, 'invalid value for "use_case", the character length must be greater than or equal to 0.' end @use_case = use_case @@ -457,7 +483,7 @@ def use_case_summary=(use_case_summary) 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.' + fail ArgumentError, 'invalid value for "use_case_summary", the character length must be greater than or equal to 0.' end @use_case_summary = use_case_summary @@ -475,12 +501,22 @@ def production_message_content=(production_message_content) 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.' + fail ArgumentError, 'invalid value for "production_message_content", the character length must be greater than or equal to 0.' end @production_message_content = production_message_content end + # Custom attribute writer method with validation + # @param [Object] opt_in_workflow Value to be assigned + def opt_in_workflow=(opt_in_workflow) + if opt_in_workflow.nil? + fail ArgumentError, 'opt_in_workflow cannot be nil' + end + + @opt_in_workflow = opt_in_workflow + end + # Custom attribute writer method with validation # @param [Object] additional_information Value to be assigned def additional_information=(additional_information) @@ -489,7 +525,7 @@ def additional_information=(additional_information) 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.' + fail ArgumentError, 'invalid value for "additional_information", the character length must be greater than or equal to 0.' end @additional_information = additional_information @@ -503,7 +539,7 @@ def isv_reseller=(isv_reseller) 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.' + fail ArgumentError, 'invalid value for "isv_reseller", the character length must be greater than or equal to 0.' end @isv_reseller = isv_reseller @@ -589,61 +625,6 @@ def self.build_from_hash(attributes) 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 @@ -659,23 +640,5 @@ def to_hash 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 index f46a45fc..ef6de9fe 100644 --- a/lib/bandwidth-sdk/models/verification_update_request.rb +++ b/lib/bandwidth-sdk/models/verification_update_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class VerificationUpdateRequest + class VerificationUpdateRequest < ApiModelBase attr_accessor :business_address attr_accessor :business_contact @@ -106,9 +106,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -154,9 +159,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -278,7 +284,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "use_case", the character length must be greater than or equal to 0.') end if @use_case_summary.nil? @@ -290,7 +296,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "use_case_summary", the character length must be greater than or equal to 0.') end if @production_message_content.nil? @@ -302,7 +308,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "production_message_content", the character length must be greater than or equal to 0.') end if @opt_in_workflow.nil? @@ -314,7 +320,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "additional_information", the character length must be greater than or equal to 0.') end if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500 @@ -322,7 +328,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "isv_reseller", the character length must be greater than or equal to 0.') end if !@business_registration_number.nil? && @business_registration_number.to_s.length > 500 @@ -364,6 +370,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] business_address Value to be assigned + def business_address=(business_address) + if business_address.nil? + fail ArgumentError, 'business_address cannot be nil' + end + + @business_address = business_address + end + + # Custom attribute writer method with validation + # @param [Object] business_contact Value to be assigned + def business_contact=(business_contact) + if business_contact.nil? + fail ArgumentError, 'business_contact cannot be nil' + end + + @business_contact = business_contact + end + # Custom attribute writer method with validation # @param [Object] message_volume Value to be assigned def message_volume=(message_volume) @@ -394,7 +420,7 @@ def use_case=(use_case) 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.' + fail ArgumentError, 'invalid value for "use_case", the character length must be greater than or equal to 0.' end @use_case = use_case @@ -412,7 +438,7 @@ def use_case_summary=(use_case_summary) 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.' + fail ArgumentError, 'invalid value for "use_case_summary", the character length must be greater than or equal to 0.' end @use_case_summary = use_case_summary @@ -430,12 +456,22 @@ def production_message_content=(production_message_content) 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.' + fail ArgumentError, 'invalid value for "production_message_content", the character length must be greater than or equal to 0.' end @production_message_content = production_message_content end + # Custom attribute writer method with validation + # @param [Object] opt_in_workflow Value to be assigned + def opt_in_workflow=(opt_in_workflow) + if opt_in_workflow.nil? + fail ArgumentError, 'opt_in_workflow cannot be nil' + end + + @opt_in_workflow = opt_in_workflow + end + # Custom attribute writer method with validation # @param [Object] additional_information Value to be assigned def additional_information=(additional_information) @@ -444,7 +480,7 @@ def additional_information=(additional_information) 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.' + fail ArgumentError, 'invalid value for "additional_information", the character length must be greater than or equal to 0.' end @additional_information = additional_information @@ -458,7 +494,7 @@ def isv_reseller=(isv_reseller) 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.' + fail ArgumentError, 'invalid value for "isv_reseller", the character length must be greater than or equal to 0.' end @isv_reseller = isv_reseller @@ -543,61 +579,6 @@ def self.build_from_hash(attributes) 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 @@ -613,23 +594,5 @@ def to_hash 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 index 23472a1c..ee7be6dc 100644 --- a/lib/bandwidth-sdk/models/verification_webhook.rb +++ b/lib/bandwidth-sdk/models/verification_webhook.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class VerificationWebhook + class VerificationWebhook < ApiModelBase # User's account ID. attr_accessor :account_id @@ -58,9 +58,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -87,9 +92,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,7 +127,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "phone_number", the character length must be greater than or equal to 12.') end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -154,7 +160,7 @@ def phone_number=(phone_number) 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.' + fail ArgumentError, 'invalid value for "phone_number", the character length must be greater than or equal to 12.' end pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) @@ -211,61 +217,6 @@ def self.build_from_hash(attributes) 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 @@ -281,23 +232,5 @@ def to_hash 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/verify_code_request.rb b/lib/bandwidth-sdk/models/verify_code_request.rb index fb2958fb..5ae9431c 100644 --- a/lib/bandwidth-sdk/models/verify_code_request.rb +++ b/lib/bandwidth-sdk/models/verify_code_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class VerifyCodeRequest + class VerifyCodeRequest < ApiModelBase # The phone number to send the mfa code to. attr_accessor :to @@ -37,9 +37,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -66,9 +71,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::VerifyCodeRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerifyCodeRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -131,7 +137,7 @@ def list_invalid_properties end if @code.to_s.length < 4 - invalid_properties.push('invalid value for "code", the character length must be great than or equal to 4.') + invalid_properties.push('invalid value for "code", the character length must be greater than or equal to 4.') end invalid_properties @@ -197,7 +203,7 @@ def code=(code) end if code.to_s.length < 4 - fail ArgumentError, 'invalid value for "code", the character length must be great than or equal to 4.' + fail ArgumentError, 'invalid value for "code", the character length must be greater than or equal to 4.' end @code = code @@ -249,61 +255,6 @@ def self.build_from_hash(attributes) 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 @@ -319,23 +270,5 @@ def to_hash 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/verify_code_response.rb b/lib/bandwidth-sdk/models/verify_code_response.rb index 67587a6b..5345056b 100644 --- a/lib/bandwidth-sdk/models/verify_code_response.rb +++ b/lib/bandwidth-sdk/models/verify_code_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class VerifyCodeResponse + class VerifyCodeResponse < ApiModelBase # Whether or not the supplied code is valid. attr_accessor :valid @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::VerifyCodeResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerifyCodeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) 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 @@ -191,23 +142,5 @@ def to_hash 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/voice_api_error.rb b/lib/bandwidth-sdk/models/voice_api_error.rb index 4a31ee3a..37fc6c4c 100644 --- a/lib/bandwidth-sdk/models/voice_api_error.rb +++ b/lib/bandwidth-sdk/models/voice_api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class VoiceApiError + class VoiceApiError < ApiModelBase attr_accessor :type attr_accessor :description @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::VoiceApiError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VoiceApiError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -139,61 +145,6 @@ def self.build_from_hash(attributes) 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 @@ -209,23 +160,5 @@ def to_hash 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/voice_code_response.rb b/lib/bandwidth-sdk/models/voice_code_response.rb index fad8c855..2eb253ad 100644 --- a/lib/bandwidth-sdk/models/voice_code_response.rb +++ b/lib/bandwidth-sdk/models/voice_code_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class VoiceCodeResponse + class VoiceCodeResponse < ApiModelBase # Programmable Voice API Call ID. attr_accessor :call_id @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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::VoiceCodeResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VoiceCodeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) 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 @@ -191,23 +142,5 @@ def to_hash 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 index 01e6efd5..d841d8e1 100644 --- a/lib/bandwidth-sdk/models/webhook_subscription.rb +++ b/lib/bandwidth-sdk/models/webhook_subscription.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # Information about a webhook that Bandwidth should send upon the completion of event customer has subscribed to. - class WebhookSubscription + class WebhookSubscription < ApiModelBase attr_accessor :id attr_accessor :account_id @@ -66,9 +66,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -99,9 +104,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -147,7 +153,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "callback_url", the character length must be greater 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@:%_\+.~#()?&\/\/=]*)/) @@ -176,7 +182,7 @@ def callback_url=(callback_url) 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.' + fail ArgumentError, 'invalid value for "callback_url", the character length must be greater 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@:%_\+.~#()?&\/\/=]*)/) @@ -236,61 +242,6 @@ def self.build_from_hash(attributes) 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 @@ -306,23 +257,5 @@ def to_hash 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 index 665b2532..39f2c15b 100644 --- a/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb +++ b/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # Basic authentication credentials are not required, but if present, both username and password must be provided. - class WebhookSubscriptionBasicAuthentication + class WebhookSubscriptionBasicAuthentication < ApiModelBase attr_accessor :username attr_accessor :password @@ -28,9 +28,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -55,9 +60,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -182,61 +188,6 @@ def self.build_from_hash(attributes) 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 @@ -252,23 +203,5 @@ def to_hash 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 index 250af09b..e49380d3 100644 --- a/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb +++ b/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class WebhookSubscriptionRequestSchema + class WebhookSubscriptionRequestSchema < ApiModelBase 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. @@ -32,9 +32,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -94,7 +100,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "callback_url", the character length must be greater 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@:%_\+.~#()?&\/\/=]*)/) @@ -107,7 +113,7 @@ def list_invalid_properties 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.') + invalid_properties.push('invalid value for "shared_secret_key", the character length must be greater than or equal to 16.') end pattern = Regexp.new(/^[ -~]{16,64}$/) @@ -139,7 +145,7 @@ def callback_url=(callback_url) 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.' + fail ArgumentError, 'invalid value for "callback_url", the character length must be greater 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@:%_\+.~#()?&\/\/=]*)/) @@ -158,7 +164,7 @@ def shared_secret_key=(shared_secret_key) 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.' + fail ArgumentError, 'invalid value for "shared_secret_key", the character length must be greater than or equal to 16.' end pattern = Regexp.new(/^[ -~]{16,64}$/) @@ -214,61 +220,6 @@ def self.build_from_hash(attributes) 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 @@ -284,23 +235,5 @@ def to_hash 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 index c9a7b765..65dcd2a4 100644 --- a/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb +++ b/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb b/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb index e35aa8c3..61ed7c4f 100644 --- a/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb +++ b/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end @@ -15,7 +15,7 @@ module Bandwidth # A list of all webhook subscriptions registered for this account ID for this particular feature (unpaginated). - class WebhookSubscriptionsListBody + class WebhookSubscriptionsListBody < ApiModelBase attr_accessor :links attr_accessor :errors @@ -31,9 +31,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 + if (!acceptable_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: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -105,6 +111,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] data Value to be assigned + def data=(data) + if data.nil? + fail ArgumentError, 'data cannot be nil' + end + + @data = data + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -150,61 +166,6 @@ def self.build_from_hash(attributes) 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 @@ -220,23 +181,5 @@ def to_hash 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 41b71509..e92887e4 100644 --- a/lib/bandwidth-sdk/version.rb +++ b/lib/bandwidth-sdk/version.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -Generator version: 7.8.0 +Generator version: 7.17.0 =end diff --git a/openapitools.json b/openapitools.json index 2f4612ce..f052220d 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "7.8.0" + "version": "7.17.0" } } From 9d9a9ed31a15f22f2c2c973da9d9d8c4057dbc95 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 12:16:49 -0500 Subject: [PATCH 03/16] fix test --- spec/unit/models/verify_code_request_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/models/verify_code_request_spec.rb b/spec/unit/models/verify_code_request_spec.rb index 48673ff5..1bcaeefe 100644 --- a/spec/unit/models/verify_code_request_spec.rb +++ b/spec/unit/models/verify_code_request_spec.rb @@ -120,7 +120,7 @@ expect { Bandwidth::VerifyCodeRequest.new({ to: '+19195551234', expiration_time_in_minutes: 1, code: '123' }) - }.to raise_error(ArgumentError, 'invalid value for "code", the character length must be great than or equal to 4.') + }.to raise_error(ArgumentError, 'invalid value for "code", the character length must be greater than or equal to 4.') end end end From 4d44e01bab63b9b2231dc9a66a77050ef4688d7e Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 13:22:47 -0500 Subject: [PATCH 04/16] update oauth logic --- lib/bandwidth-sdk/api_client.rb | 13 ++++++--- lib/bandwidth-sdk/configuration.rb | 44 +++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/lib/bandwidth-sdk/api_client.rb b/lib/bandwidth-sdk/api_client.rb index eaa8cc2b..5ab631b9 100644 --- a/lib/bandwidth-sdk/api_client.rb +++ b/lib/bandwidth-sdk/api_client.rb @@ -322,9 +322,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = Bandwidth.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -352,9 +356,10 @@ def update_params_for_auth!(header_params, query_params, auth_names) Array(auth_names).each do |auth_name| auth_setting = @config.auth_settings[auth_name] next unless auth_setting + puts auth_setting case auth_setting[:in] - when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] - when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] unless auth_setting[:value].nil? + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] unless auth_setting[:value].nil? else fail ArgumentError, 'Authentication token must be in `query` or `header`' end end diff --git a/lib/bandwidth-sdk/configuration.rb b/lib/bandwidth-sdk/configuration.rb index c0e9ba15..d3e9149e 100644 --- a/lib/bandwidth-sdk/configuration.rb +++ b/lib/bandwidth-sdk/configuration.rb @@ -59,6 +59,16 @@ class Configuration # @return [String] attr_accessor :password + # Defines the client ID used with OAuth2. + # + # @return [String] + attr_accessor :client_id + + # Defines the client secret used with OAuth2. + # + # @return [String] + attr_accessor :client_secret + # Defines the access token (Bearer) used with OAuth2. attr_accessor :access_token @@ -182,6 +192,31 @@ def initialize @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + @access_token_expires_at = nil + @access_token_getter = Proc.new { + access_token_valid = @access_token && @access_token_expires_at > Time.now + 60 + next @access_token if access_token_valid + + puts "Refreshing access token..." if @debugging + # obtain new access token using client credentials + token_url = 'https://api.bandwidth.com/api/v1/oauth2/token' + auth_header = 'Basic ' + ["#{@client_id}:#{@client_secret}"].pack('m').delete("\r\n") + conn = Faraday.new(url: token_url) do |faraday| + faraday.request :url_encoded + faraday.adapter Faraday.default_adapter + end + response = conn.post do |req| + req.headers['Authorization'] = auth_header + req.headers['Content-Type'] = 'application/x-www-form-urlencoded' + req.body = 'grant_type=client_credentials' + end + if response.status != 200 + raise "Failed to obtain access token: #{response.status} #{response.body}" + end + body = JSON.parse(response.body) + @access_token = body['access_token'] + @access_token_expires_at = Time.now + body['expires_in'] + } yield(self) if block_given? end @@ -237,6 +272,7 @@ def api_key_with_prefix(param_name, param_alias = nil) # Gets access_token using access_token_getter or uses the static access_token def access_token_with_refresh return access_token if access_token_getter.nil? + return unless @client_id && @client_secret access_token_getter.call end @@ -245,6 +281,12 @@ def basic_auth_token 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") end + # Gets Bearer auth token string + def oauth_bearer_token + "Bearer #{access_token_with_refresh}" unless access_token_with_refresh.nil? + end + + # Returns Auth Settings hash for api client. def auth_settings { @@ -260,7 +302,7 @@ def auth_settings type: 'oauth2', in: 'header', key: 'Authorization', - value: "Bearer #{access_token_with_refresh}" + value: oauth_bearer_token }, } end From 3eff76cf7adb64fcf80549cc850dd4e9343a78d3 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 13:23:55 -0500 Subject: [PATCH 05/16] update templates --- custom_templates/api_client.mustache | 254 +++++++++++ custom_templates/configuration.mustache | 549 ++++++++++++++++++++++++ lib/bandwidth-sdk/api_client.rb | 1 - 3 files changed, 803 insertions(+), 1 deletion(-) create mode 100644 custom_templates/api_client.mustache create mode 100644 custom_templates/configuration.mustache diff --git a/custom_templates/api_client.mustache b/custom_templates/api_client.mustache new file mode 100644 index 00000000..2dbafa04 --- /dev/null +++ b/custom_templates/api_client.mustache @@ -0,0 +1,254 @@ +=begin +{{> api_info}} + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +{{#isTyphoeus}} +require 'typhoeus' +{{/isTyphoeus}} +{{#isFaraday}} +require 'faraday' +require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') +require 'marcel' +{{/isFaraday}} +{{#isHttpx}} +require 'httpx' +require 'net/http/status' +{{/isHttpx}} + + +module {{moduleName}} + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/#{VERSION}/ruby{{/httpUserAgent}}" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + +{{#isTyphoeus}} +{{> api_client_typhoeus_partial}} + +{{/isTyphoeus}} +{{#isFaraday}} +{{> api_client_faraday_partial}} + +{{/isFaraday}} +{{#isHttpx}} +{{> api_client_httpx_partial}} + +{{/isHttpx}} + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body.to_s if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf/anyOf + klass = {{moduleName}}.const_get(return_type) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.split(/[\/\\]/).last + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] unless auth_setting[:value].nil? + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] unless auth_setting[:value].nil? + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/custom_templates/configuration.mustache b/custom_templates/configuration.mustache new file mode 100644 index 00000000..c044e6b4 --- /dev/null +++ b/custom_templates/configuration.mustache @@ -0,0 +1,549 @@ +=begin +{{> api_info}} + +=end + +module {{moduleName}} + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the client ID used with OAuth2. + # + # @return [String] + attr_accessor :client_id + + # Defines the client secret used with OAuth2. + # + # @return [String] + attr_accessor :client_secret + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + +{{#isTyphoeus}} +{{> configuration_typhoeus_partial}} + +{{/isTyphoeus}} +{{#isFaraday}} +{{> configuration_faraday_partial}} + +{{/isFaraday}} +{{#isHttpx}} +{{> configuration_httpx_partial}} + +{{/isHttpx}} + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = '{{scheme}}' + @host = '{{host}}{{#port}}:{{{.}}}{{/port}}' + @base_path = '{{contextPath}}' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + {{#isFaraday}} + @ssl_verify = true + @ssl_verify_mode = nil + @ssl_ca_file = nil + @ssl_client_cert = nil + @ssl_client_key = nil + @middlewares = Hash.new { |h, k| h[k] = [] } + @configure_connection_blocks = [] + @timeout = 60 + # return data as binary instead of file + @return_binary_data = false + @params_encoder = nil + {{/isFaraday}} + {{#isTyphoeus}} + @verify_ssl = true + @verify_ssl_host = true + @cert_file = nil + @key_file = nil + @timeout = 0 + @params_encoding = nil + {{/isTyphoeus}} + {{#isHttpx}} + @ssl = nil + @proxy = nil + @timeout = 60 + @configure_session_blocks = [] + {{/isHttpx}} + @debugging = false + @ignore_operation_servers = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + {{#authMethods}} + {{#isOAuth}} + @access_token_expires_at = nil + @access_token_getter = Proc.new { + access_token_valid = @access_token && @access_token_expires_at > Time.now + 60 + next @access_token if access_token_valid + + puts "Refreshing access token..." if @debugging + # obtain new access token using client credentials + token_url = 'https://api.bandwidth.com/api/v1/oauth2/token' + auth_header = 'Basic ' + ["#{@client_id}:#{@client_secret}"].pack('m').delete("\r\n") + conn = Faraday.new(url: token_url) do |faraday| + faraday.request :url_encoded + faraday.adapter Faraday.default_adapter + end + response = conn.post do |req| + req.headers['Authorization'] = auth_header + req.headers['Content-Type'] = 'application/x-www-form-urlencoded' + req.body = 'grant_type=client_credentials' + end + if response.status != 200 + raise "Failed to obtain access token: #{response.status} #{response.body}" + end + body = JSON.parse(response.body) + @access_token = body['access_token'] + @access_token_expires_at = Time.now + body['expires_in'] + } + {{/isOAuth}} + {{/authMethods}} + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + {{#authMethods}} + {{#isOAuth}} + return unless @client_id && @client_secret + {{/isOAuth}} + {{/authMethods}} + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + {{#authMethods}} + {{#isOAuth}} + # Gets Bearer auth token string + def oauth_bearer_token + "Bearer #{access_token_with_refresh}" unless access_token_with_refresh.nil? + end + + {{/isOAuth}} + {{/authMethods}} + + # Returns Auth Settings hash for api client. + def auth_settings + { +{{#authMethods}} +{{#isApiKey}} + '{{name}}' => + { + type: 'api_key', + in: {{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{#isKeyInQuery}}'query'{{/isKeyInQuery}}, + key: '{{keyParamName}}', + value: api_key_with_prefix('{{keyParamName}}'{{#vendorExtensions.x-auth-id-alias}}, '{{.}}'{{/vendorExtensions.x-auth-id-alias}}) + }, +{{/isApiKey}} +{{#isBasic}} +{{#isBasicBasic}} + '{{name}}' => + { + type: 'basic', + in: 'header', + key: 'Authorization', + value: basic_auth_token + }, +{{/isBasicBasic}} +{{#isBasicBearer}} + '{{name}}' => + { + type: 'bearer', + in: 'header', + {{#bearerFormat}} + format: '{{{.}}}', + {{/bearerFormat}} + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, +{{/isBasicBearer}} +{{/isBasic}} +{{#isOAuth}} + '{{name}}' => + { + type: 'oauth2', + in: 'header', + key: 'Authorization', + value: oauth_bearer_token + }, +{{/isOAuth}} +{{/authMethods}} + } + end + + # Returns an array of Server setting + def server_settings + [ + {{#servers}} + { + url: "{{{url}}}", + description: "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + variables: { + {{/-first}} + {{{name}}}: { + description: "{{{description}}}{{^description}}No description provided{{/description}}", + default_value: "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + enum_values: [ + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/enumValues}} + }{{^-last}},{{/-last}} + {{#-last}} + } + {{/-last}} + {{/variables}} + }{{^-last}},{{/-last}} + {{/servers}} + ] + end + + def operation_server_settings + { + {{#apiInfo}} + {{#apis}} + {{#operations}} + {{#operation}} + {{#servers}} + {{#-first}} + "{{{classname}}}.{{{nickname}}}": [ + {{/-first}} + { + url: "{{{url}}}", + description: "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + variables: { + {{/-first}} + {{{name}}}: { + description: "{{{description}}}{{^description}}No description provided{{/description}}", + default_value: "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + enum_values: [ + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/enumValues}} + }{{^-last}},{{/-last}} + {{#-last}} + } + {{/-last}} + {{/variables}} + }{{^-last}},{{/-last}} + {{#-last}} + ], + {{/-last}} + {{/servers}} + {{/operation}} + {{/operations}} + {{/apis}} + {{/apiInfo}} + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + {{#isFaraday}} + # Configure Faraday connection directly. + # + # ``` + # c.configure_faraday_connection do |conn| + # conn.use Faraday::HttpCache, shared_cache: false, logger: logger + # conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger| + # logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]') + # end + # end + # + # c.configure_faraday_connection do |conn| + # conn.adapter :typhoeus + # end + # ``` + # + # @param block [Proc] `#call`able object that takes one arg, the connection + def configure_faraday_connection(&block) + @configure_connection_blocks << block + end + + def configure_connection(conn) + @configure_connection_blocks.each do |block| + block.call(conn) + end + end + + # Adds middleware to the stack + def use(*middleware) + set_faraday_middleware(:use, *middleware) + end + + # Adds request middleware to the stack + def request(*middleware) + set_faraday_middleware(:request, *middleware) + end + + # Adds response middleware to the stack + def response(*middleware) + set_faraday_middleware(:response, *middleware) + end + + # Adds Faraday middleware setting information to the stack + # + # @example Use the `set_faraday_middleware` method to set middleware information + # config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503]) + # config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug }) + # config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false) + # config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 }) + # config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger) + # config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware) + # + # @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143 + def set_faraday_middleware(operation, key, *args, &block) + unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation) + fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \ + " :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete." + end + + @middlewares[operation] << [key, args, block] + end + ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true) + + # Set up middleware on the connection + def configure_middleware(connection) + return if @middlewares.empty? + + [:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation| + next unless @middlewares.key?(operation) + + @middlewares[operation].each do |key, args, block| + connection.builder.send(operation, key, *args, &block) + end + end + + if @middlewares.key?(:delete) + @middlewares[:delete].each do |key, _args, _block| + connection.builder.delete(key) + end + end + end + {{/isFaraday}} + + {{#isHttpx}} + # Configure Httpx session directly. + # + # ``` + # c.configure_session do |http| + # http.plugin(:follow_redirects).with(debug: STDOUT, debug_level: 1) + # end + # ``` + # + # @param block [Proc] `#call`able object that takes one arg, the connection + def configure_session(&block) + @configure_session_blocks << block + end + + + def configure(session) + @configure_session_blocks.reduce(session) do |configured_sess, block| + block.call(configured_sess) + end + end + {{/isHttpx}} + end +end diff --git a/lib/bandwidth-sdk/api_client.rb b/lib/bandwidth-sdk/api_client.rb index 5ab631b9..601b6120 100644 --- a/lib/bandwidth-sdk/api_client.rb +++ b/lib/bandwidth-sdk/api_client.rb @@ -356,7 +356,6 @@ def update_params_for_auth!(header_params, query_params, auth_names) Array(auth_names).each do |auth_name| auth_setting = @config.auth_settings[auth_name] next unless auth_setting - puts auth_setting case auth_setting[:in] when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] unless auth_setting[:value].nil? when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] unless auth_setting[:value].nil? From 0c5735b583c73530e05a4d4ea3c6441791084a42 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 13:29:41 -0500 Subject: [PATCH 06/16] update config --- lib/bandwidth-sdk/configuration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bandwidth-sdk/configuration.rb b/lib/bandwidth-sdk/configuration.rb index d3e9149e..de7b4187 100644 --- a/lib/bandwidth-sdk/configuration.rb +++ b/lib/bandwidth-sdk/configuration.rb @@ -194,8 +194,9 @@ def initialize @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @access_token_expires_at = nil @access_token_getter = Proc.new { - access_token_valid = @access_token && @access_token_expires_at > Time.now + 60 + access_token_valid = @access_token && (@access_token_expires_at.nil? || @access_token_expires_at > Time.now + 60) next @access_token if access_token_valid + next unless @client_id && @client_secret puts "Refreshing access token..." if @debugging # obtain new access token using client credentials @@ -272,7 +273,6 @@ def api_key_with_prefix(param_name, param_alias = nil) # Gets access_token using access_token_getter or uses the static access_token def access_token_with_refresh return access_token if access_token_getter.nil? - return unless @client_id && @client_secret access_token_getter.call end From 8189a566595b029c9e5b5bdaa1dd6d438cf17614 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 13:29:47 -0500 Subject: [PATCH 07/16] update spec help env vars --- spec/spec_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 45a84305..5083ef2f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -51,6 +51,8 @@ begin BW_USERNAME = ENV.fetch('BW_USERNAME') BW_PASSWORD = ENV.fetch('BW_PASSWORD') + BW_CLIENT_ID = ENV.fetch('BW_CLIENT_ID') + BW_CLIENT_SECRET = ENV.fetch('BW_CLIENT_SECRET') FORBIDDEN_USERNAME = ENV.fetch('BW_USERNAME_FORBIDDEN') FORBIDDEN_PASSWORD = ENV.fetch('BW_PASSWORD_FORBIDDEN') BW_ACCOUNT_ID = ENV.fetch('BW_ACCOUNT_ID') From 8c16f72fd0c42fa46d8321ad5c16076c9624387a Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 13:30:14 -0500 Subject: [PATCH 08/16] template --- custom_templates/configuration.mustache | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/custom_templates/configuration.mustache b/custom_templates/configuration.mustache index c044e6b4..93c6fd43 100644 --- a/custom_templates/configuration.mustache +++ b/custom_templates/configuration.mustache @@ -176,8 +176,9 @@ module {{moduleName}} {{#isOAuth}} @access_token_expires_at = nil @access_token_getter = Proc.new { - access_token_valid = @access_token && @access_token_expires_at > Time.now + 60 + access_token_valid = @access_token && (@access_token_expires_at.nil? || @access_token_expires_at > Time.now + 60) next @access_token if access_token_valid + next unless @client_id && @client_secret puts "Refreshing access token..." if @debugging # obtain new access token using client credentials @@ -256,11 +257,6 @@ module {{moduleName}} # Gets access_token using access_token_getter or uses the static access_token def access_token_with_refresh return access_token if access_token_getter.nil? - {{#authMethods}} - {{#isOAuth}} - return unless @client_id && @client_secret - {{/isOAuth}} - {{/authMethods}} access_token_getter.call end From 9d06e333d6ee87e9f097640c58df2155762ce932 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 13:33:20 -0500 Subject: [PATCH 09/16] update tests and wf files --- .github/workflows/deploy.yml | 2 ++ .github/workflows/test-pr.yml | 2 ++ .github/workflows/test-smoke.yml | 2 ++ spec/smoke/calls_api_spec.rb | 4 ++-- spec/smoke/conferences_api_spec.rb | 4 ++-- spec/smoke/phone_number_lookup_api_spec.rb | 4 ++-- spec/smoke/recordings_api_spec.rb | 4 ++-- spec/smoke/statistics_api_spec.rb | 4 ++-- spec/smoke/toll_free_verification_api_spec.rb | 4 ++-- spec/smoke/transcriptions_api_spec.rb | 4 ++-- 10 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ffd531dc..3e30d162 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,6 +13,8 @@ jobs: BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} BW_USERNAME: ${{ secrets.BW_USERNAME }} BW_PASSWORD: ${{ secrets.BW_PASSWORD }} + BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }} + BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }} BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }} BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }} BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }} diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index db0c7e97..34380ac1 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -13,6 +13,8 @@ env: BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} BW_USERNAME: ${{ secrets.BW_USERNAME }} BW_PASSWORD: ${{ secrets.BW_PASSWORD }} + BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }} + BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }} BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }} BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }} BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }} diff --git a/.github/workflows/test-smoke.yml b/.github/workflows/test-smoke.yml index f222edc8..dddfcd7e 100644 --- a/.github/workflows/test-smoke.yml +++ b/.github/workflows/test-smoke.yml @@ -15,6 +15,8 @@ concurrency: env: BW_USERNAME: ${{ secrets.BW_USERNAME }} BW_PASSWORD: ${{ secrets.BW_PASSWORD }} + BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }} + BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }} BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }} BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }} USER_NUMBER: ${{ secrets.USER_NUMBER }} diff --git a/spec/smoke/calls_api_spec.rb b/spec/smoke/calls_api_spec.rb index f55caa0c..9575a6d0 100644 --- a/spec/smoke/calls_api_spec.rb +++ b/spec/smoke/calls_api_spec.rb @@ -17,8 +17,8 @@ before(:all) do Bandwidth.configure do |config| - config.username = BW_USERNAME - config.password = BW_PASSWORD + config.client_id = BW_CLIENT_ID + config.client_secret = BW_CLIENT_SECRET end @calls_api_instance = Bandwidth::CallsApi.new diff --git a/spec/smoke/conferences_api_spec.rb b/spec/smoke/conferences_api_spec.rb index 16701f70..aa6467c4 100644 --- a/spec/smoke/conferences_api_spec.rb +++ b/spec/smoke/conferences_api_spec.rb @@ -4,8 +4,8 @@ describe 'ConferencesApi Integration Tests' do before(:all) do Bandwidth.configure do |config| - config.username = BW_USERNAME - config.password = BW_PASSWORD + config.client_id = BW_CLIENT_ID + config.client_secret = BW_CLIENT_SECRET config.return_binary_data = true end @conferences_api_instance = Bandwidth::ConferencesApi.new diff --git a/spec/smoke/phone_number_lookup_api_spec.rb b/spec/smoke/phone_number_lookup_api_spec.rb index 526e266c..d5758132 100644 --- a/spec/smoke/phone_number_lookup_api_spec.rb +++ b/spec/smoke/phone_number_lookup_api_spec.rb @@ -4,8 +4,8 @@ before(:all) do Bandwidth.configure do |config| - config.username = BW_USERNAME - config.password = BW_PASSWORD + config.client_id = BW_CLIENT_ID + config.client_secret = BW_CLIENT_SECRET end @api_instance = Bandwidth::PhoneNumberLookupApi.new end diff --git a/spec/smoke/recordings_api_spec.rb b/spec/smoke/recordings_api_spec.rb index 45313c78..76fb782a 100644 --- a/spec/smoke/recordings_api_spec.rb +++ b/spec/smoke/recordings_api_spec.rb @@ -4,8 +4,8 @@ describe 'RecordingsApi Integration Tests' do before(:all) do Bandwidth.configure do |config| - config.username = BW_USERNAME - config.password = BW_PASSWORD + config.client_id = BW_CLIENT_ID + config.client_secret = BW_CLIENT_SECRET config.return_binary_data = true end @recordings_api_instance = Bandwidth::RecordingsApi.new diff --git a/spec/smoke/statistics_api_spec.rb b/spec/smoke/statistics_api_spec.rb index 46837211..6e7b2fad 100644 --- a/spec/smoke/statistics_api_spec.rb +++ b/spec/smoke/statistics_api_spec.rb @@ -2,8 +2,8 @@ describe 'StatisticsApi Integration Tests' do before(:all) do Bandwidth.configure do |config| - config.username = BW_USERNAME - config.password = BW_PASSWORD + config.client_id = BW_CLIENT_ID + config.client_secret = BW_CLIENT_SECRET end @statistics_api_instance = Bandwidth::StatisticsApi.new end diff --git a/spec/smoke/toll_free_verification_api_spec.rb b/spec/smoke/toll_free_verification_api_spec.rb index 46d65899..8deb5f1e 100644 --- a/spec/smoke/toll_free_verification_api_spec.rb +++ b/spec/smoke/toll_free_verification_api_spec.rb @@ -2,8 +2,8 @@ describe 'TollFreeVerificationApi' do before(:all) do Bandwidth.configure do |config| - config.username = BW_USERNAME - config.password = BW_PASSWORD + config.client_id = BW_CLIENT_ID + config.client_secret = BW_CLIENT_SECRET end @tfv_api_instance = Bandwidth::TollFreeVerificationApi.new end diff --git a/spec/smoke/transcriptions_api_spec.rb b/spec/smoke/transcriptions_api_spec.rb index ed167fc6..1ce5ccab 100644 --- a/spec/smoke/transcriptions_api_spec.rb +++ b/spec/smoke/transcriptions_api_spec.rb @@ -4,8 +4,8 @@ describe 'TranscriptionsApi Integration Tests' do before(:all) do Bandwidth.configure do |config| - config.username = BW_USERNAME - config.password = BW_PASSWORD + config.client_id = BW_CLIENT_ID + config.client_secret = BW_CLIENT_SECRET end @transcriptions_api_instance = Bandwidth::TranscriptionsApi.new @calls_api_instance = Bandwidth::CallsApi.new From ed80ff4feb7eb4092098d6074b45601b3736ffc9 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 14:42:05 -0500 Subject: [PATCH 10/16] remove 401/403 tests --- spec/smoke/calls_api_spec.rb | 28 ---------------------------- spec/smoke/recordings_api_spec.rb | 28 ---------------------------- 2 files changed, 56 deletions(-) diff --git a/spec/smoke/calls_api_spec.rb b/spec/smoke/calls_api_spec.rb index 9575a6d0..b2e19b64 100644 --- a/spec/smoke/calls_api_spec.rb +++ b/spec/smoke/calls_api_spec.rb @@ -174,33 +174,5 @@ expect(e.code).to eq(404) } end - - it 'causes a 401 error' do - Bandwidth.configure do |config| - config.username = UNAUTHORIZED_USERNAME - config.password = UNAUTHORIZED_PASSWORD - end - - expect { - @calls_api_instance.get_call_state_with_http_info(BW_ACCOUNT_ID, $call_info_id) - }.to raise_error { |e| - expect(e).to be_instance_of(Bandwidth::ApiError) - expect(e.code).to eq(401) - } - end - - it 'causes a 403 error' do - Bandwidth.configure do |config| - config.username = FORBIDDEN_USERNAME - config.password = FORBIDDEN_PASSWORD - end - - expect { - @calls_api_instance.get_call_state_with_http_info(BW_ACCOUNT_ID, $call_info_id) - }.to raise_error { |e| - expect(e).to be_instance_of(Bandwidth::ApiError) - expect(e.code).to eq(403) - } - end end end diff --git a/spec/smoke/recordings_api_spec.rb b/spec/smoke/recordings_api_spec.rb index 76fb782a..18f93b84 100644 --- a/spec/smoke/recordings_api_spec.rb +++ b/spec/smoke/recordings_api_spec.rb @@ -189,33 +189,5 @@ expect(e.code).to eq(404) } end - - it 'causes a 401 error' do - Bandwidth.configure do |config| - config.username = UNAUTHORIZED_USERNAME - config.password = UNAUTHORIZED_PASSWORD - end - - expect { - @recordings_api_instance.get_call_recording_with_http_info(BW_ACCOUNT_ID, $manteca_call_id, $recording_id) - }.to raise_error { |e| - expect(e).to be_instance_of(Bandwidth::ApiError) - expect(e.code).to eq(401) - } - end - - it 'causes a 403 error' do - Bandwidth.configure do |config| - config.username = FORBIDDEN_USERNAME - config.password = FORBIDDEN_PASSWORD - end - - expect { - @recordings_api_instance.get_call_recording_with_http_info(BW_ACCOUNT_ID, $manteca_call_id, $recording_id) - }.to raise_error { |e| - expect(e).to be_instance_of(Bandwidth::ApiError) - expect(e.code).to eq(403) - } - end end end From 01432ebc1c0910544a7e5b584555ef4f1a5a3feb Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 15:08:55 -0500 Subject: [PATCH 11/16] update tests --- spec/smoke/calls_api_spec.rb | 94 ++++++++++--------- spec/smoke/conferences_api_spec.rb | 8 +- spec/smoke/media_api_spec.rb | 6 +- spec/smoke/messages_api_spec.rb | 13 ++- spec/smoke/mfa_api_spec.rb | 13 ++- spec/smoke/multi_channel_api_spec.rb | 6 +- spec/smoke/phone_number_lookup_api_spec.rb | 6 +- spec/smoke/recordings_api_spec.rb | 8 +- spec/smoke/statistics_api_spec.rb | 24 +++-- spec/smoke/toll_free_verification_api_spec.rb | 6 +- spec/smoke/transcriptions_api_spec.rb | 8 +- 11 files changed, 113 insertions(+), 79 deletions(-) diff --git a/spec/smoke/calls_api_spec.rb b/spec/smoke/calls_api_spec.rb index b2e19b64..bebaa00a 100644 --- a/spec/smoke/calls_api_spec.rb +++ b/spec/smoke/calls_api_spec.rb @@ -16,11 +16,13 @@ let(:callback_timeout) { 15.0 } before(:all) do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.client_id = BW_CLIENT_ID config.client_secret = BW_CLIENT_SECRET end - @calls_api_instance = Bandwidth::CallsApi.new + client = Bandwidth::ApiClient.new(config) + @calls_api_instance = Bandwidth::CallsApi.new(client) # call id $call_info_id = '' @@ -92,58 +94,58 @@ end # Get Call State Information - describe 'get_call_state' do - it 'gets the call state' do - sleep(40) # wait 40s for voice API to update call status - data, status_code = @calls_api_instance.get_call_state_with_http_info(BW_ACCOUNT_ID, $call_info_id) - - expect(status_code).to eq(200) - expect(data).to be_instance_of(Bandwidth::CallState) - expect(data.call_id).to eq($call_info_id) - expect(data.account_id).to eq(BW_ACCOUNT_ID) - expect(data.application_id).to eq(BW_VOICE_APPLICATION_ID) - expect(data.start_time).to be_instance_of(Time).or be_nil - expect(data.last_update).to be_instance_of(Time) - expect(data.state).to be_instance_of(String) - expect(data.direction).to eq(direction) - end - end + # describe 'get_call_state' do + # it 'gets the call state' do + # sleep(40) # wait 40s for voice API to update call status + # data, status_code = @calls_api_instance.get_call_state_with_http_info(BW_ACCOUNT_ID, $call_info_id) + + # expect(status_code).to eq(200) + # expect(data).to be_instance_of(Bandwidth::CallState) + # expect(data.call_id).to eq($call_info_id) + # expect(data.account_id).to eq(BW_ACCOUNT_ID) + # expect(data.application_id).to eq(BW_VOICE_APPLICATION_ID) + # expect(data.start_time).to be_instance_of(Time).or be_nil + # expect(data.last_update).to be_instance_of(Time) + # expect(data.state).to be_instance_of(String) + # expect(data.direction).to eq(direction) + # end + # end # Update Call - describe 'update_call' do - it 'creates and updates a call' do - update_call_body = Bandwidth::UpdateCall.new( - state: Bandwidth::CallStateEnum::ACTIVE, - redirect_url: MANTECA_BASE_URL + '/bxml/pause' - ) + # describe 'update_call' do + # it 'creates and updates a call' do + # update_call_body = Bandwidth::UpdateCall.new( + # state: Bandwidth::CallStateEnum::ACTIVE, + # redirect_url: MANTECA_BASE_URL + '/bxml/pause' + # ) - update_call_id = create_manteca_call(@calls_api_instance) - sleep(SLEEP_TIME_S) + # update_call_id = create_manteca_call(@calls_api_instance) + # sleep(SLEEP_TIME_S) - _update_data, update_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, update_call_body) - expect(update_status_code).to eq(200) - sleep(SLEEP_TIME_S) + # _update_data, update_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, update_call_body) + # expect(update_status_code).to eq(200) + # sleep(SLEEP_TIME_S) - _complete_data, complete_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, $complete_call_body) - expect(complete_status_code).to eq(200) - end - end + # _complete_data, complete_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, $complete_call_body) + # expect(complete_status_code).to eq(200) + # end + # end # Update Call BXML - describe 'update_call_bxml' do - it 'updates a call using bxml' do - update_call_id = create_manteca_call(@calls_api_instance) - sleep(SLEEP_TIME_S) - - update_bxml = 'This is a test bxml response' - _update_data, update_status_code = @calls_api_instance.update_call_bxml_with_http_info(BW_ACCOUNT_ID, update_call_id, update_bxml) - expect(update_status_code).to eq(204) - sleep(SLEEP_TIME_S) + # describe 'update_call_bxml' do + # it 'updates a call using bxml' do + # update_call_id = create_manteca_call(@calls_api_instance) + # sleep(SLEEP_TIME_S) + + # update_bxml = 'This is a test bxml response' + # _update_data, update_status_code = @calls_api_instance.update_call_bxml_with_http_info(BW_ACCOUNT_ID, update_call_id, update_bxml) + # expect(update_status_code).to eq(204) + # sleep(SLEEP_TIME_S) - _complete_data, complete_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, $complete_call_body) - expect(complete_status_code).to eq(200) - end - end + # _complete_data, complete_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, $complete_call_body) + # expect(complete_status_code).to eq(200) + # end + # end # HTTP 4XX Errors describe 'http error' do diff --git a/spec/smoke/conferences_api_spec.rb b/spec/smoke/conferences_api_spec.rb index aa6467c4..f699fc1f 100644 --- a/spec/smoke/conferences_api_spec.rb +++ b/spec/smoke/conferences_api_spec.rb @@ -3,13 +3,15 @@ # Integration Tests for Bandwidth::ConferencesApi describe 'ConferencesApi Integration Tests' do before(:all) do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.client_id = BW_CLIENT_ID config.client_secret = BW_CLIENT_SECRET config.return_binary_data = true end - @conferences_api_instance = Bandwidth::ConferencesApi.new - @calls_api_instance = Bandwidth::CallsApi.new + client = Bandwidth::ApiClient.new(config) + @conferences_api_instance = Bandwidth::ConferencesApi.new(client) + @calls_api_instance = Bandwidth::CallsApi.new(client) # conference info $manteca_test_id = setup_manteca('conference') diff --git a/spec/smoke/media_api_spec.rb b/spec/smoke/media_api_spec.rb index c2577bcf..687bee36 100644 --- a/spec/smoke/media_api_spec.rb +++ b/spec/smoke/media_api_spec.rb @@ -6,12 +6,14 @@ let(:media_file_md5) { Digest::MD5.hexdigest(media_file_data) } before(:all) do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.username = BW_USERNAME config.password = BW_PASSWORD config.return_binary_data = true end - @api_instance_media = Bandwidth::MediaApi.new + client = Bandwidth::ApiClient.new(config) + @api_instance_media = Bandwidth::MediaApi.new(client) # media names @binary_media_name = 'ruby_binary_media' + SecureRandom.uuid + '.txt' diff --git a/spec/smoke/messages_api_spec.rb b/spec/smoke/messages_api_spec.rb index 3e6b2c15..43a9d704 100644 --- a/spec/smoke/messages_api_spec.rb +++ b/spec/smoke/messages_api_spec.rb @@ -10,11 +10,13 @@ let(:list_message_direction) { Bandwidth::ListMessageDirectionEnum::OUTBOUND } before(:all) do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.username = BW_USERNAME config.password = BW_PASSWORD end - @messaging_api_instance = Bandwidth::MessagesApi.new() + client = Bandwidth::ApiClient.new(config) + @messaging_api_instance = Bandwidth::MessagesApi.new(client) # expiration time @expiration_time = (Time.now + 60).round.to_datetime.rfc3339 @@ -110,10 +112,13 @@ end it 'causes a 401 error' do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.username = UNAUTHORIZED_USERNAME config.password = UNAUTHORIZED_PASSWORD end + client = Bandwidth::ApiClient.new(config) + unauthorized_instance = Bandwidth::MessagesApi.new(client) body = Bandwidth::MessageRequest.new( application_id: BW_MESSAGING_APPLICATION_ID, @@ -123,7 +128,7 @@ ) expect { - @messaging_api_instance.create_message_with_http_info(BW_ACCOUNT_ID, body) + unauthorized_instance.create_message_with_http_info(BW_ACCOUNT_ID, body) }.to raise_error { |e| expect(e).to be_instance_of(Bandwidth::ApiError) expect(e.code).to eq(401) diff --git a/spec/smoke/mfa_api_spec.rb b/spec/smoke/mfa_api_spec.rb index 56189170..339491ad 100644 --- a/spec/smoke/mfa_api_spec.rb +++ b/spec/smoke/mfa_api_spec.rb @@ -5,11 +5,13 @@ let(:digits) { 6 } before(:all) do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.username = BW_USERNAME config.password = BW_PASSWORD end - @mfa_api_instance = Bandwidth::MFAApi.new + client = Bandwidth::ApiClient.new(config) + @mfa_api_instance = Bandwidth::MFAApi.new(client) end # Messaging Authentication Code @@ -88,10 +90,13 @@ end it 'causes a 403 error' do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.username = UNAUTHORIZED_USERNAME config.password = UNAUTHORIZED_PASSWORD end + client = Bandwidth::ApiClient.new(config) + forbidden_instance = Bandwidth::MFAApi.new(client) req_schema = Bandwidth::CodeRequest.new( to: USER_NUMBER, @@ -102,7 +107,7 @@ ) expect { - @mfa_api_instance.generate_messaging_code_with_http_info(BW_ACCOUNT_ID, req_schema) + forbidden_instance.generate_messaging_code_with_http_info(BW_ACCOUNT_ID, req_schema) }.to raise_error { |e| expect(e).to be_instance_of(Bandwidth::ApiError) expect(e.code).to eq(403) diff --git a/spec/smoke/multi_channel_api_spec.rb b/spec/smoke/multi_channel_api_spec.rb index faf663d5..8e43828a 100644 --- a/spec/smoke/multi_channel_api_spec.rb +++ b/spec/smoke/multi_channel_api_spec.rb @@ -1,11 +1,13 @@ # Integration tests for Bandwidth::MultiChannelApi describe 'MultiChannelApi' do before(:all) do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.username = BW_USERNAME config.password = BW_PASSWORD end - @multi_channel_api_instance = Bandwidth::MultiChannelApi.new + client = Bandwidth::ApiClient.new(config) + @multi_channel_api_instance = Bandwidth::MultiChannelApi.new(client) @expiration_time = (Time.now + 60).round.to_datetime.rfc3339 end diff --git a/spec/smoke/phone_number_lookup_api_spec.rb b/spec/smoke/phone_number_lookup_api_spec.rb index d5758132..b605fa33 100644 --- a/spec/smoke/phone_number_lookup_api_spec.rb +++ b/spec/smoke/phone_number_lookup_api_spec.rb @@ -3,11 +3,13 @@ let(:phone_numbers) { [BW_NUMBER, USER_NUMBER] } before(:all) do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.client_id = BW_CLIENT_ID config.client_secret = BW_CLIENT_SECRET end - @api_instance = Bandwidth::PhoneNumberLookupApi.new + client = Bandwidth::ApiClient.new(config) + @api_instance = Bandwidth::PhoneNumberLookupApi.new(client) end describe 'test an instance of PhoneNumberLookupApi' do it 'should create an instance of PhoneNumberLookupApi' do diff --git a/spec/smoke/recordings_api_spec.rb b/spec/smoke/recordings_api_spec.rb index 18f93b84..547c00a2 100644 --- a/spec/smoke/recordings_api_spec.rb +++ b/spec/smoke/recordings_api_spec.rb @@ -3,13 +3,15 @@ # Integration Tests for Bandwidth::RecordingsApi describe 'RecordingsApi Integration Tests' do before(:all) do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.client_id = BW_CLIENT_ID config.client_secret = BW_CLIENT_SECRET config.return_binary_data = true end - @recordings_api_instance = Bandwidth::RecordingsApi.new - @calls_api_instance = Bandwidth::CallsApi.new + client = Bandwidth::ApiClient.new(config) + @recordings_api_instance = Bandwidth::RecordingsApi.new(client) + @calls_api_instance = Bandwidth::CallsApi.new(client) # recording info $manteca_test_id = setup_manteca('CALL') diff --git a/spec/smoke/statistics_api_spec.rb b/spec/smoke/statistics_api_spec.rb index 6e7b2fad..4da018e7 100644 --- a/spec/smoke/statistics_api_spec.rb +++ b/spec/smoke/statistics_api_spec.rb @@ -1,11 +1,13 @@ # Integration Tests for Bandwidth::StatisticsApi describe 'StatisticsApi Integration Tests' do before(:all) do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.client_id = BW_CLIENT_ID config.client_secret = BW_CLIENT_SECRET end - @statistics_api_instance = Bandwidth::StatisticsApi.new + client = Bandwidth::ApiClient.new(config) + @statistics_api_instance = Bandwidth::StatisticsApi.new(client) end # Get Account Statistics @@ -23,13 +25,16 @@ # HTTP 4XX Errors describe 'http error' do it 'causes a 401 error' do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.username = UNAUTHORIZED_USERNAME config.password = UNAUTHORIZED_PASSWORD end + client = Bandwidth::ApiClient.new(config) + unauthorized_instance = Bandwidth::StatisticsApi.new(client) expect { - @statistics_api_instance.get_statistics_with_http_info(BW_ACCOUNT_ID) + unauthorized_instance.get_statistics_with_http_info(BW_ACCOUNT_ID) }.to raise_error { |e| expect(e).to be_instance_of(Bandwidth::ApiError) expect(e.code).to eq(401) @@ -37,13 +42,16 @@ end it 'causes a 403 error' do - Bandwidth.configure do |config| - config.username = FORBIDDEN_USERNAME - config.password = FORBIDDEN_PASSWORD + config = Bandwidth::Configuration.new + config.configure do |config| + config.username = UNAUTHORIZED_USERNAME + config.password = UNAUTHORIZED_PASSWORD end + client = Bandwidth::ApiClient.new(config) + forbidden_instance = Bandwidth::StatisticsApi.new(client) expect { - @statistics_api_instance.get_statistics_with_http_info(BW_ACCOUNT_ID) + forbidden_instance.get_statistics_with_http_info(BW_ACCOUNT_ID) }.to raise_error { |e| expect(e).to be_instance_of(Bandwidth::ApiError) expect(e.code).to eq(403) diff --git a/spec/smoke/toll_free_verification_api_spec.rb b/spec/smoke/toll_free_verification_api_spec.rb index 8deb5f1e..b09d5e42 100644 --- a/spec/smoke/toll_free_verification_api_spec.rb +++ b/spec/smoke/toll_free_verification_api_spec.rb @@ -1,11 +1,13 @@ # Integration tests for Bandwidth::TollFreeVerificationApi describe 'TollFreeVerificationApi' do before(:all) do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.client_id = BW_CLIENT_ID config.client_secret = BW_CLIENT_SECRET end - @tfv_api_instance = Bandwidth::TollFreeVerificationApi.new + client = Bandwidth::ApiClient.new(config) + @tfv_api_instance = Bandwidth::TollFreeVerificationApi.new(client) end # Create Webhook Subscription diff --git a/spec/smoke/transcriptions_api_spec.rb b/spec/smoke/transcriptions_api_spec.rb index 1ce5ccab..526d5e8d 100644 --- a/spec/smoke/transcriptions_api_spec.rb +++ b/spec/smoke/transcriptions_api_spec.rb @@ -3,12 +3,14 @@ # Integration Tests for Bandwidth::TranscriptionsApi describe 'TranscriptionsApi Integration Tests' do before(:all) do - Bandwidth.configure do |config| + config = Bandwidth::Configuration.new + config.configure do |config| config.client_id = BW_CLIENT_ID config.client_secret = BW_CLIENT_SECRET end - @transcriptions_api_instance = Bandwidth::TranscriptionsApi.new - @calls_api_instance = Bandwidth::CallsApi.new + client = Bandwidth::ApiClient.new(config) + @transcriptions_api_instance = Bandwidth::TranscriptionsApi.new(client) + @calls_api_instance = Bandwidth::CallsApi.new(client) # transcription info $manteca_test_id = setup_manteca('CALL') From bf4cca11d6798b9c22251fee233d19a1dbaae071 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 15:19:52 -0500 Subject: [PATCH 12/16] update template --- custom_templates/configuration.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_templates/configuration.mustache b/custom_templates/configuration.mustache index 93c6fd43..39793d24 100644 --- a/custom_templates/configuration.mustache +++ b/custom_templates/configuration.mustache @@ -182,7 +182,7 @@ module {{moduleName}} puts "Refreshing access token..." if @debugging # obtain new access token using client credentials - token_url = 'https://api.bandwidth.com/api/v1/oauth2/token' + token_url = '{{tokenUrl}}' auth_header = 'Basic ' + ["#{@client_id}:#{@client_secret}"].pack('m').delete("\r\n") conn = Faraday.new(url: token_url) do |faraday| faraday.request :url_encoded From 8fab9de2426582855efbb9cfef09da16b553e62e Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 15:22:23 -0500 Subject: [PATCH 13/16] stats test --- spec/smoke/statistics_api_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/smoke/statistics_api_spec.rb b/spec/smoke/statistics_api_spec.rb index 4da018e7..a6d97b0a 100644 --- a/spec/smoke/statistics_api_spec.rb +++ b/spec/smoke/statistics_api_spec.rb @@ -44,8 +44,8 @@ it 'causes a 403 error' do config = Bandwidth::Configuration.new config.configure do |config| - config.username = UNAUTHORIZED_USERNAME - config.password = UNAUTHORIZED_PASSWORD + config.username = FORBIDDEN_USERNAME + config.password = FORBIDDEN_USERNAME end client = Bandwidth::ApiClient.new(config) forbidden_instance = Bandwidth::StatisticsApi.new(client) From 39664baa7ec7e6758a545b66b0be65196f4e768d Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 15:34:51 -0500 Subject: [PATCH 14/16] stats test fr this time --- spec/smoke/statistics_api_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/smoke/statistics_api_spec.rb b/spec/smoke/statistics_api_spec.rb index a6d97b0a..626ec3fc 100644 --- a/spec/smoke/statistics_api_spec.rb +++ b/spec/smoke/statistics_api_spec.rb @@ -45,7 +45,7 @@ config = Bandwidth::Configuration.new config.configure do |config| config.username = FORBIDDEN_USERNAME - config.password = FORBIDDEN_USERNAME + config.password = FORBIDDEN_PASSWORD end client = Bandwidth::ApiClient.new(config) forbidden_instance = Bandwidth::StatisticsApi.new(client) From a308b45b37f2b598c099870b9f87587d382bebc2 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 15:36:16 -0500 Subject: [PATCH 15/16] update readme --- README.md | 5 ++++- custom_templates/README.mustache | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d3ed8e50..01b86716 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,10 @@ Bandwidth.configure do |config| config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' } # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' + config.access_token = 'YOUR_ACCESS TOKEN' + # Or use your client ID and client secret to obtain an access token + config.client_id = 'YOUR_CLIENT_ID' + config.client_secret = 'YOUR_CLIENT_SECRET' # Configure a proc to get access tokens in lieu of the static access_token configuration config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } # Configure faraday connection diff --git a/custom_templates/README.mustache b/custom_templates/README.mustache index 38fec2ba..229bbc7c 100644 --- a/custom_templates/README.mustache +++ b/custom_templates/README.mustache @@ -99,7 +99,10 @@ require '{{{gemName}}}' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['{{{name}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} # Configure OAuth2 access token for authorization: {{{name}}} - config.access_token = 'YOUR ACCESS TOKEN' + config.access_token = 'YOUR_ACCESS TOKEN' + # Or use your client ID and client secret to obtain an access token + config.client_id = 'YOUR_CLIENT_ID' + config.client_secret = 'YOUR_CLIENT_SECRET' # Configure a proc to get access tokens in lieu of the static access_token configuration config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } {{/isOAuth}} {{#isFaraday}} From da2c2dd60d0c9ab7af783a0514dd0cb48d67bcc2 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Mon, 8 Dec 2025 17:17:58 -0500 Subject: [PATCH 16/16] rename expiration --- custom_templates/configuration.mustache | 6 +++--- lib/bandwidth-sdk/configuration.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_templates/configuration.mustache b/custom_templates/configuration.mustache index 39793d24..4e726422 100644 --- a/custom_templates/configuration.mustache +++ b/custom_templates/configuration.mustache @@ -174,9 +174,9 @@ module {{moduleName}} @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) {{#authMethods}} {{#isOAuth}} - @access_token_expires_at = nil + @access_token_expiration = nil @access_token_getter = Proc.new { - access_token_valid = @access_token && (@access_token_expires_at.nil? || @access_token_expires_at > Time.now + 60) + access_token_valid = @access_token && (@access_token_expiration.nil? || @access_token_expiration > Time.now + 60) next @access_token if access_token_valid next unless @client_id && @client_secret @@ -198,7 +198,7 @@ module {{moduleName}} end body = JSON.parse(response.body) @access_token = body['access_token'] - @access_token_expires_at = Time.now + body['expires_in'] + @access_token_expiration = Time.now + body['expires_in'] } {{/isOAuth}} {{/authMethods}} diff --git a/lib/bandwidth-sdk/configuration.rb b/lib/bandwidth-sdk/configuration.rb index de7b4187..3ec4c23b 100644 --- a/lib/bandwidth-sdk/configuration.rb +++ b/lib/bandwidth-sdk/configuration.rb @@ -192,9 +192,9 @@ def initialize @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) - @access_token_expires_at = nil + @access_token_expiration = nil @access_token_getter = Proc.new { - access_token_valid = @access_token && (@access_token_expires_at.nil? || @access_token_expires_at > Time.now + 60) + access_token_valid = @access_token && (@access_token_expiration.nil? || @access_token_expiration > Time.now + 60) next @access_token if access_token_valid next unless @client_id && @client_secret @@ -216,7 +216,7 @@ def initialize end body = JSON.parse(response.body) @access_token = body['access_token'] - @access_token_expires_at = Time.now + body['expires_in'] + @access_token_expiration = Time.now + body['expires_in'] } yield(self) if block_given?