bandwidth-sdk 13.1.4 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,284 +0,0 @@
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
- # Message Delivered Callback
18
- class MessageDeliveredCallback
19
- attr_accessor :time
20
-
21
- attr_accessor :type
22
-
23
- attr_accessor :to
24
-
25
- attr_accessor :description
26
-
27
- attr_accessor :message
28
-
29
- # Attribute mapping from ruby-style variable name to JSON key.
30
- def self.attribute_map
31
- {
32
- :'time' => :'time',
33
- :'type' => :'type',
34
- :'to' => :'to',
35
- :'description' => :'description',
36
- :'message' => :'message'
37
- }
38
- end
39
-
40
- # Returns all the JSON keys this model knows about
41
- def self.acceptable_attributes
42
- attribute_map.values
43
- end
44
-
45
- # Attribute type mapping.
46
- def self.openapi_types
47
- {
48
- :'time' => :'Time',
49
- :'type' => :'String',
50
- :'to' => :'String',
51
- :'description' => :'String',
52
- :'message' => :'MessageDeliveredCallbackMessage'
53
- }
54
- end
55
-
56
- # List of attributes with nullable: true
57
- def self.openapi_nullable
58
- Set.new([
59
- ])
60
- end
61
-
62
- # Initializes the object
63
- # @param [Hash] attributes Model attributes in the form of hash
64
- def initialize(attributes = {})
65
- if (!attributes.is_a?(Hash))
66
- fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MessageDeliveredCallback` initialize method'
67
- end
68
-
69
- # check to see if the attribute exists and convert string to symbol for hash key
70
- attributes = attributes.each_with_object({}) { |(k, v), h|
71
- if (!self.class.attribute_map.key?(k.to_sym))
72
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessageDeliveredCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
- end
74
- h[k.to_sym] = v
75
- }
76
-
77
- if attributes.key?(:'time')
78
- self.time = attributes[:'time']
79
- else
80
- self.time = nil
81
- end
82
-
83
- if attributes.key?(:'type')
84
- self.type = attributes[:'type']
85
- else
86
- self.type = nil
87
- end
88
-
89
- if attributes.key?(:'to')
90
- self.to = attributes[:'to']
91
- else
92
- self.to = nil
93
- end
94
-
95
- if attributes.key?(:'description')
96
- self.description = attributes[:'description']
97
- else
98
- self.description = nil
99
- end
100
-
101
- if attributes.key?(:'message')
102
- self.message = attributes[:'message']
103
- else
104
- self.message = nil
105
- end
106
- end
107
-
108
- # Show invalid properties with the reasons. Usually used together with valid?
109
- # @return Array for valid properties with the reasons
110
- def list_invalid_properties
111
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
- invalid_properties = Array.new
113
- if @time.nil?
114
- invalid_properties.push('invalid value for "time", time cannot be nil.')
115
- end
116
-
117
- if @type.nil?
118
- invalid_properties.push('invalid value for "type", type cannot be nil.')
119
- end
120
-
121
- if @to.nil?
122
- invalid_properties.push('invalid value for "to", to cannot be nil.')
123
- end
124
-
125
- if @description.nil?
126
- invalid_properties.push('invalid value for "description", description cannot be nil.')
127
- end
128
-
129
- if @message.nil?
130
- invalid_properties.push('invalid value for "message", message cannot be nil.')
131
- end
132
-
133
- invalid_properties
134
- end
135
-
136
- # Check to see if the all the properties in the model are valid
137
- # @return true if the model is valid
138
- def valid?
139
- warn '[DEPRECATED] the `valid?` method is obsolete'
140
- return false if @time.nil?
141
- return false if @type.nil?
142
- return false if @to.nil?
143
- return false if @description.nil?
144
- return false if @message.nil?
145
- true
146
- end
147
-
148
- # Checks equality by comparing each attribute.
149
- # @param [Object] Object to be compared
150
- def ==(o)
151
- return true if self.equal?(o)
152
- self.class == o.class &&
153
- time == o.time &&
154
- type == o.type &&
155
- to == o.to &&
156
- description == o.description &&
157
- message == o.message
158
- end
159
-
160
- # @see the `==` method
161
- # @param [Object] Object to be compared
162
- def eql?(o)
163
- self == o
164
- end
165
-
166
- # Calculates hash code according to all attributes.
167
- # @return [Integer] Hash code
168
- def hash
169
- [time, type, to, description, message].hash
170
- end
171
-
172
- # Builds the object from hash
173
- # @param [Hash] attributes Model attributes in the form of hash
174
- # @return [Object] Returns the model itself
175
- def self.build_from_hash(attributes)
176
- return nil unless attributes.is_a?(Hash)
177
- attributes = attributes.transform_keys(&:to_sym)
178
- transformed_hash = {}
179
- openapi_types.each_pair do |key, type|
180
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
181
- transformed_hash["#{key}"] = nil
182
- elsif type =~ /\AArray<(.*)>/i
183
- # check to ensure the input is an array given that the attribute
184
- # is documented as an array but the input is not
185
- if attributes[attribute_map[key]].is_a?(Array)
186
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
187
- end
188
- elsif !attributes[attribute_map[key]].nil?
189
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
190
- end
191
- end
192
- new(transformed_hash)
193
- end
194
-
195
- # Deserializes the data based on type
196
- # @param string type Data type
197
- # @param string value Value to be deserialized
198
- # @return [Object] Deserialized data
199
- def self._deserialize(type, value)
200
- case type.to_sym
201
- when :Time
202
- Time.parse(value)
203
- when :Date
204
- Date.parse(value)
205
- when :String
206
- value.to_s
207
- when :Integer
208
- value.to_i
209
- when :Float
210
- value.to_f
211
- when :Boolean
212
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
213
- true
214
- else
215
- false
216
- end
217
- when :Object
218
- # generic object (usually a Hash), return directly
219
- value
220
- when /\AArray<(?<inner_type>.+)>\z/
221
- inner_type = Regexp.last_match[:inner_type]
222
- value.map { |v| _deserialize(inner_type, v) }
223
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
224
- k_type = Regexp.last_match[:k_type]
225
- v_type = Regexp.last_match[:v_type]
226
- {}.tap do |hash|
227
- value.each do |k, v|
228
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
229
- end
230
- end
231
- else # model
232
- # models (e.g. Pet) or oneOf
233
- klass = Bandwidth.const_get(type)
234
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
235
- end
236
- end
237
-
238
- # Returns the string representation of the object
239
- # @return [String] String presentation of the object
240
- def to_s
241
- to_hash.to_s
242
- end
243
-
244
- # to_body is an alias to to_hash (backward compatibility)
245
- # @return [Hash] Returns the object in the form of hash
246
- def to_body
247
- to_hash
248
- end
249
-
250
- # Returns the object in the form of hash
251
- # @return [Hash] Returns the object in the form of hash
252
- def to_hash
253
- hash = {}
254
- self.class.attribute_map.each_pair do |attr, param|
255
- value = self.send(attr)
256
- if value.nil?
257
- is_nullable = self.class.openapi_nullable.include?(attr)
258
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
259
- end
260
-
261
- hash[param] = _to_hash(value)
262
- end
263
- hash
264
- end
265
-
266
- # Outputs non-array value in the form of hash
267
- # For object, use to_hash. Otherwise, just return the value
268
- # @param [Object] value Any valid value
269
- # @return [Hash] Returns the value in the form of hash
270
- def _to_hash(value)
271
- if value.is_a?(Array)
272
- value.compact.map { |v| _to_hash(v) }
273
- elsif value.is_a?(Hash)
274
- {}.tap do |hash|
275
- value.each { |k, v| hash[k] = _to_hash(v) }
276
- end
277
- elsif value.respond_to? :to_hash
278
- value.to_hash
279
- else
280
- value
281
- end
282
- end
283
- end
284
- end
@@ -1,418 +0,0 @@
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
- # Message Delivered Callback Message Schema
18
- class MessageDeliveredCallbackMessage
19
- attr_accessor :id
20
-
21
- attr_accessor :owner
22
-
23
- attr_accessor :application_id
24
-
25
- attr_accessor :time
26
-
27
- attr_accessor :segment_count
28
-
29
- attr_accessor :direction
30
-
31
- attr_accessor :to
32
-
33
- attr_accessor :from
34
-
35
- attr_accessor :text
36
-
37
- attr_accessor :tag
38
-
39
- attr_accessor :media
40
-
41
- attr_accessor :priority
42
-
43
- class EnumAttributeValidator
44
- attr_reader :datatype
45
- attr_reader :allowable_values
46
-
47
- def initialize(datatype, allowable_values)
48
- @allowable_values = allowable_values.map do |value|
49
- case datatype.to_s
50
- when /Integer/i
51
- value.to_i
52
- when /Float/i
53
- value.to_f
54
- else
55
- value
56
- end
57
- end
58
- end
59
-
60
- def valid?(value)
61
- !value || allowable_values.include?(value)
62
- end
63
- end
64
-
65
- # Attribute mapping from ruby-style variable name to JSON key.
66
- def self.attribute_map
67
- {
68
- :'id' => :'id',
69
- :'owner' => :'owner',
70
- :'application_id' => :'applicationId',
71
- :'time' => :'time',
72
- :'segment_count' => :'segmentCount',
73
- :'direction' => :'direction',
74
- :'to' => :'to',
75
- :'from' => :'from',
76
- :'text' => :'text',
77
- :'tag' => :'tag',
78
- :'media' => :'media',
79
- :'priority' => :'priority'
80
- }
81
- end
82
-
83
- # Returns all the JSON keys this model knows about
84
- def self.acceptable_attributes
85
- attribute_map.values
86
- end
87
-
88
- # Attribute type mapping.
89
- def self.openapi_types
90
- {
91
- :'id' => :'String',
92
- :'owner' => :'String',
93
- :'application_id' => :'String',
94
- :'time' => :'Time',
95
- :'segment_count' => :'Integer',
96
- :'direction' => :'MessageDirectionEnum',
97
- :'to' => :'Array<String>',
98
- :'from' => :'String',
99
- :'text' => :'String',
100
- :'tag' => :'String',
101
- :'media' => :'Array<String>',
102
- :'priority' => :'PriorityEnum'
103
- }
104
- end
105
-
106
- # List of attributes with nullable: true
107
- def self.openapi_nullable
108
- Set.new([
109
- ])
110
- end
111
-
112
- # Initializes the object
113
- # @param [Hash] attributes Model attributes in the form of hash
114
- def initialize(attributes = {})
115
- if (!attributes.is_a?(Hash))
116
- fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MessageDeliveredCallbackMessage` initialize method'
117
- end
118
-
119
- # check to see if the attribute exists and convert string to symbol for hash key
120
- attributes = attributes.each_with_object({}) { |(k, v), h|
121
- if (!self.class.attribute_map.key?(k.to_sym))
122
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessageDeliveredCallbackMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
123
- end
124
- h[k.to_sym] = v
125
- }
126
-
127
- if attributes.key?(:'id')
128
- self.id = attributes[:'id']
129
- else
130
- self.id = nil
131
- end
132
-
133
- if attributes.key?(:'owner')
134
- self.owner = attributes[:'owner']
135
- else
136
- self.owner = nil
137
- end
138
-
139
- if attributes.key?(:'application_id')
140
- self.application_id = attributes[:'application_id']
141
- else
142
- self.application_id = nil
143
- end
144
-
145
- if attributes.key?(:'time')
146
- self.time = attributes[:'time']
147
- else
148
- self.time = nil
149
- end
150
-
151
- if attributes.key?(:'segment_count')
152
- self.segment_count = attributes[:'segment_count']
153
- else
154
- self.segment_count = nil
155
- end
156
-
157
- if attributes.key?(:'direction')
158
- self.direction = attributes[:'direction']
159
- else
160
- self.direction = nil
161
- end
162
-
163
- if attributes.key?(:'to')
164
- if (value = attributes[:'to']).is_a?(Array)
165
- self.to = value
166
- end
167
- else
168
- self.to = nil
169
- end
170
-
171
- if attributes.key?(:'from')
172
- self.from = attributes[:'from']
173
- else
174
- self.from = nil
175
- end
176
-
177
- if attributes.key?(:'text')
178
- self.text = attributes[:'text']
179
- else
180
- self.text = nil
181
- end
182
-
183
- if attributes.key?(:'tag')
184
- self.tag = attributes[:'tag']
185
- else
186
- self.tag = nil
187
- end
188
-
189
- if attributes.key?(:'media')
190
- if (value = attributes[:'media']).is_a?(Array)
191
- self.media = value
192
- end
193
- end
194
-
195
- if attributes.key?(:'priority')
196
- self.priority = attributes[:'priority']
197
- end
198
- end
199
-
200
- # Show invalid properties with the reasons. Usually used together with valid?
201
- # @return Array for valid properties with the reasons
202
- def list_invalid_properties
203
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
204
- invalid_properties = Array.new
205
- if @id.nil?
206
- invalid_properties.push('invalid value for "id", id cannot be nil.')
207
- end
208
-
209
- if @owner.nil?
210
- invalid_properties.push('invalid value for "owner", owner cannot be nil.')
211
- end
212
-
213
- if @application_id.nil?
214
- invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
215
- end
216
-
217
- if @time.nil?
218
- invalid_properties.push('invalid value for "time", time cannot be nil.')
219
- end
220
-
221
- if @segment_count.nil?
222
- invalid_properties.push('invalid value for "segment_count", segment_count cannot be nil.')
223
- end
224
-
225
- if @direction.nil?
226
- invalid_properties.push('invalid value for "direction", direction cannot be nil.')
227
- end
228
-
229
- if @to.nil?
230
- invalid_properties.push('invalid value for "to", to cannot be nil.')
231
- end
232
-
233
- if @from.nil?
234
- invalid_properties.push('invalid value for "from", from cannot be nil.')
235
- end
236
-
237
- if @text.nil?
238
- invalid_properties.push('invalid value for "text", text cannot be nil.')
239
- end
240
-
241
- if @tag.nil?
242
- invalid_properties.push('invalid value for "tag", tag cannot be nil.')
243
- end
244
-
245
- invalid_properties
246
- end
247
-
248
- # Check to see if the all the properties in the model are valid
249
- # @return true if the model is valid
250
- def valid?
251
- warn '[DEPRECATED] the `valid?` method is obsolete'
252
- return false if @id.nil?
253
- return false if @owner.nil?
254
- return false if @application_id.nil?
255
- return false if @time.nil?
256
- return false if @segment_count.nil?
257
- return false if @direction.nil?
258
- return false if @to.nil?
259
- return false if @from.nil?
260
- return false if @text.nil?
261
- return false if @tag.nil?
262
- true
263
- end
264
-
265
- # Custom attribute writer method with validation
266
- # @param [Object] to Value to be assigned
267
- def to=(to)
268
- if to.nil?
269
- fail ArgumentError, 'to cannot be nil'
270
- end
271
-
272
- @to = to
273
- end
274
-
275
- # Checks equality by comparing each attribute.
276
- # @param [Object] Object to be compared
277
- def ==(o)
278
- return true if self.equal?(o)
279
- self.class == o.class &&
280
- id == o.id &&
281
- owner == o.owner &&
282
- application_id == o.application_id &&
283
- time == o.time &&
284
- segment_count == o.segment_count &&
285
- direction == o.direction &&
286
- to == o.to &&
287
- from == o.from &&
288
- text == o.text &&
289
- tag == o.tag &&
290
- media == o.media &&
291
- priority == o.priority
292
- end
293
-
294
- # @see the `==` method
295
- # @param [Object] Object to be compared
296
- def eql?(o)
297
- self == o
298
- end
299
-
300
- # Calculates hash code according to all attributes.
301
- # @return [Integer] Hash code
302
- def hash
303
- [id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority].hash
304
- end
305
-
306
- # Builds the object from hash
307
- # @param [Hash] attributes Model attributes in the form of hash
308
- # @return [Object] Returns the model itself
309
- def self.build_from_hash(attributes)
310
- return nil unless attributes.is_a?(Hash)
311
- attributes = attributes.transform_keys(&:to_sym)
312
- transformed_hash = {}
313
- openapi_types.each_pair do |key, type|
314
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
315
- transformed_hash["#{key}"] = nil
316
- elsif type =~ /\AArray<(.*)>/i
317
- # check to ensure the input is an array given that the attribute
318
- # is documented as an array but the input is not
319
- if attributes[attribute_map[key]].is_a?(Array)
320
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
321
- end
322
- elsif !attributes[attribute_map[key]].nil?
323
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
324
- end
325
- end
326
- new(transformed_hash)
327
- end
328
-
329
- # Deserializes the data based on type
330
- # @param string type Data type
331
- # @param string value Value to be deserialized
332
- # @return [Object] Deserialized data
333
- def self._deserialize(type, value)
334
- case type.to_sym
335
- when :Time
336
- Time.parse(value)
337
- when :Date
338
- Date.parse(value)
339
- when :String
340
- value.to_s
341
- when :Integer
342
- value.to_i
343
- when :Float
344
- value.to_f
345
- when :Boolean
346
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
347
- true
348
- else
349
- false
350
- end
351
- when :Object
352
- # generic object (usually a Hash), return directly
353
- value
354
- when /\AArray<(?<inner_type>.+)>\z/
355
- inner_type = Regexp.last_match[:inner_type]
356
- value.map { |v| _deserialize(inner_type, v) }
357
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
358
- k_type = Regexp.last_match[:k_type]
359
- v_type = Regexp.last_match[:v_type]
360
- {}.tap do |hash|
361
- value.each do |k, v|
362
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
363
- end
364
- end
365
- else # model
366
- # models (e.g. Pet) or oneOf
367
- klass = Bandwidth.const_get(type)
368
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
369
- end
370
- end
371
-
372
- # Returns the string representation of the object
373
- # @return [String] String presentation of the object
374
- def to_s
375
- to_hash.to_s
376
- end
377
-
378
- # to_body is an alias to to_hash (backward compatibility)
379
- # @return [Hash] Returns the object in the form of hash
380
- def to_body
381
- to_hash
382
- end
383
-
384
- # Returns the object in the form of hash
385
- # @return [Hash] Returns the object in the form of hash
386
- def to_hash
387
- hash = {}
388
- self.class.attribute_map.each_pair do |attr, param|
389
- value = self.send(attr)
390
- if value.nil?
391
- is_nullable = self.class.openapi_nullable.include?(attr)
392
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
393
- end
394
-
395
- hash[param] = _to_hash(value)
396
- end
397
- hash
398
- end
399
-
400
- # Outputs non-array value in the form of hash
401
- # For object, use to_hash. Otherwise, just return the value
402
- # @param [Object] value Any valid value
403
- # @return [Hash] Returns the value in the form of hash
404
- def _to_hash(value)
405
- if value.is_a?(Array)
406
- value.compact.map { |v| _to_hash(v) }
407
- elsif value.is_a?(Hash)
408
- {}.tap do |hash|
409
- value.each { |k, v| hash[k] = _to_hash(v) }
410
- end
411
- elsif value.respond_to? :to_hash
412
- value.to_hash
413
- else
414
- value
415
- end
416
- end
417
- end
418
- end