bandwidth-sdk 14.0.0 → 14.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -9
- data/README.md +42 -10
- data/bandwidth.yml +1102 -0
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +1204 -231
- data/coverage/index.html +20499 -10053
- data/custom_templates/README.mustache +6 -6
- data/docs/AdditionalDenialReason.md +22 -0
- data/docs/Address.md +30 -0
- data/docs/Contact.md +24 -0
- data/docs/Error.md +22 -0
- data/docs/FailureWebhook.md +28 -0
- data/docs/LinksObject.md +24 -0
- data/docs/OptInWorkflow.md +20 -0
- data/docs/TelephoneNumber.md +18 -0
- data/docs/TfvBasicAuthentication.md +20 -0
- data/docs/TfvCallbackStatusEnum.md +15 -0
- data/docs/TfvError.md +22 -0
- data/docs/TfvStatus.md +32 -0
- data/docs/TfvStatusEnum.md +15 -0
- data/docs/TfvSubmissionInfo.md +34 -0
- data/docs/TfvSubmissionWrapper.md +18 -0
- data/docs/TollFreeVerificationApi.md +585 -0
- data/docs/VerificationDenialWebhook.md +32 -0
- data/docs/VerificationRequest.md +36 -0
- data/docs/VerificationUpdateRequest.md +34 -0
- data/docs/VerificationWebhook.md +24 -0
- data/docs/WebhookSubscription.md +30 -0
- data/docs/WebhookSubscriptionBasicAuthentication.md +20 -0
- data/docs/WebhookSubscriptionRequestSchema.md +22 -0
- data/docs/WebhookSubscriptionTypeEnum.md +15 -0
- data/docs/WebhookSubscriptionsListBody.md +22 -0
- data/lib/bandwidth-sdk/api/toll_free_verification_api.rb +614 -0
- data/lib/bandwidth-sdk/configuration.rb +48 -0
- data/lib/bandwidth-sdk/models/additional_denial_reason.rb +254 -0
- data/lib/bandwidth-sdk/models/address.rb +501 -0
- data/lib/bandwidth-sdk/models/contact.rb +393 -0
- data/lib/bandwidth-sdk/models/error.rb +232 -0
- data/lib/bandwidth-sdk/models/failure_webhook.rb +304 -0
- data/lib/bandwidth-sdk/models/links_object.rb +243 -0
- data/lib/bandwidth-sdk/models/opt_in_workflow.rb +265 -0
- data/lib/bandwidth-sdk/models/telephone_number.rb +213 -0
- data/lib/bandwidth-sdk/models/tfv_basic_authentication.rb +273 -0
- data/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/tfv_error.rb +232 -0
- data/lib/bandwidth-sdk/models/tfv_status.rb +342 -0
- data/lib/bandwidth-sdk/models/tfv_status_enum.rb +43 -0
- data/lib/bandwidth-sdk/models/tfv_submission_info.rb +452 -0
- data/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb +212 -0
- data/lib/bandwidth-sdk/models/verification_denial_webhook.rb +325 -0
- data/lib/bandwidth-sdk/models/verification_request.rb +547 -0
- data/lib/bandwidth-sdk/models/verification_update_request.rb +501 -0
- data/lib/bandwidth-sdk/models/verification_webhook.rb +303 -0
- data/lib/bandwidth-sdk/models/webhook_subscription.rb +328 -0
- data/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb +274 -0
- data/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb +306 -0
- data/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb +242 -0
- data/lib/bandwidth-sdk/version.rb +1 -1
- data/lib/bandwidth-sdk.rb +25 -0
- data/openapi-config.yml +1 -1
- data/spec/call_utils.rb +2 -2
- data/spec/smoke/toll_free_verification_api_spec.rb +69 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/api/mfa_api_spec.rb +1 -1
- data/spec/unit/api/toll_free_verification_api_spec.rb +278 -0
- data/spec/unit/client/api_client_spec.rb +1 -1
- metadata +100 -46
@@ -0,0 +1,501 @@
|
|
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 Address
|
18
|
+
# The name of the business using the toll-free number.
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# The address of the business using the toll-free number.
|
22
|
+
attr_accessor :addr1
|
23
|
+
|
24
|
+
# The address of the business using the toll-free number.
|
25
|
+
attr_accessor :addr2
|
26
|
+
|
27
|
+
# The city of the business using the toll-free number.
|
28
|
+
attr_accessor :city
|
29
|
+
|
30
|
+
# The state of the business using the toll-free number.
|
31
|
+
attr_accessor :state
|
32
|
+
|
33
|
+
# The zip of the business using the toll-free number.
|
34
|
+
attr_accessor :zip
|
35
|
+
|
36
|
+
# The website of the business using the toll-free number.
|
37
|
+
attr_accessor :url
|
38
|
+
|
39
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
40
|
+
def self.attribute_map
|
41
|
+
{
|
42
|
+
:'name' => :'name',
|
43
|
+
:'addr1' => :'addr1',
|
44
|
+
:'addr2' => :'addr2',
|
45
|
+
:'city' => :'city',
|
46
|
+
:'state' => :'state',
|
47
|
+
:'zip' => :'zip',
|
48
|
+
:'url' => :'url'
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# Returns all the JSON keys this model knows about
|
53
|
+
def self.acceptable_attributes
|
54
|
+
attribute_map.values
|
55
|
+
end
|
56
|
+
|
57
|
+
# Attribute type mapping.
|
58
|
+
def self.openapi_types
|
59
|
+
{
|
60
|
+
:'name' => :'String',
|
61
|
+
:'addr1' => :'String',
|
62
|
+
:'addr2' => :'String',
|
63
|
+
:'city' => :'String',
|
64
|
+
:'state' => :'String',
|
65
|
+
:'zip' => :'String',
|
66
|
+
:'url' => :'String'
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
# List of attributes with nullable: true
|
71
|
+
def self.openapi_nullable
|
72
|
+
Set.new([
|
73
|
+
:'addr2',
|
74
|
+
])
|
75
|
+
end
|
76
|
+
|
77
|
+
# Initializes the object
|
78
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
79
|
+
def initialize(attributes = {})
|
80
|
+
if (!attributes.is_a?(Hash))
|
81
|
+
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::Address` initialize method'
|
82
|
+
end
|
83
|
+
|
84
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
85
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
86
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
87
|
+
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
|
88
|
+
end
|
89
|
+
h[k.to_sym] = v
|
90
|
+
}
|
91
|
+
|
92
|
+
if attributes.key?(:'name')
|
93
|
+
self.name = attributes[:'name']
|
94
|
+
else
|
95
|
+
self.name = nil
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.key?(:'addr1')
|
99
|
+
self.addr1 = attributes[:'addr1']
|
100
|
+
else
|
101
|
+
self.addr1 = nil
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'addr2')
|
105
|
+
self.addr2 = attributes[:'addr2']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.key?(:'city')
|
109
|
+
self.city = attributes[:'city']
|
110
|
+
else
|
111
|
+
self.city = nil
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'state')
|
115
|
+
self.state = attributes[:'state']
|
116
|
+
else
|
117
|
+
self.state = nil
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:'zip')
|
121
|
+
self.zip = attributes[:'zip']
|
122
|
+
else
|
123
|
+
self.zip = nil
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'url')
|
127
|
+
self.url = attributes[:'url']
|
128
|
+
else
|
129
|
+
self.url = nil
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
134
|
+
# @return Array for valid properties with the reasons
|
135
|
+
def list_invalid_properties
|
136
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
137
|
+
invalid_properties = Array.new
|
138
|
+
if @name.nil?
|
139
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
140
|
+
end
|
141
|
+
|
142
|
+
if @name.to_s.length > 500
|
143
|
+
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 500.')
|
144
|
+
end
|
145
|
+
|
146
|
+
if @name.to_s.length < 1
|
147
|
+
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
148
|
+
end
|
149
|
+
|
150
|
+
if @addr1.nil?
|
151
|
+
invalid_properties.push('invalid value for "addr1", addr1 cannot be nil.')
|
152
|
+
end
|
153
|
+
|
154
|
+
if @addr1.to_s.length > 500
|
155
|
+
invalid_properties.push('invalid value for "addr1", the character length must be smaller than or equal to 500.')
|
156
|
+
end
|
157
|
+
|
158
|
+
if @addr1.to_s.length < 1
|
159
|
+
invalid_properties.push('invalid value for "addr1", the character length must be great than or equal to 1.')
|
160
|
+
end
|
161
|
+
|
162
|
+
if !@addr2.nil? && @addr2.to_s.length > 500
|
163
|
+
invalid_properties.push('invalid value for "addr2", the character length must be smaller than or equal to 500.')
|
164
|
+
end
|
165
|
+
|
166
|
+
if !@addr2.nil? && @addr2.to_s.length < 0
|
167
|
+
invalid_properties.push('invalid value for "addr2", the character length must be great than or equal to 0.')
|
168
|
+
end
|
169
|
+
|
170
|
+
if @city.nil?
|
171
|
+
invalid_properties.push('invalid value for "city", city cannot be nil.')
|
172
|
+
end
|
173
|
+
|
174
|
+
if @city.to_s.length > 500
|
175
|
+
invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 500.')
|
176
|
+
end
|
177
|
+
|
178
|
+
if @city.to_s.length < 1
|
179
|
+
invalid_properties.push('invalid value for "city", the character length must be great than or equal to 1.')
|
180
|
+
end
|
181
|
+
|
182
|
+
if @state.nil?
|
183
|
+
invalid_properties.push('invalid value for "state", state cannot be nil.')
|
184
|
+
end
|
185
|
+
|
186
|
+
if @state.to_s.length > 500
|
187
|
+
invalid_properties.push('invalid value for "state", the character length must be smaller than or equal to 500.')
|
188
|
+
end
|
189
|
+
|
190
|
+
if @state.to_s.length < 1
|
191
|
+
invalid_properties.push('invalid value for "state", the character length must be great than or equal to 1.')
|
192
|
+
end
|
193
|
+
|
194
|
+
if @zip.nil?
|
195
|
+
invalid_properties.push('invalid value for "zip", zip cannot be nil.')
|
196
|
+
end
|
197
|
+
|
198
|
+
pattern = Regexp.new(/[- A-Za-z0-9]{0,500}/)
|
199
|
+
if @zip !~ pattern
|
200
|
+
invalid_properties.push("invalid value for \"zip\", must conform to the pattern #{pattern}.")
|
201
|
+
end
|
202
|
+
|
203
|
+
if @url.nil?
|
204
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
205
|
+
end
|
206
|
+
|
207
|
+
if @url.to_s.length > 500
|
208
|
+
invalid_properties.push('invalid value for "url", the character length must be smaller than or equal to 500.')
|
209
|
+
end
|
210
|
+
|
211
|
+
if @url.to_s.length < 1
|
212
|
+
invalid_properties.push('invalid value for "url", the character length must be great than or equal to 1.')
|
213
|
+
end
|
214
|
+
|
215
|
+
invalid_properties
|
216
|
+
end
|
217
|
+
|
218
|
+
# Check to see if the all the properties in the model are valid
|
219
|
+
# @return true if the model is valid
|
220
|
+
def valid?
|
221
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
222
|
+
return false if @name.nil?
|
223
|
+
return false if @name.to_s.length > 500
|
224
|
+
return false if @name.to_s.length < 1
|
225
|
+
return false if @addr1.nil?
|
226
|
+
return false if @addr1.to_s.length > 500
|
227
|
+
return false if @addr1.to_s.length < 1
|
228
|
+
return false if !@addr2.nil? && @addr2.to_s.length > 500
|
229
|
+
return false if !@addr2.nil? && @addr2.to_s.length < 0
|
230
|
+
return false if @city.nil?
|
231
|
+
return false if @city.to_s.length > 500
|
232
|
+
return false if @city.to_s.length < 1
|
233
|
+
return false if @state.nil?
|
234
|
+
return false if @state.to_s.length > 500
|
235
|
+
return false if @state.to_s.length < 1
|
236
|
+
return false if @zip.nil?
|
237
|
+
return false if @zip !~ Regexp.new(/[- A-Za-z0-9]{0,500}/)
|
238
|
+
return false if @url.nil?
|
239
|
+
return false if @url.to_s.length > 500
|
240
|
+
return false if @url.to_s.length < 1
|
241
|
+
true
|
242
|
+
end
|
243
|
+
|
244
|
+
# Custom attribute writer method with validation
|
245
|
+
# @param [Object] name Value to be assigned
|
246
|
+
def name=(name)
|
247
|
+
if name.nil?
|
248
|
+
fail ArgumentError, 'name cannot be nil'
|
249
|
+
end
|
250
|
+
|
251
|
+
if name.to_s.length > 500
|
252
|
+
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 500.'
|
253
|
+
end
|
254
|
+
|
255
|
+
if name.to_s.length < 1
|
256
|
+
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
257
|
+
end
|
258
|
+
|
259
|
+
@name = name
|
260
|
+
end
|
261
|
+
|
262
|
+
# Custom attribute writer method with validation
|
263
|
+
# @param [Object] addr1 Value to be assigned
|
264
|
+
def addr1=(addr1)
|
265
|
+
if addr1.nil?
|
266
|
+
fail ArgumentError, 'addr1 cannot be nil'
|
267
|
+
end
|
268
|
+
|
269
|
+
if addr1.to_s.length > 500
|
270
|
+
fail ArgumentError, 'invalid value for "addr1", the character length must be smaller than or equal to 500.'
|
271
|
+
end
|
272
|
+
|
273
|
+
if addr1.to_s.length < 1
|
274
|
+
fail ArgumentError, 'invalid value for "addr1", the character length must be great than or equal to 1.'
|
275
|
+
end
|
276
|
+
|
277
|
+
@addr1 = addr1
|
278
|
+
end
|
279
|
+
|
280
|
+
# Custom attribute writer method with validation
|
281
|
+
# @param [Object] addr2 Value to be assigned
|
282
|
+
def addr2=(addr2)
|
283
|
+
if !addr2.nil? && addr2.to_s.length > 500
|
284
|
+
fail ArgumentError, 'invalid value for "addr2", the character length must be smaller than or equal to 500.'
|
285
|
+
end
|
286
|
+
|
287
|
+
if !addr2.nil? && addr2.to_s.length < 0
|
288
|
+
fail ArgumentError, 'invalid value for "addr2", the character length must be great than or equal to 0.'
|
289
|
+
end
|
290
|
+
|
291
|
+
@addr2 = addr2
|
292
|
+
end
|
293
|
+
|
294
|
+
# Custom attribute writer method with validation
|
295
|
+
# @param [Object] city Value to be assigned
|
296
|
+
def city=(city)
|
297
|
+
if city.nil?
|
298
|
+
fail ArgumentError, 'city cannot be nil'
|
299
|
+
end
|
300
|
+
|
301
|
+
if city.to_s.length > 500
|
302
|
+
fail ArgumentError, 'invalid value for "city", the character length must be smaller than or equal to 500.'
|
303
|
+
end
|
304
|
+
|
305
|
+
if city.to_s.length < 1
|
306
|
+
fail ArgumentError, 'invalid value for "city", the character length must be great than or equal to 1.'
|
307
|
+
end
|
308
|
+
|
309
|
+
@city = city
|
310
|
+
end
|
311
|
+
|
312
|
+
# Custom attribute writer method with validation
|
313
|
+
# @param [Object] state Value to be assigned
|
314
|
+
def state=(state)
|
315
|
+
if state.nil?
|
316
|
+
fail ArgumentError, 'state cannot be nil'
|
317
|
+
end
|
318
|
+
|
319
|
+
if state.to_s.length > 500
|
320
|
+
fail ArgumentError, 'invalid value for "state", the character length must be smaller than or equal to 500.'
|
321
|
+
end
|
322
|
+
|
323
|
+
if state.to_s.length < 1
|
324
|
+
fail ArgumentError, 'invalid value for "state", the character length must be great than or equal to 1.'
|
325
|
+
end
|
326
|
+
|
327
|
+
@state = state
|
328
|
+
end
|
329
|
+
|
330
|
+
# Custom attribute writer method with validation
|
331
|
+
# @param [Object] zip Value to be assigned
|
332
|
+
def zip=(zip)
|
333
|
+
if zip.nil?
|
334
|
+
fail ArgumentError, 'zip cannot be nil'
|
335
|
+
end
|
336
|
+
|
337
|
+
pattern = Regexp.new(/[- A-Za-z0-9]{0,500}/)
|
338
|
+
if zip !~ pattern
|
339
|
+
fail ArgumentError, "invalid value for \"zip\", must conform to the pattern #{pattern}."
|
340
|
+
end
|
341
|
+
|
342
|
+
@zip = zip
|
343
|
+
end
|
344
|
+
|
345
|
+
# Custom attribute writer method with validation
|
346
|
+
# @param [Object] url Value to be assigned
|
347
|
+
def url=(url)
|
348
|
+
if url.nil?
|
349
|
+
fail ArgumentError, 'url cannot be nil'
|
350
|
+
end
|
351
|
+
|
352
|
+
if url.to_s.length > 500
|
353
|
+
fail ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 500.'
|
354
|
+
end
|
355
|
+
|
356
|
+
if url.to_s.length < 1
|
357
|
+
fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.'
|
358
|
+
end
|
359
|
+
|
360
|
+
@url = url
|
361
|
+
end
|
362
|
+
|
363
|
+
# Checks equality by comparing each attribute.
|
364
|
+
# @param [Object] Object to be compared
|
365
|
+
def ==(o)
|
366
|
+
return true if self.equal?(o)
|
367
|
+
self.class == o.class &&
|
368
|
+
name == o.name &&
|
369
|
+
addr1 == o.addr1 &&
|
370
|
+
addr2 == o.addr2 &&
|
371
|
+
city == o.city &&
|
372
|
+
state == o.state &&
|
373
|
+
zip == o.zip &&
|
374
|
+
url == o.url
|
375
|
+
end
|
376
|
+
|
377
|
+
# @see the `==` method
|
378
|
+
# @param [Object] Object to be compared
|
379
|
+
def eql?(o)
|
380
|
+
self == o
|
381
|
+
end
|
382
|
+
|
383
|
+
# Calculates hash code according to all attributes.
|
384
|
+
# @return [Integer] Hash code
|
385
|
+
def hash
|
386
|
+
[name, addr1, addr2, city, state, zip, url].hash
|
387
|
+
end
|
388
|
+
|
389
|
+
# Builds the object from hash
|
390
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
391
|
+
# @return [Object] Returns the model itself
|
392
|
+
def self.build_from_hash(attributes)
|
393
|
+
return nil unless attributes.is_a?(Hash)
|
394
|
+
attributes = attributes.transform_keys(&:to_sym)
|
395
|
+
transformed_hash = {}
|
396
|
+
openapi_types.each_pair do |key, type|
|
397
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
398
|
+
transformed_hash["#{key}"] = nil
|
399
|
+
elsif type =~ /\AArray<(.*)>/i
|
400
|
+
# check to ensure the input is an array given that the attribute
|
401
|
+
# is documented as an array but the input is not
|
402
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
403
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
404
|
+
end
|
405
|
+
elsif !attributes[attribute_map[key]].nil?
|
406
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
407
|
+
end
|
408
|
+
end
|
409
|
+
new(transformed_hash)
|
410
|
+
end
|
411
|
+
|
412
|
+
# Deserializes the data based on type
|
413
|
+
# @param string type Data type
|
414
|
+
# @param string value Value to be deserialized
|
415
|
+
# @return [Object] Deserialized data
|
416
|
+
def self._deserialize(type, value)
|
417
|
+
case type.to_sym
|
418
|
+
when :Time
|
419
|
+
Time.parse(value)
|
420
|
+
when :Date
|
421
|
+
Date.parse(value)
|
422
|
+
when :String
|
423
|
+
value.to_s
|
424
|
+
when :Integer
|
425
|
+
value.to_i
|
426
|
+
when :Float
|
427
|
+
value.to_f
|
428
|
+
when :Boolean
|
429
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
430
|
+
true
|
431
|
+
else
|
432
|
+
false
|
433
|
+
end
|
434
|
+
when :Object
|
435
|
+
# generic object (usually a Hash), return directly
|
436
|
+
value
|
437
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
438
|
+
inner_type = Regexp.last_match[:inner_type]
|
439
|
+
value.map { |v| _deserialize(inner_type, v) }
|
440
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
441
|
+
k_type = Regexp.last_match[:k_type]
|
442
|
+
v_type = Regexp.last_match[:v_type]
|
443
|
+
{}.tap do |hash|
|
444
|
+
value.each do |k, v|
|
445
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
446
|
+
end
|
447
|
+
end
|
448
|
+
else # model
|
449
|
+
# models (e.g. Pet) or oneOf
|
450
|
+
klass = Bandwidth.const_get(type)
|
451
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
452
|
+
end
|
453
|
+
end
|
454
|
+
|
455
|
+
# Returns the string representation of the object
|
456
|
+
# @return [String] String presentation of the object
|
457
|
+
def to_s
|
458
|
+
to_hash.to_s
|
459
|
+
end
|
460
|
+
|
461
|
+
# to_body is an alias to to_hash (backward compatibility)
|
462
|
+
# @return [Hash] Returns the object in the form of hash
|
463
|
+
def to_body
|
464
|
+
to_hash
|
465
|
+
end
|
466
|
+
|
467
|
+
# Returns the object in the form of hash
|
468
|
+
# @return [Hash] Returns the object in the form of hash
|
469
|
+
def to_hash
|
470
|
+
hash = {}
|
471
|
+
self.class.attribute_map.each_pair do |attr, param|
|
472
|
+
value = self.send(attr)
|
473
|
+
if value.nil?
|
474
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
475
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
476
|
+
end
|
477
|
+
|
478
|
+
hash[param] = _to_hash(value)
|
479
|
+
end
|
480
|
+
hash
|
481
|
+
end
|
482
|
+
|
483
|
+
# Outputs non-array value in the form of hash
|
484
|
+
# For object, use to_hash. Otherwise, just return the value
|
485
|
+
# @param [Object] value Any valid value
|
486
|
+
# @return [Hash] Returns the value in the form of hash
|
487
|
+
def _to_hash(value)
|
488
|
+
if value.is_a?(Array)
|
489
|
+
value.compact.map { |v| _to_hash(v) }
|
490
|
+
elsif value.is_a?(Hash)
|
491
|
+
{}.tap do |hash|
|
492
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
493
|
+
end
|
494
|
+
elsif value.respond_to? :to_hash
|
495
|
+
value.to_hash
|
496
|
+
else
|
497
|
+
value
|
498
|
+
end
|
499
|
+
end
|
500
|
+
end
|
501
|
+
end
|