bandwidth-sdk 14.1.3 → 15.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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +10 -10
  3. data/README.md +34 -1
  4. data/bandwidth.yml +640 -58
  5. data/coverage/.last_run.json +1 -1
  6. data/coverage/.resultset.json +210 -6
  7. data/coverage/index.html +14901 -12699
  8. data/docs/CardWidthEnum.md +15 -0
  9. data/docs/CreateMultiChannelMessageResponse.md +22 -0
  10. data/docs/ErrorObject.md +20 -0
  11. data/docs/Link.md +20 -0
  12. data/docs/Message.md +1 -1
  13. data/docs/MessageCallback.md +3 -1
  14. data/docs/MessageRequest.md +1 -1
  15. data/docs/MmsMessageContent.md +20 -0
  16. data/docs/MultiChannelAction.md +89 -0
  17. data/docs/MultiChannelActionCalendarEvent.md +30 -0
  18. data/docs/MultiChannelApi.md +80 -0
  19. data/docs/MultiChannelCallbackData.md +26 -0
  20. data/docs/MultiChannelChannelListObject.md +24 -0
  21. data/docs/MultiChannelChannelListObjectContent.md +55 -0
  22. data/docs/MultiChannelMessageCallbackData.md +32 -0
  23. data/docs/MultiChannelMessageChannelEnum.md +15 -0
  24. data/docs/MultiChannelMessageData.md +34 -0
  25. data/docs/MultiChannelMessageDirectionEnum.md +15 -0
  26. data/docs/MultiChannelMessageRequest.md +26 -0
  27. data/docs/MultiChannelStatusEnum.md +15 -0
  28. data/docs/RbmActionBase.md +22 -0
  29. data/docs/RbmActionDial.md +24 -0
  30. data/docs/RbmActionOpenUrl.md +24 -0
  31. data/docs/RbmActionTypeEnum.md +15 -0
  32. data/docs/RbmActionViewLocation.md +28 -0
  33. data/docs/RbmCardContent.md +24 -0
  34. data/docs/RbmCardContentMedia.md +22 -0
  35. data/docs/RbmMediaHeightEnum.md +15 -0
  36. data/docs/RbmMessageCarouselCard.md +22 -0
  37. data/docs/RbmMessageContentFile.md +20 -0
  38. data/docs/RbmMessageContentRichCard.md +49 -0
  39. data/docs/RbmMessageContentText.md +20 -0
  40. data/docs/RbmMessageMedia.md +20 -0
  41. data/docs/RbmStandaloneCard.md +24 -0
  42. data/docs/SmsMessageContent.md +18 -0
  43. data/docs/StandaloneCardOrientationEnum.md +15 -0
  44. data/docs/TfvStatus.md +5 -1
  45. data/docs/TfvSubmissionInfo.md +8 -2
  46. data/docs/ThumbnailAlignmentEnum.md +15 -0
  47. data/docs/VerificationDenialWebhook.md +5 -1
  48. data/docs/VerificationRequest.md +7 -1
  49. data/docs/VerificationUpdateRequest.md +8 -2
  50. data/lib/bandwidth-sdk/api/multi_channel_api.rb +96 -0
  51. data/lib/bandwidth-sdk/configuration.rb +6 -0
  52. data/lib/bandwidth-sdk/models/bxml/verbs/phone_number.rb +1 -0
  53. data/lib/bandwidth-sdk/models/card_width_enum.rb +40 -0
  54. data/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb +234 -0
  55. data/lib/bandwidth-sdk/models/error_object.rb +221 -0
  56. data/lib/bandwidth-sdk/models/link.rb +221 -0
  57. data/lib/bandwidth-sdk/models/message.rb +1 -1
  58. data/lib/bandwidth-sdk/models/message_callback.rb +16 -5
  59. data/lib/bandwidth-sdk/models/message_request.rb +1 -1
  60. data/lib/bandwidth-sdk/models/mms_message_content.rb +244 -0
  61. data/lib/bandwidth-sdk/models/multi_channel_action.rb +61 -0
  62. data/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb +419 -0
  63. data/lib/bandwidth-sdk/models/multi_channel_callback_data.rb +272 -0
  64. data/lib/bandwidth-sdk/models/multi_channel_channel_list_object.rb +291 -0
  65. data/lib/bandwidth-sdk/models/multi_channel_channel_list_object_content.rb +108 -0
  66. data/lib/bandwidth-sdk/models/multi_channel_message_callback_data.rb +302 -0
  67. data/lib/bandwidth-sdk/models/multi_channel_message_channel_enum.rb +41 -0
  68. data/lib/bandwidth-sdk/models/multi_channel_message_data.rb +312 -0
  69. data/lib/bandwidth-sdk/models/multi_channel_message_direction_enum.rb +40 -0
  70. data/lib/bandwidth-sdk/models/multi_channel_message_request.rb +310 -0
  71. data/lib/bandwidth-sdk/models/multi_channel_status_enum.rb +42 -0
  72. data/lib/bandwidth-sdk/models/rbm_action_base.rb +313 -0
  73. data/lib/bandwidth-sdk/models/rbm_action_dial.rb +337 -0
  74. data/lib/bandwidth-sdk/models/rbm_action_open_url.rb +356 -0
  75. data/lib/bandwidth-sdk/models/rbm_action_type_enum.rb +44 -0
  76. data/lib/bandwidth-sdk/models/rbm_action_view_location.rb +383 -0
  77. data/lib/bandwidth-sdk/models/rbm_card_content.rb +301 -0
  78. data/lib/bandwidth-sdk/models/rbm_card_content_media.rb +313 -0
  79. data/lib/bandwidth-sdk/models/rbm_media_height_enum.rb +41 -0
  80. data/lib/bandwidth-sdk/models/rbm_message_carousel_card.rb +309 -0
  81. data/lib/bandwidth-sdk/models/rbm_message_content_file.rb +268 -0
  82. data/lib/bandwidth-sdk/models/rbm_message_content_rich_card.rb +104 -0
  83. data/lib/bandwidth-sdk/models/rbm_message_content_text.rb +270 -0
  84. data/lib/bandwidth-sdk/models/rbm_message_media.rb +250 -0
  85. data/lib/bandwidth-sdk/models/rbm_standalone_card.rb +304 -0
  86. data/lib/bandwidth-sdk/models/sms_message_content.rb +239 -0
  87. data/lib/bandwidth-sdk/models/standalone_card_orientation_enum.rb +40 -0
  88. data/lib/bandwidth-sdk/models/tfv_status.rb +24 -4
  89. data/lib/bandwidth-sdk/models/tfv_status_enum.rb +1 -3
  90. data/lib/bandwidth-sdk/models/tfv_submission_info.rb +35 -5
  91. data/lib/bandwidth-sdk/models/thumbnail_alignment_enum.rb +40 -0
  92. data/lib/bandwidth-sdk/models/verification_denial_webhook.rb +24 -4
  93. data/lib/bandwidth-sdk/models/verification_request.rb +35 -5
  94. data/lib/bandwidth-sdk/models/verification_update_request.rb +35 -5
  95. data/lib/bandwidth-sdk/version.rb +1 -1
  96. data/lib/bandwidth-sdk.rb +34 -1
  97. data/spec/smoke/conferences_api_spec.rb +4 -4
  98. data/spec/smoke/multi_channel_api_spec.rb +40 -0
  99. data/spec/smoke/transcriptions_api_spec.rb +1 -1
  100. data/spec/unit/api/multi_channel_api_spec.rb +59 -0
  101. data/spec/unit/models/bxml/verbs/phone_number_spec.rb +6 -4
  102. metadata +117 -45
@@ -0,0 +1,419 @@
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 MultiChannelActionCalendarEvent
18
+ attr_accessor :type
19
+
20
+ # Displayed text for user to click
21
+ attr_accessor :text
22
+
23
+ # Base64 payload the customer receives when the reply is clicked.
24
+ attr_accessor :post_back_data
25
+
26
+ # The title of the event.
27
+ attr_accessor :title
28
+
29
+ # The start time of the event.
30
+ attr_accessor :start_time
31
+
32
+ # The end time of the event.
33
+ attr_accessor :end_time
34
+
35
+ # The description of the event.
36
+ attr_accessor :description
37
+
38
+ class EnumAttributeValidator
39
+ attr_reader :datatype
40
+ attr_reader :allowable_values
41
+
42
+ def initialize(datatype, allowable_values)
43
+ @allowable_values = allowable_values.map do |value|
44
+ case datatype.to_s
45
+ when /Integer/i
46
+ value.to_i
47
+ when /Float/i
48
+ value.to_f
49
+ else
50
+ value
51
+ end
52
+ end
53
+ end
54
+
55
+ def valid?(value)
56
+ !value || allowable_values.include?(value)
57
+ end
58
+ end
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'type' => :'type',
64
+ :'text' => :'text',
65
+ :'post_back_data' => :'postBackData',
66
+ :'title' => :'title',
67
+ :'start_time' => :'startTime',
68
+ :'end_time' => :'endTime',
69
+ :'description' => :'description'
70
+ }
71
+ end
72
+
73
+ # Returns all the JSON keys this model knows about
74
+ def self.acceptable_attributes
75
+ attribute_map.values
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'type' => :'RbmActionTypeEnum',
82
+ :'text' => :'String',
83
+ :'post_back_data' => :'String',
84
+ :'title' => :'String',
85
+ :'start_time' => :'Time',
86
+ :'end_time' => :'Time',
87
+ :'description' => :'String'
88
+ }
89
+ end
90
+
91
+ # List of attributes with nullable: true
92
+ def self.openapi_nullable
93
+ Set.new([
94
+ ])
95
+ end
96
+
97
+ # List of class defined in allOf (OpenAPI v3)
98
+ def self.openapi_all_of
99
+ [
100
+ :'RbmActionBase'
101
+ ]
102
+ end
103
+
104
+ # Initializes the object
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ def initialize(attributes = {})
107
+ if (!attributes.is_a?(Hash))
108
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelActionCalendarEvent` initialize method'
109
+ end
110
+
111
+ # check to see if the attribute exists and convert string to symbol for hash key
112
+ attributes = attributes.each_with_object({}) { |(k, v), h|
113
+ if (!self.class.attribute_map.key?(k.to_sym))
114
+ 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
115
+ end
116
+ h[k.to_sym] = v
117
+ }
118
+
119
+ if attributes.key?(:'type')
120
+ self.type = attributes[:'type']
121
+ else
122
+ self.type = nil
123
+ end
124
+
125
+ if attributes.key?(:'text')
126
+ self.text = attributes[:'text']
127
+ else
128
+ self.text = nil
129
+ end
130
+
131
+ if attributes.key?(:'post_back_data')
132
+ self.post_back_data = attributes[:'post_back_data']
133
+ else
134
+ self.post_back_data = nil
135
+ end
136
+
137
+ if attributes.key?(:'title')
138
+ self.title = attributes[:'title']
139
+ else
140
+ self.title = nil
141
+ end
142
+
143
+ if attributes.key?(:'start_time')
144
+ self.start_time = attributes[:'start_time']
145
+ else
146
+ self.start_time = nil
147
+ end
148
+
149
+ if attributes.key?(:'end_time')
150
+ self.end_time = attributes[:'end_time']
151
+ else
152
+ self.end_time = nil
153
+ end
154
+
155
+ if attributes.key?(:'description')
156
+ self.description = attributes[:'description']
157
+ end
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properties with the reasons
162
+ def list_invalid_properties
163
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
164
+ invalid_properties = Array.new
165
+ if @type.nil?
166
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
167
+ end
168
+
169
+ if @text.nil?
170
+ invalid_properties.push('invalid value for "text", text cannot be nil.')
171
+ end
172
+
173
+ if @text.to_s.length > 25
174
+ invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.')
175
+ end
176
+
177
+ if @post_back_data.nil?
178
+ invalid_properties.push('invalid value for "post_back_data", post_back_data cannot be nil.')
179
+ end
180
+
181
+ if @post_back_data.to_s.length > 2048
182
+ invalid_properties.push('invalid value for "post_back_data", the character length must be smaller than or equal to 2048.')
183
+ end
184
+
185
+ if @title.nil?
186
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
187
+ end
188
+
189
+ if @title.to_s.length > 100
190
+ invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 100.')
191
+ end
192
+
193
+ if @start_time.nil?
194
+ invalid_properties.push('invalid value for "start_time", start_time cannot be nil.')
195
+ end
196
+
197
+ if @end_time.nil?
198
+ invalid_properties.push('invalid value for "end_time", end_time cannot be nil.')
199
+ end
200
+
201
+ if !@description.nil? && @description.to_s.length > 500
202
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 500.')
203
+ end
204
+
205
+ invalid_properties
206
+ end
207
+
208
+ # Check to see if the all the properties in the model are valid
209
+ # @return true if the model is valid
210
+ def valid?
211
+ warn '[DEPRECATED] the `valid?` method is obsolete'
212
+ return false if @type.nil?
213
+ return false if @text.nil?
214
+ return false if @text.to_s.length > 25
215
+ return false if @post_back_data.nil?
216
+ return false if @post_back_data.to_s.length > 2048
217
+ return false if @title.nil?
218
+ return false if @title.to_s.length > 100
219
+ return false if @start_time.nil?
220
+ return false if @end_time.nil?
221
+ return false if !@description.nil? && @description.to_s.length > 500
222
+ true
223
+ end
224
+
225
+ # Custom attribute writer method with validation
226
+ # @param [Object] text Value to be assigned
227
+ def text=(text)
228
+ if text.nil?
229
+ fail ArgumentError, 'text cannot be nil'
230
+ end
231
+
232
+ if text.to_s.length > 25
233
+ fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 25.'
234
+ end
235
+
236
+ @text = text
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] post_back_data Value to be assigned
241
+ def post_back_data=(post_back_data)
242
+ if post_back_data.nil?
243
+ fail ArgumentError, 'post_back_data cannot be nil'
244
+ end
245
+
246
+ if post_back_data.to_s.length > 2048
247
+ fail ArgumentError, 'invalid value for "post_back_data", the character length must be smaller than or equal to 2048.'
248
+ end
249
+
250
+ @post_back_data = post_back_data
251
+ end
252
+
253
+ # Custom attribute writer method with validation
254
+ # @param [Object] title Value to be assigned
255
+ def title=(title)
256
+ if title.nil?
257
+ fail ArgumentError, 'title cannot be nil'
258
+ end
259
+
260
+ if title.to_s.length > 100
261
+ fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 100.'
262
+ end
263
+
264
+ @title = title
265
+ end
266
+
267
+ # Custom attribute writer method with validation
268
+ # @param [Object] description Value to be assigned
269
+ def description=(description)
270
+ if description.nil?
271
+ fail ArgumentError, 'description cannot be nil'
272
+ end
273
+
274
+ if description.to_s.length > 500
275
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 500.'
276
+ end
277
+
278
+ @description = description
279
+ end
280
+
281
+ # Checks equality by comparing each attribute.
282
+ # @param [Object] Object to be compared
283
+ def ==(o)
284
+ return true if self.equal?(o)
285
+ self.class == o.class &&
286
+ type == o.type &&
287
+ text == o.text &&
288
+ post_back_data == o.post_back_data &&
289
+ title == o.title &&
290
+ start_time == o.start_time &&
291
+ end_time == o.end_time &&
292
+ description == o.description
293
+ end
294
+
295
+ # @see the `==` method
296
+ # @param [Object] Object to be compared
297
+ def eql?(o)
298
+ self == o
299
+ end
300
+
301
+ # Calculates hash code according to all attributes.
302
+ # @return [Integer] Hash code
303
+ def hash
304
+ [type, text, post_back_data, title, start_time, end_time, description].hash
305
+ end
306
+
307
+ # Builds the object from hash
308
+ # @param [Hash] attributes Model attributes in the form of hash
309
+ # @return [Object] Returns the model itself
310
+ def self.build_from_hash(attributes)
311
+ return nil unless attributes.is_a?(Hash)
312
+ attributes = attributes.transform_keys(&:to_sym)
313
+ transformed_hash = {}
314
+ openapi_types.each_pair do |key, type|
315
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
316
+ transformed_hash["#{key}"] = nil
317
+ elsif type =~ /\AArray<(.*)>/i
318
+ # check to ensure the input is an array given that the attribute
319
+ # is documented as an array but the input is not
320
+ if attributes[attribute_map[key]].is_a?(Array)
321
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
322
+ end
323
+ elsif !attributes[attribute_map[key]].nil?
324
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
325
+ end
326
+ end
327
+ new(transformed_hash)
328
+ end
329
+
330
+ # Deserializes the data based on type
331
+ # @param string type Data type
332
+ # @param string value Value to be deserialized
333
+ # @return [Object] Deserialized data
334
+ def self._deserialize(type, value)
335
+ case type.to_sym
336
+ when :Time
337
+ Time.parse(value)
338
+ when :Date
339
+ Date.parse(value)
340
+ when :String
341
+ value.to_s
342
+ when :Integer
343
+ value.to_i
344
+ when :Float
345
+ value.to_f
346
+ when :Boolean
347
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
348
+ true
349
+ else
350
+ false
351
+ end
352
+ when :Object
353
+ # generic object (usually a Hash), return directly
354
+ value
355
+ when /\AArray<(?<inner_type>.+)>\z/
356
+ inner_type = Regexp.last_match[:inner_type]
357
+ value.map { |v| _deserialize(inner_type, v) }
358
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
359
+ k_type = Regexp.last_match[:k_type]
360
+ v_type = Regexp.last_match[:v_type]
361
+ {}.tap do |hash|
362
+ value.each do |k, v|
363
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
364
+ end
365
+ end
366
+ else # model
367
+ # models (e.g. Pet) or oneOf
368
+ klass = Bandwidth.const_get(type)
369
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
370
+ end
371
+ end
372
+
373
+ # Returns the string representation of the object
374
+ # @return [String] String presentation of the object
375
+ def to_s
376
+ to_hash.to_s
377
+ end
378
+
379
+ # to_body is an alias to to_hash (backward compatibility)
380
+ # @return [Hash] Returns the object in the form of hash
381
+ def to_body
382
+ to_hash
383
+ end
384
+
385
+ # Returns the object in the form of hash
386
+ # @return [Hash] Returns the object in the form of hash
387
+ def to_hash
388
+ hash = {}
389
+ self.class.attribute_map.each_pair do |attr, param|
390
+ value = self.send(attr)
391
+ if value.nil?
392
+ is_nullable = self.class.openapi_nullable.include?(attr)
393
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
394
+ end
395
+
396
+ hash[param] = _to_hash(value)
397
+ end
398
+ hash
399
+ end
400
+
401
+ # Outputs non-array value in the form of hash
402
+ # For object, use to_hash. Otherwise, just return the value
403
+ # @param [Object] value Any valid value
404
+ # @return [Hash] Returns the value in the form of hash
405
+ def _to_hash(value)
406
+ if value.is_a?(Array)
407
+ value.compact.map { |v| _to_hash(v) }
408
+ elsif value.is_a?(Hash)
409
+ {}.tap do |hash|
410
+ value.each { |k, v| hash[k] = _to_hash(v) }
411
+ end
412
+ elsif value.respond_to? :to_hash
413
+ value.to_hash
414
+ else
415
+ value
416
+ end
417
+ end
418
+ end
419
+ end
@@ -0,0 +1,272 @@
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 MultiChannelCallbackData
18
+ # The time of the callback event.
19
+ attr_accessor :time
20
+
21
+ attr_accessor :type
22
+
23
+ # The phone number the message should be sent to in E164 format.
24
+ attr_accessor :to
25
+
26
+ attr_accessor :description
27
+
28
+ attr_accessor :message
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'time' => :'time',
56
+ :'type' => :'type',
57
+ :'to' => :'to',
58
+ :'description' => :'description',
59
+ :'message' => :'message'
60
+ }
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'time' => :'Time',
72
+ :'type' => :'MultiChannelStatusEnum',
73
+ :'to' => :'String',
74
+ :'description' => :'String',
75
+ :'message' => :'MultiChannelMessageCallbackData'
76
+ }
77
+ end
78
+
79
+ # List of attributes with nullable: true
80
+ def self.openapi_nullable
81
+ Set.new([
82
+ ])
83
+ end
84
+
85
+ # Initializes the object
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ def initialize(attributes = {})
88
+ if (!attributes.is_a?(Hash))
89
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelCallbackData` initialize method'
90
+ end
91
+
92
+ # check to see if the attribute exists and convert string to symbol for hash key
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!self.class.attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelCallbackData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'time')
101
+ self.time = attributes[:'time']
102
+ end
103
+
104
+ if attributes.key?(:'type')
105
+ self.type = attributes[:'type']
106
+ end
107
+
108
+ if attributes.key?(:'to')
109
+ self.to = attributes[:'to']
110
+ end
111
+
112
+ if attributes.key?(:'description')
113
+ self.description = attributes[:'description']
114
+ end
115
+
116
+ if attributes.key?(:'message')
117
+ self.message = attributes[:'message']
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
125
+ invalid_properties = Array.new
126
+ invalid_properties
127
+ end
128
+
129
+ # Check to see if the all the properties in the model are valid
130
+ # @return true if the model is valid
131
+ def valid?
132
+ warn '[DEPRECATED] the `valid?` method is obsolete'
133
+ true
134
+ end
135
+
136
+ # Checks equality by comparing each attribute.
137
+ # @param [Object] Object to be compared
138
+ def ==(o)
139
+ return true if self.equal?(o)
140
+ self.class == o.class &&
141
+ time == o.time &&
142
+ type == o.type &&
143
+ to == o.to &&
144
+ description == o.description &&
145
+ message == o.message
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Integer] Hash code
156
+ def hash
157
+ [time, type, to, description, message].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def self.build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ attributes = attributes.transform_keys(&:to_sym)
166
+ transformed_hash = {}
167
+ openapi_types.each_pair do |key, type|
168
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = nil
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[attribute_map[key]].is_a?(Array)
174
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
175
+ end
176
+ elsif !attributes[attribute_map[key]].nil?
177
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
178
+ end
179
+ end
180
+ new(transformed_hash)
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def self._deserialize(type, value)
188
+ case type.to_sym
189
+ when :Time
190
+ Time.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ # models (e.g. Pet) or oneOf
221
+ klass = Bandwidth.const_get(type)
222
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ if value.nil?
245
+ is_nullable = self.class.openapi_nullable.include?(attr)
246
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
247
+ end
248
+
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+ end
272
+ end