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,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 Sending Callback Message Schema
18
- class MessageSendingCallbackMessage
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::MessageSendingCallbackMessage` 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::MessageSendingCallbackMessage`. 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
- end
186
-
187
- if attributes.key?(:'media')
188
- if (value = attributes[:'media']).is_a?(Array)
189
- self.media = value
190
- end
191
- else
192
- self.media = nil
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 @media.nil?
242
- invalid_properties.push('invalid value for "media", media 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 @media.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
@@ -1,214 +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
- OpenAPI Generator version: 7.0.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module Bandwidth
17
- class TranscriptionList
18
- attr_accessor :transcripts
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'transcripts' => :'transcripts'
24
- }
25
- end
26
-
27
- # Returns all the JSON keys this model knows about
28
- def self.acceptable_attributes
29
- attribute_map.values
30
- end
31
-
32
- # Attribute type mapping.
33
- def self.openapi_types
34
- {
35
- :'transcripts' => :'Array<Transcription>'
36
- }
37
- end
38
-
39
- # List of attributes with nullable: true
40
- def self.openapi_nullable
41
- Set.new([
42
- ])
43
- end
44
-
45
- # Initializes the object
46
- # @param [Hash] attributes Model attributes in the form of hash
47
- def initialize(attributes = {})
48
- if (!attributes.is_a?(Hash))
49
- fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TranscriptionList` initialize method'
50
- end
51
-
52
- # check to see if the attribute exists and convert string to symbol for hash key
53
- attributes = attributes.each_with_object({}) { |(k, v), h|
54
- if (!self.class.attribute_map.key?(k.to_sym))
55
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TranscriptionList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
- end
57
- h[k.to_sym] = v
58
- }
59
-
60
- if attributes.key?(:'transcripts')
61
- if (value = attributes[:'transcripts']).is_a?(Array)
62
- self.transcripts = value
63
- end
64
- end
65
- end
66
-
67
- # Show invalid properties with the reasons. Usually used together with valid?
68
- # @return Array for valid properties with the reasons
69
- def list_invalid_properties
70
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
71
- invalid_properties = Array.new
72
- invalid_properties
73
- end
74
-
75
- # Check to see if the all the properties in the model are valid
76
- # @return true if the model is valid
77
- def valid?
78
- warn '[DEPRECATED] the `valid?` method is obsolete'
79
- true
80
- end
81
-
82
- # Checks equality by comparing each attribute.
83
- # @param [Object] Object to be compared
84
- def ==(o)
85
- return true if self.equal?(o)
86
- self.class == o.class &&
87
- transcripts == o.transcripts
88
- end
89
-
90
- # @see the `==` method
91
- # @param [Object] Object to be compared
92
- def eql?(o)
93
- self == o
94
- end
95
-
96
- # Calculates hash code according to all attributes.
97
- # @return [Integer] Hash code
98
- def hash
99
- [transcripts].hash
100
- end
101
-
102
- # Builds the object from hash
103
- # @param [Hash] attributes Model attributes in the form of hash
104
- # @return [Object] Returns the model itself
105
- def self.build_from_hash(attributes)
106
- return nil unless attributes.is_a?(Hash)
107
- attributes = attributes.transform_keys(&:to_sym)
108
- transformed_hash = {}
109
- openapi_types.each_pair do |key, type|
110
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
111
- transformed_hash["#{key}"] = nil
112
- elsif type =~ /\AArray<(.*)>/i
113
- # check to ensure the input is an array given that the attribute
114
- # is documented as an array but the input is not
115
- if attributes[attribute_map[key]].is_a?(Array)
116
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
117
- end
118
- elsif !attributes[attribute_map[key]].nil?
119
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
120
- end
121
- end
122
- new(transformed_hash)
123
- end
124
-
125
- # Deserializes the data based on type
126
- # @param string type Data type
127
- # @param string value Value to be deserialized
128
- # @return [Object] Deserialized data
129
- def self._deserialize(type, value)
130
- case type.to_sym
131
- when :Time
132
- Time.parse(value)
133
- when :Date
134
- Date.parse(value)
135
- when :String
136
- value.to_s
137
- when :Integer
138
- value.to_i
139
- when :Float
140
- value.to_f
141
- when :Boolean
142
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
- true
144
- else
145
- false
146
- end
147
- when :Object
148
- # generic object (usually a Hash), return directly
149
- value
150
- when /\AArray<(?<inner_type>.+)>\z/
151
- inner_type = Regexp.last_match[:inner_type]
152
- value.map { |v| _deserialize(inner_type, v) }
153
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
- k_type = Regexp.last_match[:k_type]
155
- v_type = Regexp.last_match[:v_type]
156
- {}.tap do |hash|
157
- value.each do |k, v|
158
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
- end
160
- end
161
- else # model
162
- # models (e.g. Pet) or oneOf
163
- klass = Bandwidth.const_get(type)
164
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
165
- end
166
- end
167
-
168
- # Returns the string representation of the object
169
- # @return [String] String presentation of the object
170
- def to_s
171
- to_hash.to_s
172
- end
173
-
174
- # to_body is an alias to to_hash (backward compatibility)
175
- # @return [Hash] Returns the object in the form of hash
176
- def to_body
177
- to_hash
178
- end
179
-
180
- # Returns the object in the form of hash
181
- # @return [Hash] Returns the object in the form of hash
182
- def to_hash
183
- hash = {}
184
- self.class.attribute_map.each_pair do |attr, param|
185
- value = self.send(attr)
186
- if value.nil?
187
- is_nullable = self.class.openapi_nullable.include?(attr)
188
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
189
- end
190
-
191
- hash[param] = _to_hash(value)
192
- end
193
- hash
194
- end
195
-
196
- # Outputs non-array value in the form of hash
197
- # For object, use to_hash. Otherwise, just return the value
198
- # @param [Object] value Any valid value
199
- # @return [Hash] Returns the value in the form of hash
200
- def _to_hash(value)
201
- if value.is_a?(Array)
202
- value.compact.map { |v| _to_hash(v) }
203
- elsif value.is_a?(Hash)
204
- {}.tap do |hash|
205
- value.each { |k, v| hash[k] = _to_hash(v) }
206
- end
207
- elsif value.respond_to? :to_hash
208
- value.to_hash
209
- else
210
- value
211
- end
212
- end
213
- end
214
- end