bandwidth-sdk 13.1.4 → 14.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.
@@ -1,405 +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: 6.3.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module Bandwidth
17
- # The Disconnect event is fired when a call ends, for any reason.
18
- class DisconenctCallback
19
- # The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
20
- attr_accessor :event_type
21
-
22
- # The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
23
- attr_accessor :event_time
24
-
25
- # The user account associated with the call.
26
- attr_accessor :account_id
27
-
28
- # The id of the application associated with the call.
29
- attr_accessor :application_id
30
-
31
- # The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous.
32
- attr_accessor :from
33
-
34
- # The phone number that received the call, in E.164 format (e.g. +15555555555).
35
- attr_accessor :to
36
-
37
- # The call id associated with the event.
38
- attr_accessor :call_id
39
-
40
- attr_accessor :direction
41
-
42
- # The URL of the call associated with the event.
43
- attr_accessor :call_url
44
-
45
- # (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
46
- attr_accessor :enqueued_time
47
-
48
- # Time the call was started, in ISO 8601 format.
49
- attr_accessor :start_time
50
-
51
- # Time the call was answered, in ISO 8601 format.
52
- attr_accessor :answer_time
53
-
54
- # The time that the recording ended in ISO-8601 format
55
- attr_accessor :end_time
56
-
57
- # Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown.
58
- attr_accessor :cause
59
-
60
- # Text explaining the reason that caused the call to fail in case of errors.
61
- attr_accessor :error_message
62
-
63
- # Bandwidth's internal id that references the error event.
64
- attr_accessor :error_id
65
-
66
- # (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
67
- attr_accessor :tag
68
-
69
- class EnumAttributeValidator
70
- attr_reader :datatype
71
- attr_reader :allowable_values
72
-
73
- def initialize(datatype, allowable_values)
74
- @allowable_values = allowable_values.map do |value|
75
- case datatype.to_s
76
- when /Integer/i
77
- value.to_i
78
- when /Float/i
79
- value.to_f
80
- else
81
- value
82
- end
83
- end
84
- end
85
-
86
- def valid?(value)
87
- !value || allowable_values.include?(value)
88
- end
89
- end
90
-
91
- # Attribute mapping from ruby-style variable name to JSON key.
92
- def self.attribute_map
93
- {
94
- :'event_type' => :'eventType',
95
- :'event_time' => :'eventTime',
96
- :'account_id' => :'accountId',
97
- :'application_id' => :'applicationId',
98
- :'from' => :'from',
99
- :'to' => :'to',
100
- :'call_id' => :'callId',
101
- :'direction' => :'direction',
102
- :'call_url' => :'callUrl',
103
- :'enqueued_time' => :'enqueuedTime',
104
- :'start_time' => :'startTime',
105
- :'answer_time' => :'answerTime',
106
- :'end_time' => :'endTime',
107
- :'cause' => :'cause',
108
- :'error_message' => :'errorMessage',
109
- :'error_id' => :'errorId',
110
- :'tag' => :'tag'
111
- }
112
- end
113
-
114
- # Returns all the JSON keys this model knows about
115
- def self.acceptable_attributes
116
- attribute_map.values
117
- end
118
-
119
- # Attribute type mapping.
120
- def self.openapi_types
121
- {
122
- :'event_type' => :'String',
123
- :'event_time' => :'String',
124
- :'account_id' => :'String',
125
- :'application_id' => :'String',
126
- :'from' => :'String',
127
- :'to' => :'String',
128
- :'call_id' => :'String',
129
- :'direction' => :'CallDirectionEnum',
130
- :'call_url' => :'String',
131
- :'enqueued_time' => :'Time',
132
- :'start_time' => :'Time',
133
- :'answer_time' => :'Time',
134
- :'end_time' => :'Time',
135
- :'cause' => :'String',
136
- :'error_message' => :'String',
137
- :'error_id' => :'String',
138
- :'tag' => :'String'
139
- }
140
- end
141
-
142
- # List of attributes with nullable: true
143
- def self.openapi_nullable
144
- Set.new([
145
- :'enqueued_time',
146
- :'answer_time',
147
- :'error_message',
148
- :'error_id',
149
- :'tag'
150
- ])
151
- end
152
-
153
- # Initializes the object
154
- # @param [Hash] attributes Model attributes in the form of hash
155
- def initialize(attributes = {})
156
- if (!attributes.is_a?(Hash))
157
- fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::DisconenctCallback` initialize method'
158
- end
159
-
160
- # check to see if the attribute exists and convert string to symbol for hash key
161
- attributes = attributes.each_with_object({}) { |(k, v), h|
162
- if (!self.class.attribute_map.key?(k.to_sym))
163
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::DisconenctCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
164
- end
165
- h[k.to_sym] = v
166
- }
167
-
168
- if attributes.key?(:'event_type')
169
- self.event_type = attributes[:'event_type']
170
- end
171
-
172
- if attributes.key?(:'event_time')
173
- self.event_time = attributes[:'event_time']
174
- end
175
-
176
- if attributes.key?(:'account_id')
177
- self.account_id = attributes[:'account_id']
178
- end
179
-
180
- if attributes.key?(:'application_id')
181
- self.application_id = attributes[:'application_id']
182
- end
183
-
184
- if attributes.key?(:'from')
185
- self.from = attributes[:'from']
186
- end
187
-
188
- if attributes.key?(:'to')
189
- self.to = attributes[:'to']
190
- end
191
-
192
- if attributes.key?(:'call_id')
193
- self.call_id = attributes[:'call_id']
194
- end
195
-
196
- if attributes.key?(:'direction')
197
- self.direction = attributes[:'direction']
198
- end
199
-
200
- if attributes.key?(:'call_url')
201
- self.call_url = attributes[:'call_url']
202
- end
203
-
204
- if attributes.key?(:'enqueued_time')
205
- self.enqueued_time = attributes[:'enqueued_time']
206
- end
207
-
208
- if attributes.key?(:'start_time')
209
- self.start_time = attributes[:'start_time']
210
- end
211
-
212
- if attributes.key?(:'answer_time')
213
- self.answer_time = attributes[:'answer_time']
214
- end
215
-
216
- if attributes.key?(:'end_time')
217
- self.end_time = attributes[:'end_time']
218
- end
219
-
220
- if attributes.key?(:'cause')
221
- self.cause = attributes[:'cause']
222
- end
223
-
224
- if attributes.key?(:'error_message')
225
- self.error_message = attributes[:'error_message']
226
- end
227
-
228
- if attributes.key?(:'error_id')
229
- self.error_id = attributes[:'error_id']
230
- end
231
-
232
- if attributes.key?(:'tag')
233
- self.tag = attributes[:'tag']
234
- end
235
- end
236
-
237
- # Show invalid properties with the reasons. Usually used together with valid?
238
- # @return Array for valid properties with the reasons
239
- def list_invalid_properties
240
- invalid_properties = Array.new
241
- invalid_properties
242
- end
243
-
244
- # Check to see if the all the properties in the model are valid
245
- # @return true if the model is valid
246
- def valid?
247
- true
248
- end
249
-
250
- # Checks equality by comparing each attribute.
251
- # @param [Object] Object to be compared
252
- def ==(o)
253
- return true if self.equal?(o)
254
- self.class == o.class &&
255
- event_type == o.event_type &&
256
- event_time == o.event_time &&
257
- account_id == o.account_id &&
258
- application_id == o.application_id &&
259
- from == o.from &&
260
- to == o.to &&
261
- call_id == o.call_id &&
262
- direction == o.direction &&
263
- call_url == o.call_url &&
264
- enqueued_time == o.enqueued_time &&
265
- start_time == o.start_time &&
266
- answer_time == o.answer_time &&
267
- end_time == o.end_time &&
268
- cause == o.cause &&
269
- error_message == o.error_message &&
270
- error_id == o.error_id &&
271
- tag == o.tag
272
- end
273
-
274
- # @see the `==` method
275
- # @param [Object] Object to be compared
276
- def eql?(o)
277
- self == o
278
- end
279
-
280
- # Calculates hash code according to all attributes.
281
- # @return [Integer] Hash code
282
- def hash
283
- [event_type, event_time, account_id, application_id, from, to, call_id, direction, call_url, enqueued_time, start_time, answer_time, end_time, cause, error_message, error_id, tag].hash
284
- end
285
-
286
- # Builds the object from hash
287
- # @param [Hash] attributes Model attributes in the form of hash
288
- # @return [Object] Returns the model itself
289
- def self.build_from_hash(attributes)
290
- new.build_from_hash(attributes)
291
- end
292
-
293
- # Builds the object from hash
294
- # @param [Hash] attributes Model attributes in the form of hash
295
- # @return [Object] Returns the model itself
296
- def build_from_hash(attributes)
297
- return nil unless attributes.is_a?(Hash)
298
- attributes = attributes.transform_keys(&:to_sym)
299
- self.class.openapi_types.each_pair do |key, type|
300
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
301
- self.send("#{key}=", nil)
302
- elsif type =~ /\AArray<(.*)>/i
303
- # check to ensure the input is an array given that the attribute
304
- # is documented as an array but the input is not
305
- if attributes[self.class.attribute_map[key]].is_a?(Array)
306
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
307
- end
308
- elsif !attributes[self.class.attribute_map[key]].nil?
309
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
310
- end
311
- end
312
-
313
- self
314
- end
315
-
316
- # Deserializes the data based on type
317
- # @param string type Data type
318
- # @param string value Value to be deserialized
319
- # @return [Object] Deserialized data
320
- def _deserialize(type, value)
321
- case type.to_sym
322
- when :Time
323
- Time.parse(value)
324
- when :Date
325
- Date.parse(value)
326
- when :String
327
- value.to_s
328
- when :Integer
329
- value.to_i
330
- when :Float
331
- value.to_f
332
- when :Boolean
333
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
334
- true
335
- else
336
- false
337
- end
338
- when :Object
339
- # generic object (usually a Hash), return directly
340
- value
341
- when /\AArray<(?<inner_type>.+)>\z/
342
- inner_type = Regexp.last_match[:inner_type]
343
- value.map { |v| _deserialize(inner_type, v) }
344
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
345
- k_type = Regexp.last_match[:k_type]
346
- v_type = Regexp.last_match[:v_type]
347
- {}.tap do |hash|
348
- value.each do |k, v|
349
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
350
- end
351
- end
352
- else # model
353
- # models (e.g. Pet) or oneOf
354
- klass = Bandwidth.const_get(type)
355
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
356
- end
357
- end
358
-
359
- # Returns the string representation of the object
360
- # @return [String] String presentation of the object
361
- def to_s
362
- to_hash.to_s
363
- end
364
-
365
- # to_body is an alias to to_hash (backward compatibility)
366
- # @return [Hash] Returns the object in the form of hash
367
- def to_body
368
- to_hash
369
- end
370
-
371
- # Returns the object in the form of hash
372
- # @return [Hash] Returns the object in the form of hash
373
- def to_hash
374
- hash = {}
375
- self.class.attribute_map.each_pair do |attr, param|
376
- value = self.send(attr)
377
- if value.nil?
378
- is_nullable = self.class.openapi_nullable.include?(attr)
379
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
380
- end
381
-
382
- hash[param] = _to_hash(value)
383
- end
384
- hash
385
- end
386
-
387
- # Outputs non-array value in the form of hash
388
- # For object, use to_hash. Otherwise, just return the value
389
- # @param [Object] value Any valid value
390
- # @return [Hash] Returns the value in the form of hash
391
- def _to_hash(value)
392
- if value.is_a?(Array)
393
- value.compact.map { |v| _to_hash(v) }
394
- elsif value.is_a?(Hash)
395
- {}.tap do |hash|
396
- value.each { |k, v| hash[k] = _to_hash(v) }
397
- end
398
- elsif value.respond_to? :to_hash
399
- value.to_hash
400
- else
401
- value
402
- end
403
- end
404
- end
405
- end
@@ -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
- # Inbound Message Callback
18
- class InboundMessageCallback
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' => :'InboundMessageCallbackMessage'
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::InboundMessageCallback` 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::InboundMessageCallback`. 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