bandwidth-sdk 18.0.0 → 18.1.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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -4
  3. data/README.md +28 -1
  4. data/bandwidth.yml +944 -19
  5. data/coverage/.last_run.json +1 -1
  6. data/coverage/.resultset.json +784 -152
  7. data/coverage/index.html +21650 -14800
  8. data/docs/BrtcError.md +26 -0
  9. data/docs/BrtcErrorResponse.md +22 -0
  10. data/docs/BrtcErrorSource.md +24 -0
  11. data/docs/BrtcLink.md +22 -0
  12. data/docs/CreateCall.md +2 -2
  13. data/docs/CreateEndpointRequestBase.md +26 -0
  14. data/docs/CreateEndpointResponse.md +22 -0
  15. data/docs/CreateEndpointResponseData.md +32 -0
  16. data/docs/CreateWebRtcConnectionRequest.md +28 -0
  17. data/docs/Device.md +24 -0
  18. data/docs/DeviceStatusEnum.md +15 -0
  19. data/docs/Endpoint.md +30 -0
  20. data/docs/EndpointDirectionEnum.md +15 -0
  21. data/docs/EndpointEvent.md +34 -0
  22. data/docs/EndpointEventTypeEnum.md +15 -0
  23. data/docs/EndpointResponse.md +22 -0
  24. data/docs/EndpointStatusEnum.md +15 -0
  25. data/docs/EndpointTypeEnum.md +15 -0
  26. data/docs/Endpoints.md +28 -0
  27. data/docs/EndpointsApi.md +395 -0
  28. data/docs/InboundCallback.md +2 -2
  29. data/docs/ListEndpointsResponse.md +24 -0
  30. data/docs/LookupResult.md +1 -1
  31. data/docs/MachineDetectionConfiguration.md +1 -1
  32. data/docs/MessageRequest.md +1 -1
  33. data/docs/Page.md +24 -0
  34. data/docs/RbmActionBase.md +1 -1
  35. data/docs/RbmSuggestionResponse.md +1 -1
  36. data/docs/SipConnectionMetadata.md +24 -0
  37. data/docs/SipCredentials.md +20 -0
  38. data/docs/StatusCallback.md +1 -1
  39. data/docs/SyncLookupRequest.md +3 -1
  40. data/docs/UpdateCall.md +1 -1
  41. data/docs/WebhookSubscriptionError.md +22 -0
  42. data/docs/WebhookSubscriptionsListBody.md +1 -1
  43. data/lib/bandwidth-sdk/api/endpoints_api.rb +397 -0
  44. data/lib/bandwidth-sdk/configuration.rb +30 -0
  45. data/lib/bandwidth-sdk/models/brtc_error.rb +219 -0
  46. data/lib/bandwidth-sdk/models/brtc_error_response.rb +204 -0
  47. data/lib/bandwidth-sdk/models/brtc_error_source.rb +176 -0
  48. data/lib/bandwidth-sdk/models/brtc_link.rb +166 -0
  49. data/lib/bandwidth-sdk/models/create_call.rb +7 -7
  50. data/lib/bandwidth-sdk/models/create_endpoint_request_base.rb +250 -0
  51. data/lib/bandwidth-sdk/models/create_endpoint_response.rb +218 -0
  52. data/lib/bandwidth-sdk/models/create_endpoint_response_data.rb +356 -0
  53. data/lib/bandwidth-sdk/models/create_web_rtc_connection_request.rb +266 -0
  54. data/lib/bandwidth-sdk/models/device.rb +258 -0
  55. data/lib/bandwidth-sdk/models/device_status_enum.rb +40 -0
  56. data/lib/bandwidth-sdk/models/endpoint.rb +329 -0
  57. data/lib/bandwidth-sdk/models/endpoint_direction_enum.rb +41 -0
  58. data/lib/bandwidth-sdk/models/endpoint_event.rb +381 -0
  59. data/lib/bandwidth-sdk/models/endpoint_event_type_enum.rb +40 -0
  60. data/lib/bandwidth-sdk/models/endpoint_response.rb +218 -0
  61. data/lib/bandwidth-sdk/models/endpoint_status_enum.rb +40 -0
  62. data/lib/bandwidth-sdk/models/endpoint_type_enum.rb +39 -0
  63. data/lib/bandwidth-sdk/models/endpoints.rb +311 -0
  64. data/lib/bandwidth-sdk/models/inbound_callback.rb +2 -2
  65. data/lib/bandwidth-sdk/models/list_endpoints_response.rb +229 -0
  66. data/lib/bandwidth-sdk/models/lookup_result.rb +1 -1
  67. data/lib/bandwidth-sdk/models/machine_detection_configuration.rb +1 -1
  68. data/lib/bandwidth-sdk/models/message_request.rb +1 -1
  69. data/lib/bandwidth-sdk/models/page.rb +259 -0
  70. data/lib/bandwidth-sdk/models/sip_connection_metadata.rb +175 -0
  71. data/lib/bandwidth-sdk/models/sip_credentials.rb +156 -0
  72. data/lib/bandwidth-sdk/models/status_callback.rb +1 -1
  73. data/lib/bandwidth-sdk/models/sync_lookup_request.rb +35 -4
  74. data/lib/bandwidth-sdk/models/update_call.rb +6 -6
  75. data/lib/bandwidth-sdk/models/webhook_subscription_error.rb +165 -0
  76. data/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb +1 -1
  77. data/lib/bandwidth-sdk/version.rb +1 -1
  78. data/lib/bandwidth-sdk.rb +24 -1
  79. data/spec/smoke/endpoints_api_spec.rb +148 -0
  80. data/spec/unit/api/endpoints_api_spec.rb +172 -0
  81. data/spec/unit/api/phone_number_lookup_api_spec.rb +2 -0
  82. metadata +104 -52
@@ -0,0 +1,381 @@
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.17.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ # An event that occurred on an endpoint.
18
+ class EndpointEvent < ApiModelBase
19
+ # The unique ID of the endpoint.
20
+ attr_accessor :endpoint_id
21
+
22
+ attr_accessor :type
23
+
24
+ attr_accessor :status
25
+
26
+ # The time the endpoint was created. In ISO-8601 format.
27
+ attr_accessor :creation_timestamp
28
+
29
+ # The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours.
30
+ attr_accessor :expiration_timestamp
31
+
32
+ # A tag for the endpoint.
33
+ attr_accessor :tag
34
+
35
+ # The time the event occurred. In ISO-8601 format.
36
+ attr_accessor :event_time
37
+
38
+ attr_accessor :event_type
39
+
40
+ attr_accessor :device
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
+ :'endpoint_id' => :'endpointId',
68
+ :'type' => :'type',
69
+ :'status' => :'status',
70
+ :'creation_timestamp' => :'creationTimestamp',
71
+ :'expiration_timestamp' => :'expirationTimestamp',
72
+ :'tag' => :'tag',
73
+ :'event_time' => :'eventTime',
74
+ :'event_type' => :'eventType',
75
+ :'device' => :'device'
76
+ }
77
+ end
78
+
79
+ # Returns attribute mapping this model knows about
80
+ def self.acceptable_attribute_map
81
+ attribute_map
82
+ end
83
+
84
+ # Returns all the JSON keys this model knows about
85
+ def self.acceptable_attributes
86
+ acceptable_attribute_map.values
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.openapi_types
91
+ {
92
+ :'endpoint_id' => :'String',
93
+ :'type' => :'EndpointTypeEnum',
94
+ :'status' => :'EndpointStatusEnum',
95
+ :'creation_timestamp' => :'Time',
96
+ :'expiration_timestamp' => :'Time',
97
+ :'tag' => :'String',
98
+ :'event_time' => :'Time',
99
+ :'event_type' => :'EndpointEventTypeEnum',
100
+ :'device' => :'Device'
101
+ }
102
+ end
103
+
104
+ # List of attributes with nullable: true
105
+ def self.openapi_nullable
106
+ Set.new([
107
+ ])
108
+ end
109
+
110
+ # List of class defined in allOf (OpenAPI v3)
111
+ def self.openapi_all_of
112
+ [
113
+ :'Endpoints'
114
+ ]
115
+ end
116
+
117
+ # Initializes the object
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ def initialize(attributes = {})
120
+ if (!attributes.is_a?(Hash))
121
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::EndpointEvent` initialize method'
122
+ end
123
+
124
+ # check to see if the attribute exists and convert string to symbol for hash key
125
+ acceptable_attribute_map = self.class.acceptable_attribute_map
126
+ attributes = attributes.each_with_object({}) { |(k, v), h|
127
+ if (!acceptable_attribute_map.key?(k.to_sym))
128
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::EndpointEvent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
129
+ end
130
+ h[k.to_sym] = v
131
+ }
132
+
133
+ if attributes.key?(:'endpoint_id')
134
+ self.endpoint_id = attributes[:'endpoint_id']
135
+ else
136
+ self.endpoint_id = nil
137
+ end
138
+
139
+ if attributes.key?(:'type')
140
+ self.type = attributes[:'type']
141
+ else
142
+ self.type = nil
143
+ end
144
+
145
+ if attributes.key?(:'status')
146
+ self.status = attributes[:'status']
147
+ else
148
+ self.status = nil
149
+ end
150
+
151
+ if attributes.key?(:'creation_timestamp')
152
+ self.creation_timestamp = attributes[:'creation_timestamp']
153
+ else
154
+ self.creation_timestamp = nil
155
+ end
156
+
157
+ if attributes.key?(:'expiration_timestamp')
158
+ self.expiration_timestamp = attributes[:'expiration_timestamp']
159
+ else
160
+ self.expiration_timestamp = nil
161
+ end
162
+
163
+ if attributes.key?(:'tag')
164
+ self.tag = attributes[:'tag']
165
+ end
166
+
167
+ if attributes.key?(:'event_time')
168
+ self.event_time = attributes[:'event_time']
169
+ else
170
+ self.event_time = nil
171
+ end
172
+
173
+ if attributes.key?(:'event_type')
174
+ self.event_type = attributes[:'event_type']
175
+ else
176
+ self.event_type = nil
177
+ end
178
+
179
+ if attributes.key?(:'device')
180
+ self.device = attributes[:'device']
181
+ end
182
+ end
183
+
184
+ # Show invalid properties with the reasons. Usually used together with valid?
185
+ # @return Array for valid properties with the reasons
186
+ def list_invalid_properties
187
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
188
+ invalid_properties = Array.new
189
+ if @endpoint_id.nil?
190
+ invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
191
+ end
192
+
193
+ if @type.nil?
194
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
195
+ end
196
+
197
+ if @status.nil?
198
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
199
+ end
200
+
201
+ if @creation_timestamp.nil?
202
+ invalid_properties.push('invalid value for "creation_timestamp", creation_timestamp cannot be nil.')
203
+ end
204
+
205
+ if @expiration_timestamp.nil?
206
+ invalid_properties.push('invalid value for "expiration_timestamp", expiration_timestamp cannot be nil.')
207
+ end
208
+
209
+ if @event_time.nil?
210
+ invalid_properties.push('invalid value for "event_time", event_time cannot be nil.')
211
+ end
212
+
213
+ if @event_type.nil?
214
+ invalid_properties.push('invalid value for "event_type", event_type cannot be nil.')
215
+ end
216
+
217
+ invalid_properties
218
+ end
219
+
220
+ # Check to see if the all the properties in the model are valid
221
+ # @return true if the model is valid
222
+ def valid?
223
+ warn '[DEPRECATED] the `valid?` method is obsolete'
224
+ return false if @endpoint_id.nil?
225
+ return false if @type.nil?
226
+ return false if @status.nil?
227
+ return false if @creation_timestamp.nil?
228
+ return false if @expiration_timestamp.nil?
229
+ return false if @event_time.nil?
230
+ return false if @event_type.nil?
231
+ true
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] endpoint_id Value to be assigned
236
+ def endpoint_id=(endpoint_id)
237
+ if endpoint_id.nil?
238
+ fail ArgumentError, 'endpoint_id cannot be nil'
239
+ end
240
+
241
+ @endpoint_id = endpoint_id
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] type Value to be assigned
246
+ def type=(type)
247
+ if type.nil?
248
+ fail ArgumentError, 'type cannot be nil'
249
+ end
250
+
251
+ @type = type
252
+ end
253
+
254
+ # Custom attribute writer method with validation
255
+ # @param [Object] status Value to be assigned
256
+ def status=(status)
257
+ if status.nil?
258
+ fail ArgumentError, 'status cannot be nil'
259
+ end
260
+
261
+ @status = status
262
+ end
263
+
264
+ # Custom attribute writer method with validation
265
+ # @param [Object] creation_timestamp Value to be assigned
266
+ def creation_timestamp=(creation_timestamp)
267
+ if creation_timestamp.nil?
268
+ fail ArgumentError, 'creation_timestamp cannot be nil'
269
+ end
270
+
271
+ @creation_timestamp = creation_timestamp
272
+ end
273
+
274
+ # Custom attribute writer method with validation
275
+ # @param [Object] expiration_timestamp Value to be assigned
276
+ def expiration_timestamp=(expiration_timestamp)
277
+ if expiration_timestamp.nil?
278
+ fail ArgumentError, 'expiration_timestamp cannot be nil'
279
+ end
280
+
281
+ @expiration_timestamp = expiration_timestamp
282
+ end
283
+
284
+ # Custom attribute writer method with validation
285
+ # @param [Object] tag Value to be assigned
286
+ def tag=(tag)
287
+ if tag.nil?
288
+ fail ArgumentError, 'tag cannot be nil'
289
+ end
290
+
291
+ @tag = tag
292
+ end
293
+
294
+ # Custom attribute writer method with validation
295
+ # @param [Object] event_time Value to be assigned
296
+ def event_time=(event_time)
297
+ if event_time.nil?
298
+ fail ArgumentError, 'event_time cannot be nil'
299
+ end
300
+
301
+ @event_time = event_time
302
+ end
303
+
304
+ # Custom attribute writer method with validation
305
+ # @param [Object] event_type Value to be assigned
306
+ def event_type=(event_type)
307
+ if event_type.nil?
308
+ fail ArgumentError, 'event_type cannot be nil'
309
+ end
310
+
311
+ @event_type = event_type
312
+ end
313
+
314
+ # Checks equality by comparing each attribute.
315
+ # @param [Object] Object to be compared
316
+ def ==(o)
317
+ return true if self.equal?(o)
318
+ self.class == o.class &&
319
+ endpoint_id == o.endpoint_id &&
320
+ type == o.type &&
321
+ status == o.status &&
322
+ creation_timestamp == o.creation_timestamp &&
323
+ expiration_timestamp == o.expiration_timestamp &&
324
+ tag == o.tag &&
325
+ event_time == o.event_time &&
326
+ event_type == o.event_type &&
327
+ device == o.device
328
+ end
329
+
330
+ # @see the `==` method
331
+ # @param [Object] Object to be compared
332
+ def eql?(o)
333
+ self == o
334
+ end
335
+
336
+ # Calculates hash code according to all attributes.
337
+ # @return [Integer] Hash code
338
+ def hash
339
+ [endpoint_id, type, status, creation_timestamp, expiration_timestamp, tag, event_time, event_type, device].hash
340
+ end
341
+
342
+ # Builds the object from hash
343
+ # @param [Hash] attributes Model attributes in the form of hash
344
+ # @return [Object] Returns the model itself
345
+ def self.build_from_hash(attributes)
346
+ return nil unless attributes.is_a?(Hash)
347
+ attributes = attributes.transform_keys(&:to_sym)
348
+ transformed_hash = {}
349
+ openapi_types.each_pair do |key, type|
350
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
351
+ transformed_hash["#{key}"] = nil
352
+ elsif type =~ /\AArray<(.*)>/i
353
+ # check to ensure the input is an array given that the attribute
354
+ # is documented as an array but the input is not
355
+ if attributes[attribute_map[key]].is_a?(Array)
356
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
357
+ end
358
+ elsif !attributes[attribute_map[key]].nil?
359
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
360
+ end
361
+ end
362
+ new(transformed_hash)
363
+ end
364
+
365
+ # Returns the object in the form of hash
366
+ # @return [Hash] Returns the object in the form of hash
367
+ def to_hash
368
+ hash = {}
369
+ self.class.attribute_map.each_pair do |attr, param|
370
+ value = self.send(attr)
371
+ if value.nil?
372
+ is_nullable = self.class.openapi_nullable.include?(attr)
373
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
374
+ end
375
+
376
+ hash[param] = _to_hash(value)
377
+ end
378
+ hash
379
+ end
380
+ end
381
+ 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.17.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ class EndpointEventTypeEnum
18
+ DEVICE_CONNECTED = 'DEVICE_CONNECTED'.freeze
19
+ DEVICE_DISCONNECTED = 'DEVICE_DISCONNECTED'.freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [DEVICE_CONNECTED, DEVICE_DISCONNECTED].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 EndpointEventTypeEnum.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #EndpointEventTypeEnum"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,218 @@
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.17.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ class EndpointResponse < ApiModelBase
18
+ attr_accessor :links
19
+
20
+ attr_accessor :data
21
+
22
+ attr_accessor :errors
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'links' => :'links',
28
+ :'data' => :'data',
29
+ :'errors' => :'errors'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'links' => :'Array<BrtcLink>',
47
+ :'data' => :'Endpoint',
48
+ :'errors' => :'Array<BrtcError>'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::EndpointResponse` initialize method'
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!acceptable_attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::EndpointResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'links')
75
+ if (value = attributes[:'links']).is_a?(Array)
76
+ self.links = value
77
+ end
78
+ else
79
+ self.links = nil
80
+ end
81
+
82
+ if attributes.key?(:'data')
83
+ self.data = attributes[:'data']
84
+ else
85
+ self.data = nil
86
+ end
87
+
88
+ if attributes.key?(:'errors')
89
+ if (value = attributes[:'errors']).is_a?(Array)
90
+ self.errors = value
91
+ end
92
+ else
93
+ self.errors = nil
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ if @links.nil?
103
+ invalid_properties.push('invalid value for "links", links cannot be nil.')
104
+ end
105
+
106
+ if @data.nil?
107
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
108
+ end
109
+
110
+ if @errors.nil?
111
+ invalid_properties.push('invalid value for "errors", errors cannot be nil.')
112
+ end
113
+
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ warn '[DEPRECATED] the `valid?` method is obsolete'
121
+ return false if @links.nil?
122
+ return false if @data.nil?
123
+ return false if @errors.nil?
124
+ true
125
+ end
126
+
127
+ # Custom attribute writer method with validation
128
+ # @param [Object] links Value to be assigned
129
+ def links=(links)
130
+ if links.nil?
131
+ fail ArgumentError, 'links cannot be nil'
132
+ end
133
+
134
+ @links = links
135
+ end
136
+
137
+ # Custom attribute writer method with validation
138
+ # @param [Object] data Value to be assigned
139
+ def data=(data)
140
+ if data.nil?
141
+ fail ArgumentError, 'data cannot be nil'
142
+ end
143
+
144
+ @data = data
145
+ end
146
+
147
+ # Custom attribute writer method with validation
148
+ # @param [Object] errors Value to be assigned
149
+ def errors=(errors)
150
+ if errors.nil?
151
+ fail ArgumentError, 'errors cannot be nil'
152
+ end
153
+
154
+ @errors = errors
155
+ end
156
+
157
+ # Checks equality by comparing each attribute.
158
+ # @param [Object] Object to be compared
159
+ def ==(o)
160
+ return true if self.equal?(o)
161
+ self.class == o.class &&
162
+ links == o.links &&
163
+ data == o.data &&
164
+ errors == o.errors
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Integer] Hash code
175
+ def hash
176
+ [links, data, errors].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def self.build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ attributes = attributes.transform_keys(&:to_sym)
185
+ transformed_hash = {}
186
+ openapi_types.each_pair do |key, type|
187
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
188
+ transformed_hash["#{key}"] = nil
189
+ elsif type =~ /\AArray<(.*)>/i
190
+ # check to ensure the input is an array given that the attribute
191
+ # is documented as an array but the input is not
192
+ if attributes[attribute_map[key]].is_a?(Array)
193
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
194
+ end
195
+ elsif !attributes[attribute_map[key]].nil?
196
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
197
+ end
198
+ end
199
+ new(transformed_hash)
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+ end
218
+ 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.17.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ class EndpointStatusEnum
18
+ CONNECTED = 'CONNECTED'.freeze
19
+ DISCONNECTED = 'DISCONNECTED'.freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [CONNECTED, DISCONNECTED].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 EndpointStatusEnum.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #EndpointStatusEnum"
38
+ end
39
+ end
40
+ end