bandwidth-sdk 17.3.2 → 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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +6 -6
  3. data/README.md +28 -2
  4. data/bandwidth.yml +979 -60
  5. data/coverage/.last_run.json +1 -1
  6. data/coverage/.resultset.json +783 -152
  7. data/coverage/index.html +21642 -14804
  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/{BusinessRegistrationIssuingCountryEnum.md → DeviceStatusEnum.md} +2 -2
  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/MediaApi.md +1 -1
  33. data/docs/MessageRequest.md +1 -1
  34. data/docs/MmsMessageContentFile.md +1 -1
  35. data/docs/Page.md +24 -0
  36. data/docs/RbmActionBase.md +1 -1
  37. data/docs/RbmSuggestionResponse.md +1 -1
  38. data/docs/SipConnectionMetadata.md +24 -0
  39. data/docs/SipCredentials.md +20 -0
  40. data/docs/StatusCallback.md +1 -1
  41. data/docs/SyncLookupRequest.md +3 -1
  42. data/docs/TfvSubmissionInfo.md +3 -3
  43. data/docs/UpdateCall.md +1 -1
  44. data/docs/VerificationRequest.md +3 -3
  45. data/docs/VerificationUpdateRequest.md +3 -3
  46. data/docs/WebhookSubscriptionError.md +22 -0
  47. data/docs/WebhookSubscriptionsListBody.md +1 -1
  48. data/lib/bandwidth-sdk/api/endpoints_api.rb +397 -0
  49. data/lib/bandwidth-sdk/api/media_api.rb +2 -2
  50. data/lib/bandwidth-sdk/configuration.rb +30 -0
  51. data/lib/bandwidth-sdk/models/brtc_error.rb +219 -0
  52. data/lib/bandwidth-sdk/models/brtc_error_response.rb +204 -0
  53. data/lib/bandwidth-sdk/models/brtc_error_source.rb +176 -0
  54. data/lib/bandwidth-sdk/models/brtc_link.rb +166 -0
  55. data/lib/bandwidth-sdk/models/create_call.rb +7 -7
  56. data/lib/bandwidth-sdk/models/create_endpoint_request_base.rb +250 -0
  57. data/lib/bandwidth-sdk/models/create_endpoint_response.rb +218 -0
  58. data/lib/bandwidth-sdk/models/create_endpoint_response_data.rb +356 -0
  59. data/lib/bandwidth-sdk/models/create_web_rtc_connection_request.rb +266 -0
  60. data/lib/bandwidth-sdk/models/device.rb +258 -0
  61. data/lib/bandwidth-sdk/models/device_status_enum.rb +40 -0
  62. data/lib/bandwidth-sdk/models/endpoint.rb +329 -0
  63. data/lib/bandwidth-sdk/models/endpoint_direction_enum.rb +41 -0
  64. data/lib/bandwidth-sdk/models/endpoint_event.rb +381 -0
  65. data/lib/bandwidth-sdk/models/endpoint_event_type_enum.rb +40 -0
  66. data/lib/bandwidth-sdk/models/endpoint_response.rb +218 -0
  67. data/lib/bandwidth-sdk/models/endpoint_status_enum.rb +40 -0
  68. data/lib/bandwidth-sdk/models/endpoint_type_enum.rb +39 -0
  69. data/lib/bandwidth-sdk/models/endpoints.rb +311 -0
  70. data/lib/bandwidth-sdk/models/inbound_callback.rb +2 -2
  71. data/lib/bandwidth-sdk/models/list_endpoints_response.rb +229 -0
  72. data/lib/bandwidth-sdk/models/lookup_result.rb +1 -1
  73. data/lib/bandwidth-sdk/models/machine_detection_configuration.rb +1 -1
  74. data/lib/bandwidth-sdk/models/message_request.rb +1 -1
  75. data/lib/bandwidth-sdk/models/mms_message_content_file.rb +1 -1
  76. data/lib/bandwidth-sdk/models/page.rb +259 -0
  77. data/lib/bandwidth-sdk/models/sip_connection_metadata.rb +175 -0
  78. data/lib/bandwidth-sdk/models/sip_credentials.rb +156 -0
  79. data/lib/bandwidth-sdk/models/status_callback.rb +1 -1
  80. data/lib/bandwidth-sdk/models/sync_lookup_request.rb +35 -4
  81. data/lib/bandwidth-sdk/models/tfv_submission_info.rb +4 -2
  82. data/lib/bandwidth-sdk/models/update_call.rb +6 -6
  83. data/lib/bandwidth-sdk/models/verification_request.rb +4 -2
  84. data/lib/bandwidth-sdk/models/verification_update_request.rb +4 -2
  85. data/lib/bandwidth-sdk/models/webhook_subscription_error.rb +165 -0
  86. data/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb +1 -1
  87. data/lib/bandwidth-sdk/version.rb +1 -1
  88. data/lib/bandwidth-sdk.rb +24 -2
  89. data/spec/smoke/endpoints_api_spec.rb +148 -0
  90. data/spec/smoke/phone_number_lookup_api_spec.rb +1 -9
  91. data/spec/unit/api/endpoints_api_spec.rb +172 -0
  92. data/spec/unit/api/phone_number_lookup_api_spec.rb +2 -0
  93. data/spec/unit/api/toll_free_verification_api_spec.rb +1 -1
  94. metadata +104 -54
  95. data/lib/bandwidth-sdk/models/business_registration_issuing_country_enum.rb +0 -55
@@ -0,0 +1,166 @@
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 BrtcLink < ApiModelBase
18
+ # The full URL of the link.
19
+ attr_accessor :href
20
+
21
+ # The relationship of the link to the current resource.
22
+ attr_accessor :rel
23
+
24
+ # The HTTP method to use when making the request.
25
+ attr_accessor :method
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'href' => :'href',
31
+ :'rel' => :'rel',
32
+ :'method' => :'method'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'href' => :'String',
50
+ :'rel' => :'String',
51
+ :'method' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::BrtcLink` initialize method'
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::BrtcLink`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'href')
78
+ self.href = attributes[:'href']
79
+ end
80
+
81
+ if attributes.key?(:'rel')
82
+ self.rel = attributes[:'rel']
83
+ end
84
+
85
+ if attributes.key?(:'method')
86
+ self.method = attributes[:'method']
87
+ end
88
+ end
89
+
90
+ # Show invalid properties with the reasons. Usually used together with valid?
91
+ # @return Array for valid properties with the reasons
92
+ def list_invalid_properties
93
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
94
+ invalid_properties = Array.new
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ warn '[DEPRECATED] the `valid?` method is obsolete'
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ href == o.href &&
111
+ rel == o.rel &&
112
+ method == o.method
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [href, rel, method].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ attributes = attributes.transform_keys(&:to_sym)
133
+ transformed_hash = {}
134
+ openapi_types.each_pair do |key, type|
135
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = nil
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[attribute_map[key]].is_a?(Array)
141
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
142
+ end
143
+ elsif !attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
145
+ end
146
+ end
147
+ new(transformed_hash)
148
+ end
149
+
150
+ # Returns the object in the form of hash
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_hash
153
+ hash = {}
154
+ self.class.attribute_map.each_pair do |attr, param|
155
+ value = self.send(attr)
156
+ if value.nil?
157
+ is_nullable = self.class.openapi_nullable.include?(attr)
158
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
159
+ end
160
+
161
+ hash[param] = _to_hash(value)
162
+ end
163
+ hash
164
+ end
165
+ end
166
+ end
@@ -24,7 +24,7 @@ module Bandwidth
24
24
  # Hide the calling number. The `displayName` field can be used to customize the displayed name.
25
25
  attr_accessor :privacy
26
26
 
27
- # The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`.
27
+ # The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`.
28
28
  attr_accessor :display_name
29
29
 
30
30
  # A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP URI. Each value must end with an 'encoding' parameter as described in <a href='https://tools.ietf.org/html/rfc7433'>RFC 7433</a>. Only 'jwt', 'base64' and 'hex' encodings are allowed. The entire value cannot exceed 350 characters, including parameters and separators.
@@ -71,7 +71,7 @@ module Bandwidth
71
71
  # The priority of this call over other calls from your account. For example, if during a call your application needs to place a new call and bridge it with the current call, you might want to create the call with priority 1 so that it will be the next call picked off your queue, ahead of other less time sensitive calls. A lower value means higher priority, so a priority 1 call takes precedence over a priority 2 call.
72
72
  attr_accessor :priority
73
73
 
74
- # A custom string that will be sent with all webhooks for this call unless overwritten by a future <a href='/docs/voice/bxml/tag'>`<Tag>`</a> verb or `tag` attribute on another verb, or cleared. May be cleared by setting `tag=\"\"` Max length 256 characters.
74
+ # A custom string that will be sent with all webhooks for this call unless overwritten by a future <a href='/docs/voice/bxml/tag'>`<Tag>`</a> verb or `tag` attribute on another verb, or cleared. May be cleared by setting `tag=\"\"` Max length 4096 characters.
75
75
  attr_accessor :tag
76
76
 
77
77
  class EnumAttributeValidator
@@ -380,8 +380,8 @@ module Bandwidth
380
380
  invalid_properties.push('invalid value for "priority", must be greater than or equal to 1.')
381
381
  end
382
382
 
383
- if !@tag.nil? && @tag.to_s.length > 256
384
- invalid_properties.push('invalid value for "tag", the character length must be smaller than or equal to 256.')
383
+ if !@tag.nil? && @tag.to_s.length > 4096
384
+ invalid_properties.push('invalid value for "tag", the character length must be smaller than or equal to 4096.')
385
385
  end
386
386
 
387
387
  invalid_properties
@@ -409,7 +409,7 @@ module Bandwidth
409
409
  return false if !@callback_timeout.nil? && @callback_timeout < 1
410
410
  return false if !@priority.nil? && @priority > 5
411
411
  return false if !@priority.nil? && @priority < 1
412
- return false if !@tag.nil? && @tag.to_s.length > 256
412
+ return false if !@tag.nil? && @tag.to_s.length > 4096
413
413
  true
414
414
  end
415
415
 
@@ -572,8 +572,8 @@ module Bandwidth
572
572
  # Custom attribute writer method with validation
573
573
  # @param [Object] tag Value to be assigned
574
574
  def tag=(tag)
575
- if !tag.nil? && tag.to_s.length > 256
576
- fail ArgumentError, 'invalid value for "tag", the character length must be smaller than or equal to 256.'
575
+ if !tag.nil? && tag.to_s.length > 4096
576
+ fail ArgumentError, 'invalid value for "tag", the character length must be smaller than or equal to 4096.'
577
577
  end
578
578
 
579
579
  @tag = tag
@@ -0,0 +1,250 @@
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 CreateEndpointRequestBase < ApiModelBase
18
+ attr_accessor :type
19
+
20
+ attr_accessor :direction
21
+
22
+ # The URL to send event callbacks to.
23
+ attr_accessor :event_callback_url
24
+
25
+ # The URL to send event fallbacks to.
26
+ attr_accessor :event_fallback_url
27
+
28
+ # A tag for the endpoint.
29
+ attr_accessor :tag
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'type' => :'type',
57
+ :'direction' => :'direction',
58
+ :'event_callback_url' => :'eventCallbackUrl',
59
+ :'event_fallback_url' => :'eventFallbackUrl',
60
+ :'tag' => :'tag'
61
+ }
62
+ end
63
+
64
+ # Returns attribute mapping this model knows about
65
+ def self.acceptable_attribute_map
66
+ attribute_map
67
+ end
68
+
69
+ # Returns all the JSON keys this model knows about
70
+ def self.acceptable_attributes
71
+ acceptable_attribute_map.values
72
+ end
73
+
74
+ # Attribute type mapping.
75
+ def self.openapi_types
76
+ {
77
+ :'type' => :'EndpointTypeEnum',
78
+ :'direction' => :'EndpointDirectionEnum',
79
+ :'event_callback_url' => :'String',
80
+ :'event_fallback_url' => :'String',
81
+ :'tag' => :'String'
82
+ }
83
+ end
84
+
85
+ # List of attributes with nullable: true
86
+ def self.openapi_nullable
87
+ Set.new([
88
+ ])
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ if (!attributes.is_a?(Hash))
95
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateEndpointRequestBase` initialize method'
96
+ end
97
+
98
+ # check to see if the attribute exists and convert string to symbol for hash key
99
+ acceptable_attribute_map = self.class.acceptable_attribute_map
100
+ attributes = attributes.each_with_object({}) { |(k, v), h|
101
+ if (!acceptable_attribute_map.key?(k.to_sym))
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateEndpointRequestBase`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
103
+ end
104
+ h[k.to_sym] = v
105
+ }
106
+
107
+ if attributes.key?(:'type')
108
+ self.type = attributes[:'type']
109
+ else
110
+ self.type = nil
111
+ end
112
+
113
+ if attributes.key?(:'direction')
114
+ self.direction = attributes[:'direction']
115
+ else
116
+ self.direction = nil
117
+ end
118
+
119
+ if attributes.key?(:'event_callback_url')
120
+ self.event_callback_url = attributes[:'event_callback_url']
121
+ end
122
+
123
+ if attributes.key?(:'event_fallback_url')
124
+ self.event_fallback_url = attributes[:'event_fallback_url']
125
+ end
126
+
127
+ if attributes.key?(:'tag')
128
+ self.tag = attributes[:'tag']
129
+ end
130
+ end
131
+
132
+ # Show invalid properties with the reasons. Usually used together with valid?
133
+ # @return Array for valid properties with the reasons
134
+ def list_invalid_properties
135
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
136
+ invalid_properties = Array.new
137
+ if @type.nil?
138
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
139
+ end
140
+
141
+ if @direction.nil?
142
+ invalid_properties.push('invalid value for "direction", direction cannot be nil.')
143
+ end
144
+
145
+ invalid_properties
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ warn '[DEPRECATED] the `valid?` method is obsolete'
152
+ return false if @type.nil?
153
+ return false if @direction.nil?
154
+ true
155
+ end
156
+
157
+ # Custom attribute writer method with validation
158
+ # @param [Object] type Value to be assigned
159
+ def type=(type)
160
+ if type.nil?
161
+ fail ArgumentError, 'type cannot be nil'
162
+ end
163
+
164
+ @type = type
165
+ end
166
+
167
+ # Custom attribute writer method with validation
168
+ # @param [Object] direction Value to be assigned
169
+ def direction=(direction)
170
+ if direction.nil?
171
+ fail ArgumentError, 'direction cannot be nil'
172
+ end
173
+
174
+ @direction = direction
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] tag Value to be assigned
179
+ def tag=(tag)
180
+ if tag.nil?
181
+ fail ArgumentError, 'tag cannot be nil'
182
+ end
183
+
184
+ @tag = tag
185
+ end
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] Object to be compared
189
+ def ==(o)
190
+ return true if self.equal?(o)
191
+ self.class == o.class &&
192
+ type == o.type &&
193
+ direction == o.direction &&
194
+ event_callback_url == o.event_callback_url &&
195
+ event_fallback_url == o.event_fallback_url &&
196
+ tag == o.tag
197
+ end
198
+
199
+ # @see the `==` method
200
+ # @param [Object] Object to be compared
201
+ def eql?(o)
202
+ self == o
203
+ end
204
+
205
+ # Calculates hash code according to all attributes.
206
+ # @return [Integer] Hash code
207
+ def hash
208
+ [type, direction, event_callback_url, event_fallback_url, tag].hash
209
+ end
210
+
211
+ # Builds the object from hash
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ # @return [Object] Returns the model itself
214
+ def self.build_from_hash(attributes)
215
+ return nil unless attributes.is_a?(Hash)
216
+ attributes = attributes.transform_keys(&:to_sym)
217
+ transformed_hash = {}
218
+ openapi_types.each_pair do |key, type|
219
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
220
+ transformed_hash["#{key}"] = nil
221
+ elsif type =~ /\AArray<(.*)>/i
222
+ # check to ensure the input is an array given that the attribute
223
+ # is documented as an array but the input is not
224
+ if attributes[attribute_map[key]].is_a?(Array)
225
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
226
+ end
227
+ elsif !attributes[attribute_map[key]].nil?
228
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
229
+ end
230
+ end
231
+ new(transformed_hash)
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+ end
250
+ 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 CreateEndpointResponse < 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' => :'CreateEndpointResponseData',
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::CreateEndpointResponse` 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::CreateEndpointResponse`. 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