bandwidth-sdk 16.2.2 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -8
  3. data/README.md +20 -7
  4. data/bandwidth.yml +551 -277
  5. data/coverage/.last_run.json +1 -1
  6. data/coverage/.resultset.json +197 -94
  7. data/coverage/index.html +2425 -1307
  8. data/docs/AsyncLookupRequest.md +18 -0
  9. data/docs/{LookupRequest.md → CompletedLookupStatusEnum.md} +2 -5
  10. data/docs/CreateAsyncBulkLookupResponse.md +22 -0
  11. data/docs/{CreateLookupResponse.md → CreateAsyncBulkLookupResponseData.md} +4 -4
  12. data/docs/CreateSyncLookupResponse.md +22 -0
  13. data/docs/CreateSyncLookupResponseData.md +22 -0
  14. data/docs/DeactivationEventEnum.md +15 -0
  15. data/docs/GetAsyncBulkLookupResponse.md +22 -0
  16. data/docs/GetAsyncBulkLookupResponseData.md +22 -0
  17. data/docs/InProgressLookupStatusEnum.md +15 -0
  18. data/docs/LatestMessageDeliveryStatusEnum.md +15 -0
  19. data/docs/{LookupStatusEnum.md → LineTypeEnum.md} +2 -2
  20. data/docs/LinkSchema.md +22 -0
  21. data/docs/LookupErrorResponse.md +22 -0
  22. data/docs/LookupErrorSchema.md +24 -0
  23. data/docs/LookupErrorSchemaMeta.md +22 -0
  24. data/docs/LookupResult.md +22 -18
  25. data/docs/PhoneNumberLookupApi.md +111 -38
  26. data/docs/RbmActionBase.md +1 -1
  27. data/docs/RbmSuggestionResponse.md +1 -1
  28. data/docs/SyncLookupRequest.md +18 -0
  29. data/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +117 -47
  30. data/lib/bandwidth-sdk/configuration.rb +10 -4
  31. data/lib/bandwidth-sdk/models/async_lookup_request.rb +232 -0
  32. data/lib/bandwidth-sdk/models/completed_lookup_status_enum.rb +41 -0
  33. data/lib/bandwidth-sdk/models/create_async_bulk_lookup_response.rb +235 -0
  34. data/lib/bandwidth-sdk/models/{create_lookup_response.rb → create_async_bulk_lookup_response_data.rb} +5 -5
  35. data/lib/bandwidth-sdk/models/create_sync_lookup_response.rb +234 -0
  36. data/lib/bandwidth-sdk/models/{lookup_status.rb → create_sync_lookup_response_data.rb} +15 -27
  37. data/lib/bandwidth-sdk/models/deactivation_event_enum.rb +39 -0
  38. data/lib/bandwidth-sdk/models/get_async_bulk_lookup_response.rb +234 -0
  39. data/lib/bandwidth-sdk/models/get_async_bulk_lookup_response_data.rb +257 -0
  40. data/lib/bandwidth-sdk/models/{lookup_status_enum.rb → in_progress_lookup_status_enum.rb} +3 -3
  41. data/lib/bandwidth-sdk/models/latest_message_delivery_status_enum.rb +41 -0
  42. data/lib/bandwidth-sdk/models/line_type_enum.rb +42 -0
  43. data/lib/bandwidth-sdk/models/{lookup_request.rb → link_schema.rb} +31 -20
  44. data/lib/bandwidth-sdk/models/lookup_error_response.rb +235 -0
  45. data/lib/bandwidth-sdk/models/lookup_error_schema.rb +242 -0
  46. data/lib/bandwidth-sdk/models/{tn_lookup_request_error.rb → lookup_error_schema_meta.rb} +29 -8
  47. data/lib/bandwidth-sdk/models/lookup_result.rb +102 -63
  48. data/lib/bandwidth-sdk/models/sync_lookup_request.rb +232 -0
  49. data/lib/bandwidth-sdk/version.rb +1 -1
  50. data/lib/bandwidth-sdk.rb +17 -5
  51. data/spec/smoke/multi_channel_api_spec.rb +1 -1
  52. data/spec/smoke/phone_number_lookup_api_spec.rb +65 -70
  53. data/spec/unit/api/phone_number_lookup_api_spec.rb +71 -56
  54. metadata +36 -12
  55. data/docs/LookupStatus.md +0 -24
  56. data/docs/TnLookupRequestError.md +0 -18
@@ -0,0 +1,18 @@
1
+ # Bandwidth::SyncLookupRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **phone_numbers** | **Array<String>** | Telephone numbers in E.164 format. | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'bandwidth-sdk'
13
+
14
+ instance = Bandwidth::SyncLookupRequest.new(
15
+ phone_numbers: null
16
+ )
17
+ ```
18
+
@@ -19,39 +19,37 @@ module Bandwidth
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
- # Create Lookup
23
- # Create a Phone Number Lookup Request.
24
- # @param account_id [String] Your Bandwidth Account ID.
25
- # @param lookup_request [LookupRequest] Phone number lookup request.
22
+ # Create Asynchronous Bulk Number Lookup
23
+ # Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results.
24
+ # @param account_id [String]
25
+ # @param async_lookup_request [AsyncLookupRequest] Asynchronous bulk phone number lookup request.
26
26
  # @param [Hash] opts the optional parameters
27
- # @return [CreateLookupResponse]
28
- def create_lookup(account_id, lookup_request, opts = {})
29
- warn '[DEPRECATION NOTICE] `create_lookup` is deprecated.'
30
- data, _status_code, _headers = create_lookup_with_http_info(account_id, lookup_request, opts)
27
+ # @return [CreateAsyncBulkLookupResponse]
28
+ def create_async_bulk_lookup(account_id, async_lookup_request, opts = {})
29
+ data, _status_code, _headers = create_async_bulk_lookup_with_http_info(account_id, async_lookup_request, opts)
31
30
  data
32
31
  end
33
32
 
34
- # Create Lookup
35
- # Create a Phone Number Lookup Request.
36
- # @param account_id [String] Your Bandwidth Account ID.
37
- # @param lookup_request [LookupRequest] Phone number lookup request.
33
+ # Create Asynchronous Bulk Number Lookup
34
+ # Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results.
35
+ # @param account_id [String]
36
+ # @param async_lookup_request [AsyncLookupRequest] Asynchronous bulk phone number lookup request.
38
37
  # @param [Hash] opts the optional parameters
39
- # @return [Array<(CreateLookupResponse, Integer, Hash)>] CreateLookupResponse data, response status code and response headers
40
- def create_lookup_with_http_info(account_id, lookup_request, opts = {})
41
- warn '[DEPRECATION NOTICE] `create_lookup_with_http_info` is deprecated.'
38
+ # @return [Array<(CreateAsyncBulkLookupResponse, Integer, Hash)>] CreateAsyncBulkLookupResponse data, response status code and response headers
39
+ def create_async_bulk_lookup_with_http_info(account_id, async_lookup_request, opts = {})
42
40
  if @api_client.config.debugging
43
- @api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.create_lookup ...'
41
+ @api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.create_async_bulk_lookup ...'
44
42
  end
45
43
  # verify the required parameter 'account_id' is set
46
44
  if @api_client.config.client_side_validation && account_id.nil?
47
- fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.create_lookup"
45
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.create_async_bulk_lookup"
48
46
  end
49
- # verify the required parameter 'lookup_request' is set
50
- if @api_client.config.client_side_validation && lookup_request.nil?
51
- fail ArgumentError, "Missing the required parameter 'lookup_request' when calling PhoneNumberLookupApi.create_lookup"
47
+ # verify the required parameter 'async_lookup_request' is set
48
+ if @api_client.config.client_side_validation && async_lookup_request.nil?
49
+ fail ArgumentError, "Missing the required parameter 'async_lookup_request' when calling PhoneNumberLookupApi.create_async_bulk_lookup"
52
50
  end
53
51
  # resource path
54
- local_var_path = '/accounts/{accountId}/tnlookup'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
52
+ local_var_path = '/accounts/{accountId}/phoneNumberLookup/bulk'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
55
53
 
56
54
  # query parameters
57
55
  query_params = opts[:query_params] || {}
@@ -70,16 +68,16 @@ module Bandwidth
70
68
  form_params = opts[:form_params] || {}
71
69
 
72
70
  # http body (model)
73
- post_body = opts[:debug_body] || @api_client.object_to_http_body(lookup_request)
71
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(async_lookup_request)
74
72
 
75
73
  # return_type
76
- return_type = opts[:debug_return_type] || 'CreateLookupResponse'
74
+ return_type = opts[:debug_return_type] || 'CreateAsyncBulkLookupResponse'
77
75
 
78
76
  # auth_names
79
77
  auth_names = opts[:debug_auth_names] || ['Basic']
80
78
 
81
79
  new_options = opts.merge(
82
- :operation => :"PhoneNumberLookupApi.create_lookup",
80
+ :operation => :"PhoneNumberLookupApi.create_async_bulk_lookup",
83
81
  :header_params => header_params,
84
82
  :query_params => query_params,
85
83
  :form_params => form_params,
@@ -90,44 +88,116 @@ module Bandwidth
90
88
 
91
89
  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
92
90
  if @api_client.config.debugging
93
- @api_client.config.logger.debug "API called: PhoneNumberLookupApi#create_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
91
+ @api_client.config.logger.debug "API called: PhoneNumberLookupApi#create_async_bulk_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
94
92
  end
95
93
  return data, status_code, headers
96
94
  end
97
95
 
98
- # Get Lookup Request Status
99
- # Get an existing Phone Number Lookup Request.
100
- # @param account_id [String] Your Bandwidth Account ID.
101
- # @param request_id [String] The phone number lookup request ID from Bandwidth.
96
+ # Create Synchronous Number Lookup
97
+ # Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request.
98
+ # @param account_id [String]
99
+ # @param sync_lookup_request [SyncLookupRequest] Synchronous phone number lookup request.
102
100
  # @param [Hash] opts the optional parameters
103
- # @return [LookupStatus]
104
- def get_lookup_status(account_id, request_id, opts = {})
105
- warn '[DEPRECATION NOTICE] `get_lookup_status` is deprecated.'
106
- data, _status_code, _headers = get_lookup_status_with_http_info(account_id, request_id, opts)
101
+ # @return [CreateSyncLookupResponse]
102
+ def create_sync_lookup(account_id, sync_lookup_request, opts = {})
103
+ data, _status_code, _headers = create_sync_lookup_with_http_info(account_id, sync_lookup_request, opts)
107
104
  data
108
105
  end
109
106
 
110
- # Get Lookup Request Status
111
- # Get an existing Phone Number Lookup Request.
112
- # @param account_id [String] Your Bandwidth Account ID.
113
- # @param request_id [String] The phone number lookup request ID from Bandwidth.
107
+ # Create Synchronous Number Lookup
108
+ # Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request.
109
+ # @param account_id [String]
110
+ # @param sync_lookup_request [SyncLookupRequest] Synchronous phone number lookup request.
114
111
  # @param [Hash] opts the optional parameters
115
- # @return [Array<(LookupStatus, Integer, Hash)>] LookupStatus data, response status code and response headers
116
- def get_lookup_status_with_http_info(account_id, request_id, opts = {})
117
- warn '[DEPRECATION NOTICE] `get_lookup_status_with_http_info` is deprecated.'
112
+ # @return [Array<(CreateSyncLookupResponse, Integer, Hash)>] CreateSyncLookupResponse data, response status code and response headers
113
+ def create_sync_lookup_with_http_info(account_id, sync_lookup_request, opts = {})
118
114
  if @api_client.config.debugging
119
- @api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.get_lookup_status ...'
115
+ @api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.create_sync_lookup ...'
120
116
  end
121
117
  # verify the required parameter 'account_id' is set
122
118
  if @api_client.config.client_side_validation && account_id.nil?
123
- fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.get_lookup_status"
119
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.create_sync_lookup"
120
+ end
121
+ # verify the required parameter 'sync_lookup_request' is set
122
+ if @api_client.config.client_side_validation && sync_lookup_request.nil?
123
+ fail ArgumentError, "Missing the required parameter 'sync_lookup_request' when calling PhoneNumberLookupApi.create_sync_lookup"
124
+ end
125
+ # resource path
126
+ local_var_path = '/accounts/{accountId}/phoneNumberLookup'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
127
+
128
+ # query parameters
129
+ query_params = opts[:query_params] || {}
130
+
131
+ # header parameters
132
+ header_params = opts[:header_params] || {}
133
+ # HTTP header 'Accept' (if needed)
134
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
135
+ # HTTP header 'Content-Type'
136
+ content_type = @api_client.select_header_content_type(['application/json'])
137
+ if !content_type.nil?
138
+ header_params['Content-Type'] = content_type
139
+ end
140
+
141
+ # form parameters
142
+ form_params = opts[:form_params] || {}
143
+
144
+ # http body (model)
145
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(sync_lookup_request)
146
+
147
+ # return_type
148
+ return_type = opts[:debug_return_type] || 'CreateSyncLookupResponse'
149
+
150
+ # auth_names
151
+ auth_names = opts[:debug_auth_names] || ['Basic']
152
+
153
+ new_options = opts.merge(
154
+ :operation => :"PhoneNumberLookupApi.create_sync_lookup",
155
+ :header_params => header_params,
156
+ :query_params => query_params,
157
+ :form_params => form_params,
158
+ :body => post_body,
159
+ :auth_names => auth_names,
160
+ :return_type => return_type
161
+ )
162
+
163
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
164
+ if @api_client.config.debugging
165
+ @api_client.config.logger.debug "API called: PhoneNumberLookupApi#create_sync_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
166
+ end
167
+ return data, status_code, headers
168
+ end
169
+
170
+ # Get Asynchronous Bulk Number Lookup
171
+ # Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results.
172
+ # @param account_id [String]
173
+ # @param request_id [String]
174
+ # @param [Hash] opts the optional parameters
175
+ # @return [GetAsyncBulkLookupResponse]
176
+ def get_async_bulk_lookup(account_id, request_id, opts = {})
177
+ data, _status_code, _headers = get_async_bulk_lookup_with_http_info(account_id, request_id, opts)
178
+ data
179
+ end
180
+
181
+ # Get Asynchronous Bulk Number Lookup
182
+ # Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results.
183
+ # @param account_id [String]
184
+ # @param request_id [String]
185
+ # @param [Hash] opts the optional parameters
186
+ # @return [Array<(GetAsyncBulkLookupResponse, Integer, Hash)>] GetAsyncBulkLookupResponse data, response status code and response headers
187
+ def get_async_bulk_lookup_with_http_info(account_id, request_id, opts = {})
188
+ if @api_client.config.debugging
189
+ @api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.get_async_bulk_lookup ...'
190
+ end
191
+ # verify the required parameter 'account_id' is set
192
+ if @api_client.config.client_side_validation && account_id.nil?
193
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.get_async_bulk_lookup"
124
194
  end
125
195
  # verify the required parameter 'request_id' is set
126
196
  if @api_client.config.client_side_validation && request_id.nil?
127
- fail ArgumentError, "Missing the required parameter 'request_id' when calling PhoneNumberLookupApi.get_lookup_status"
197
+ fail ArgumentError, "Missing the required parameter 'request_id' when calling PhoneNumberLookupApi.get_async_bulk_lookup"
128
198
  end
129
199
  # resource path
130
- local_var_path = '/accounts/{accountId}/tnlookup/{requestId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'requestId' + '}', CGI.escape(request_id.to_s))
200
+ local_var_path = '/accounts/{accountId}/phoneNumberLookup/bulk/{requestId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'requestId' + '}', CGI.escape(request_id.to_s))
131
201
 
132
202
  # query parameters
133
203
  query_params = opts[:query_params] || {}
@@ -144,13 +214,13 @@ module Bandwidth
144
214
  post_body = opts[:debug_body]
145
215
 
146
216
  # return_type
147
- return_type = opts[:debug_return_type] || 'LookupStatus'
217
+ return_type = opts[:debug_return_type] || 'GetAsyncBulkLookupResponse'
148
218
 
149
219
  # auth_names
150
220
  auth_names = opts[:debug_auth_names] || ['Basic']
151
221
 
152
222
  new_options = opts.merge(
153
- :operation => :"PhoneNumberLookupApi.get_lookup_status",
223
+ :operation => :"PhoneNumberLookupApi.get_async_bulk_lookup",
154
224
  :header_params => header_params,
155
225
  :query_params => query_params,
156
226
  :form_params => form_params,
@@ -161,7 +231,7 @@ module Bandwidth
161
231
 
162
232
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
163
233
  if @api_client.config.debugging
164
- @api_client.config.logger.debug "API called: PhoneNumberLookupApi#get_lookup_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
234
+ @api_client.config.logger.debug "API called: PhoneNumberLookupApi#get_async_bulk_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
165
235
  end
166
236
  return data, status_code, headers
167
237
  end
@@ -414,15 +414,21 @@ module Bandwidth
414
414
  description: "Production",
415
415
  }
416
416
  ],
417
- "PhoneNumberLookupApi.create_lookup": [
417
+ "PhoneNumberLookupApi.create_async_bulk_lookup": [
418
418
  {
419
- url: "https://numbers.bandwidth.com/api/v1",
419
+ url: "https://api.bandwidth.com/v2",
420
420
  description: "Production",
421
421
  }
422
422
  ],
423
- "PhoneNumberLookupApi.get_lookup_status": [
423
+ "PhoneNumberLookupApi.create_sync_lookup": [
424
424
  {
425
- url: "https://numbers.bandwidth.com/api/v1",
425
+ url: "https://api.bandwidth.com/v2",
426
+ description: "Production",
427
+ }
428
+ ],
429
+ "PhoneNumberLookupApi.get_async_bulk_lookup": [
430
+ {
431
+ url: "https://api.bandwidth.com/v2",
426
432
  description: "Production",
427
433
  }
428
434
  ],
@@ -0,0 +1,232 @@
1
+ =begin
2
+ #Bandwidth
3
+
4
+ #Bandwidth's Communication APIs
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: letstalk@bandwidth.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ class AsyncLookupRequest
18
+ # Telephone numbers in E.164 format.
19
+ attr_accessor :phone_numbers
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'phone_numbers' => :'phoneNumbers'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'phone_numbers' => :'Array<String>'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::AsyncLookupRequest` initialize method'
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ 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
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'phone_numbers')
62
+ if (value = attributes[:'phone_numbers']).is_a?(Array)
63
+ self.phone_numbers = value
64
+ end
65
+ else
66
+ self.phone_numbers = nil
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
74
+ invalid_properties = Array.new
75
+ if @phone_numbers.nil?
76
+ invalid_properties.push('invalid value for "phone_numbers", phone_numbers cannot be nil.')
77
+ end
78
+
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ warn '[DEPRECATED] the `valid?` method is obsolete'
86
+ return false if @phone_numbers.nil?
87
+ true
88
+ end
89
+
90
+ # Custom attribute writer method with validation
91
+ # @param [Object] phone_numbers Value to be assigned
92
+ def phone_numbers=(phone_numbers)
93
+ if phone_numbers.nil?
94
+ fail ArgumentError, 'phone_numbers cannot be nil'
95
+ end
96
+
97
+ @phone_numbers = phone_numbers
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ phone_numbers == o.phone_numbers
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [phone_numbers].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ attributes = attributes.transform_keys(&:to_sym)
126
+ transformed_hash = {}
127
+ openapi_types.each_pair do |key, type|
128
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
129
+ transformed_hash["#{key}"] = nil
130
+ elsif type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[attribute_map[key]].is_a?(Array)
134
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
135
+ end
136
+ elsif !attributes[attribute_map[key]].nil?
137
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
138
+ end
139
+ end
140
+ new(transformed_hash)
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def self._deserialize(type, value)
148
+ case type.to_sym
149
+ when :Time
150
+ Time.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ # models (e.g. Pet) or oneOf
181
+ klass = Bandwidth.const_get(type)
182
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+ end
232
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #Bandwidth
3
+
4
+ #Bandwidth's Communication APIs
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: letstalk@bandwidth.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ class CompletedLookupStatusEnum
18
+ COMPLETE = 'COMPLETE'.freeze
19
+ PARTIAL_COMPLETE = 'PARTIAL_COMPLETE'.freeze
20
+ FAILED = 'FAILED'.freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [COMPLETE, PARTIAL_COMPLETE, FAILED].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if CompletedLookupStatusEnum.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #CompletedLookupStatusEnum"
39
+ end
40
+ end
41
+ end