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,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 MultiChannelMessageChannelEnum
18
+ RBM = 'RBM'.freeze
19
+ SMS = 'SMS'.freeze
20
+ MMS = 'MMS'.freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [RBM, SMS, MMS].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 MultiChannelMessageChannelEnum.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #MultiChannelMessageChannelEnum"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,312 @@
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 MultiChannelMessageData
18
+ # The ID of the message.
19
+ attr_accessor :message_id
20
+
21
+ attr_accessor :status
22
+
23
+ # The time the message was received by the Bandwidth API.
24
+ attr_accessor :time
25
+
26
+ attr_accessor :direction
27
+
28
+ # The sender ID of the message. This could be an alphanumeric sender ID.
29
+ attr_accessor :from
30
+
31
+ # The phone number the message should be sent to in E164 format.
32
+ attr_accessor :to
33
+
34
+ # The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard.
35
+ attr_accessor :application_id
36
+
37
+ attr_accessor :channel
38
+
39
+ # A custom string that will be included in callback events of the message. Max 1024 characters.
40
+ attr_accessor :tag
41
+
42
+ class EnumAttributeValidator
43
+ attr_reader :datatype
44
+ attr_reader :allowable_values
45
+
46
+ def initialize(datatype, allowable_values)
47
+ @allowable_values = allowable_values.map do |value|
48
+ case datatype.to_s
49
+ when /Integer/i
50
+ value.to_i
51
+ when /Float/i
52
+ value.to_f
53
+ else
54
+ value
55
+ end
56
+ end
57
+ end
58
+
59
+ def valid?(value)
60
+ !value || allowable_values.include?(value)
61
+ end
62
+ end
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'message_id' => :'messageId',
68
+ :'status' => :'status',
69
+ :'time' => :'time',
70
+ :'direction' => :'direction',
71
+ :'from' => :'from',
72
+ :'to' => :'to',
73
+ :'application_id' => :'applicationId',
74
+ :'channel' => :'channel',
75
+ :'tag' => :'tag'
76
+ }
77
+ end
78
+
79
+ # Returns all the JSON keys this model knows about
80
+ def self.acceptable_attributes
81
+ attribute_map.values
82
+ end
83
+
84
+ # Attribute type mapping.
85
+ def self.openapi_types
86
+ {
87
+ :'message_id' => :'String',
88
+ :'status' => :'MultiChannelStatusEnum',
89
+ :'time' => :'Time',
90
+ :'direction' => :'MultiChannelMessageDirectionEnum',
91
+ :'from' => :'String',
92
+ :'to' => :'String',
93
+ :'application_id' => :'String',
94
+ :'channel' => :'MultiChannelMessageChannelEnum',
95
+ :'tag' => :'String'
96
+ }
97
+ end
98
+
99
+ # List of attributes with nullable: true
100
+ def self.openapi_nullable
101
+ Set.new([
102
+ ])
103
+ end
104
+
105
+ # Initializes the object
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ def initialize(attributes = {})
108
+ if (!attributes.is_a?(Hash))
109
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelMessageData` initialize method'
110
+ end
111
+
112
+ # check to see if the attribute exists and convert string to symbol for hash key
113
+ attributes = attributes.each_with_object({}) { |(k, v), h|
114
+ if (!self.class.attribute_map.key?(k.to_sym))
115
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelMessageData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
116
+ end
117
+ h[k.to_sym] = v
118
+ }
119
+
120
+ if attributes.key?(:'message_id')
121
+ self.message_id = attributes[:'message_id']
122
+ end
123
+
124
+ if attributes.key?(:'status')
125
+ self.status = attributes[:'status']
126
+ end
127
+
128
+ if attributes.key?(:'time')
129
+ self.time = attributes[:'time']
130
+ end
131
+
132
+ if attributes.key?(:'direction')
133
+ self.direction = attributes[:'direction']
134
+ end
135
+
136
+ if attributes.key?(:'from')
137
+ self.from = attributes[:'from']
138
+ end
139
+
140
+ if attributes.key?(:'to')
141
+ self.to = attributes[:'to']
142
+ end
143
+
144
+ if attributes.key?(:'application_id')
145
+ self.application_id = attributes[:'application_id']
146
+ end
147
+
148
+ if attributes.key?(:'channel')
149
+ self.channel = attributes[:'channel']
150
+ end
151
+
152
+ if attributes.key?(:'tag')
153
+ self.tag = attributes[:'tag']
154
+ end
155
+ end
156
+
157
+ # Show invalid properties with the reasons. Usually used together with valid?
158
+ # @return Array for valid properties with the reasons
159
+ def list_invalid_properties
160
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
161
+ invalid_properties = Array.new
162
+ invalid_properties
163
+ end
164
+
165
+ # Check to see if the all the properties in the model are valid
166
+ # @return true if the model is valid
167
+ def valid?
168
+ warn '[DEPRECATED] the `valid?` method is obsolete'
169
+ true
170
+ end
171
+
172
+ # Checks equality by comparing each attribute.
173
+ # @param [Object] Object to be compared
174
+ def ==(o)
175
+ return true if self.equal?(o)
176
+ self.class == o.class &&
177
+ message_id == o.message_id &&
178
+ status == o.status &&
179
+ time == o.time &&
180
+ direction == o.direction &&
181
+ from == o.from &&
182
+ to == o.to &&
183
+ application_id == o.application_id &&
184
+ channel == o.channel &&
185
+ tag == o.tag
186
+ end
187
+
188
+ # @see the `==` method
189
+ # @param [Object] Object to be compared
190
+ def eql?(o)
191
+ self == o
192
+ end
193
+
194
+ # Calculates hash code according to all attributes.
195
+ # @return [Integer] Hash code
196
+ def hash
197
+ [message_id, status, time, direction, from, to, application_id, channel, tag].hash
198
+ end
199
+
200
+ # Builds the object from hash
201
+ # @param [Hash] attributes Model attributes in the form of hash
202
+ # @return [Object] Returns the model itself
203
+ def self.build_from_hash(attributes)
204
+ return nil unless attributes.is_a?(Hash)
205
+ attributes = attributes.transform_keys(&:to_sym)
206
+ transformed_hash = {}
207
+ openapi_types.each_pair do |key, type|
208
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
209
+ transformed_hash["#{key}"] = nil
210
+ elsif type =~ /\AArray<(.*)>/i
211
+ # check to ensure the input is an array given that the attribute
212
+ # is documented as an array but the input is not
213
+ if attributes[attribute_map[key]].is_a?(Array)
214
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
215
+ end
216
+ elsif !attributes[attribute_map[key]].nil?
217
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
218
+ end
219
+ end
220
+ new(transformed_hash)
221
+ end
222
+
223
+ # Deserializes the data based on type
224
+ # @param string type Data type
225
+ # @param string value Value to be deserialized
226
+ # @return [Object] Deserialized data
227
+ def self._deserialize(type, value)
228
+ case type.to_sym
229
+ when :Time
230
+ Time.parse(value)
231
+ when :Date
232
+ Date.parse(value)
233
+ when :String
234
+ value.to_s
235
+ when :Integer
236
+ value.to_i
237
+ when :Float
238
+ value.to_f
239
+ when :Boolean
240
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
241
+ true
242
+ else
243
+ false
244
+ end
245
+ when :Object
246
+ # generic object (usually a Hash), return directly
247
+ value
248
+ when /\AArray<(?<inner_type>.+)>\z/
249
+ inner_type = Regexp.last_match[:inner_type]
250
+ value.map { |v| _deserialize(inner_type, v) }
251
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
252
+ k_type = Regexp.last_match[:k_type]
253
+ v_type = Regexp.last_match[:v_type]
254
+ {}.tap do |hash|
255
+ value.each do |k, v|
256
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
257
+ end
258
+ end
259
+ else # model
260
+ # models (e.g. Pet) or oneOf
261
+ klass = Bandwidth.const_get(type)
262
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
263
+ end
264
+ end
265
+
266
+ # Returns the string representation of the object
267
+ # @return [String] String presentation of the object
268
+ def to_s
269
+ to_hash.to_s
270
+ end
271
+
272
+ # to_body is an alias to to_hash (backward compatibility)
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_body
275
+ to_hash
276
+ end
277
+
278
+ # Returns the object in the form of hash
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_hash
281
+ hash = {}
282
+ self.class.attribute_map.each_pair do |attr, param|
283
+ value = self.send(attr)
284
+ if value.nil?
285
+ is_nullable = self.class.openapi_nullable.include?(attr)
286
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
287
+ end
288
+
289
+ hash[param] = _to_hash(value)
290
+ end
291
+ hash
292
+ end
293
+
294
+ # Outputs non-array value in the form of hash
295
+ # For object, use to_hash. Otherwise, just return the value
296
+ # @param [Object] value Any valid value
297
+ # @return [Hash] Returns the value in the form of hash
298
+ def _to_hash(value)
299
+ if value.is_a?(Array)
300
+ value.compact.map { |v| _to_hash(v) }
301
+ elsif value.is_a?(Hash)
302
+ {}.tap do |hash|
303
+ value.each { |k, v| hash[k] = _to_hash(v) }
304
+ end
305
+ elsif value.respond_to? :to_hash
306
+ value.to_hash
307
+ else
308
+ value
309
+ end
310
+ end
311
+ end
312
+ end
@@ -0,0 +1,40 @@
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 MultiChannelMessageDirectionEnum
18
+ INBOUND = 'INBOUND'.freeze
19
+ OUTBOUND = 'OUTBOUND'.freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [INBOUND, OUTBOUND].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if MultiChannelMessageDirectionEnum.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #MultiChannelMessageDirectionEnum"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,310 @@
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
+ # Multi-Channel Message Request
18
+ class MultiChannelMessageRequest
19
+ # The phone number the message should be sent to in E164 format.
20
+ attr_accessor :to
21
+
22
+ # A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored.
23
+ attr_accessor :channel_list
24
+
25
+ # A custom string that will be included in callback events of the message. Max 1024 characters.
26
+ attr_accessor :tag
27
+
28
+ attr_accessor :priority
29
+
30
+ # A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future.
31
+ attr_accessor :expiration
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'to' => :'to',
59
+ :'channel_list' => :'channelList',
60
+ :'tag' => :'tag',
61
+ :'priority' => :'priority',
62
+ :'expiration' => :'expiration'
63
+ }
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'to' => :'String',
75
+ :'channel_list' => :'Array<MultiChannelChannelListObject>',
76
+ :'tag' => :'String',
77
+ :'priority' => :'PriorityEnum',
78
+ :'expiration' => :'Time'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelMessageRequest` initialize method'
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!self.class.attribute_map.key?(k.to_sym))
98
+ 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
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'to')
104
+ self.to = attributes[:'to']
105
+ else
106
+ self.to = nil
107
+ end
108
+
109
+ if attributes.key?(:'channel_list')
110
+ if (value = attributes[:'channel_list']).is_a?(Array)
111
+ self.channel_list = value
112
+ end
113
+ else
114
+ self.channel_list = nil
115
+ end
116
+
117
+ if attributes.key?(:'tag')
118
+ self.tag = attributes[:'tag']
119
+ end
120
+
121
+ if attributes.key?(:'priority')
122
+ self.priority = attributes[:'priority']
123
+ end
124
+
125
+ if attributes.key?(:'expiration')
126
+ self.expiration = attributes[:'expiration']
127
+ end
128
+ end
129
+
130
+ # Show invalid properties with the reasons. Usually used together with valid?
131
+ # @return Array for valid properties with the reasons
132
+ def list_invalid_properties
133
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
134
+ invalid_properties = Array.new
135
+ if @to.nil?
136
+ invalid_properties.push('invalid value for "to", to cannot be nil.')
137
+ end
138
+
139
+ if @channel_list.nil?
140
+ invalid_properties.push('invalid value for "channel_list", channel_list cannot be nil.')
141
+ end
142
+
143
+ if @channel_list.length > 4
144
+ invalid_properties.push('invalid value for "channel_list", number of items must be less than or equal to 4.')
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ warn '[DEPRECATED] the `valid?` method is obsolete'
154
+ return false if @to.nil?
155
+ return false if @channel_list.nil?
156
+ return false if @channel_list.length > 4
157
+ true
158
+ end
159
+
160
+ # Custom attribute writer method with validation
161
+ # @param [Object] channel_list Value to be assigned
162
+ def channel_list=(channel_list)
163
+ if channel_list.nil?
164
+ fail ArgumentError, 'channel_list cannot be nil'
165
+ end
166
+
167
+ if channel_list.length > 4
168
+ fail ArgumentError, 'invalid value for "channel_list", number of items must be less than or equal to 4.'
169
+ end
170
+
171
+ @channel_list = channel_list
172
+ end
173
+
174
+ # Checks equality by comparing each attribute.
175
+ # @param [Object] Object to be compared
176
+ def ==(o)
177
+ return true if self.equal?(o)
178
+ self.class == o.class &&
179
+ to == o.to &&
180
+ channel_list == o.channel_list &&
181
+ tag == o.tag &&
182
+ priority == o.priority &&
183
+ expiration == o.expiration
184
+ end
185
+
186
+ # @see the `==` method
187
+ # @param [Object] Object to be compared
188
+ def eql?(o)
189
+ self == o
190
+ end
191
+
192
+ # Calculates hash code according to all attributes.
193
+ # @return [Integer] Hash code
194
+ def hash
195
+ [to, channel_list, tag, priority, expiration].hash
196
+ end
197
+
198
+ # Builds the object from hash
199
+ # @param [Hash] attributes Model attributes in the form of hash
200
+ # @return [Object] Returns the model itself
201
+ def self.build_from_hash(attributes)
202
+ return nil unless attributes.is_a?(Hash)
203
+ attributes = attributes.transform_keys(&:to_sym)
204
+ transformed_hash = {}
205
+ openapi_types.each_pair do |key, type|
206
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
207
+ transformed_hash["#{key}"] = nil
208
+ elsif type =~ /\AArray<(.*)>/i
209
+ # check to ensure the input is an array given that the attribute
210
+ # is documented as an array but the input is not
211
+ if attributes[attribute_map[key]].is_a?(Array)
212
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
213
+ end
214
+ elsif !attributes[attribute_map[key]].nil?
215
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
216
+ end
217
+ end
218
+ new(transformed_hash)
219
+ end
220
+
221
+ # Deserializes the data based on type
222
+ # @param string type Data type
223
+ # @param string value Value to be deserialized
224
+ # @return [Object] Deserialized data
225
+ def self._deserialize(type, value)
226
+ case type.to_sym
227
+ when :Time
228
+ Time.parse(value)
229
+ when :Date
230
+ Date.parse(value)
231
+ when :String
232
+ value.to_s
233
+ when :Integer
234
+ value.to_i
235
+ when :Float
236
+ value.to_f
237
+ when :Boolean
238
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
239
+ true
240
+ else
241
+ false
242
+ end
243
+ when :Object
244
+ # generic object (usually a Hash), return directly
245
+ value
246
+ when /\AArray<(?<inner_type>.+)>\z/
247
+ inner_type = Regexp.last_match[:inner_type]
248
+ value.map { |v| _deserialize(inner_type, v) }
249
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
250
+ k_type = Regexp.last_match[:k_type]
251
+ v_type = Regexp.last_match[:v_type]
252
+ {}.tap do |hash|
253
+ value.each do |k, v|
254
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
255
+ end
256
+ end
257
+ else # model
258
+ # models (e.g. Pet) or oneOf
259
+ klass = Bandwidth.const_get(type)
260
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
261
+ end
262
+ end
263
+
264
+ # Returns the string representation of the object
265
+ # @return [String] String presentation of the object
266
+ def to_s
267
+ to_hash.to_s
268
+ end
269
+
270
+ # to_body is an alias to to_hash (backward compatibility)
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_body
273
+ to_hash
274
+ end
275
+
276
+ # Returns the object in the form of hash
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_hash
279
+ hash = {}
280
+ self.class.attribute_map.each_pair do |attr, param|
281
+ value = self.send(attr)
282
+ if value.nil?
283
+ is_nullable = self.class.openapi_nullable.include?(attr)
284
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
285
+ end
286
+
287
+ hash[param] = _to_hash(value)
288
+ end
289
+ hash
290
+ end
291
+
292
+ # Outputs non-array value in the form of hash
293
+ # For object, use to_hash. Otherwise, just return the value
294
+ # @param [Object] value Any valid value
295
+ # @return [Hash] Returns the value in the form of hash
296
+ def _to_hash(value)
297
+ if value.is_a?(Array)
298
+ value.compact.map { |v| _to_hash(v) }
299
+ elsif value.is_a?(Hash)
300
+ {}.tap do |hash|
301
+ value.each { |k, v| hash[k] = _to_hash(v) }
302
+ end
303
+ elsif value.respond_to? :to_hash
304
+ value.to_hash
305
+ else
306
+ value
307
+ end
308
+ end
309
+ end
310
+ end