bandwidth-sdk 14.0.0 → 14.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +9 -9
  3. data/README.md +42 -10
  4. data/bandwidth.yml +1102 -0
  5. data/coverage/.last_run.json +1 -1
  6. data/coverage/.resultset.json +1204 -231
  7. data/coverage/index.html +20499 -10053
  8. data/custom_templates/README.mustache +6 -6
  9. data/docs/AdditionalDenialReason.md +22 -0
  10. data/docs/Address.md +30 -0
  11. data/docs/Contact.md +24 -0
  12. data/docs/Error.md +22 -0
  13. data/docs/FailureWebhook.md +28 -0
  14. data/docs/LinksObject.md +24 -0
  15. data/docs/OptInWorkflow.md +20 -0
  16. data/docs/TelephoneNumber.md +18 -0
  17. data/docs/TfvBasicAuthentication.md +20 -0
  18. data/docs/TfvCallbackStatusEnum.md +15 -0
  19. data/docs/TfvError.md +22 -0
  20. data/docs/TfvStatus.md +32 -0
  21. data/docs/TfvStatusEnum.md +15 -0
  22. data/docs/TfvSubmissionInfo.md +34 -0
  23. data/docs/TfvSubmissionWrapper.md +18 -0
  24. data/docs/TollFreeVerificationApi.md +585 -0
  25. data/docs/VerificationDenialWebhook.md +32 -0
  26. data/docs/VerificationRequest.md +36 -0
  27. data/docs/VerificationUpdateRequest.md +34 -0
  28. data/docs/VerificationWebhook.md +24 -0
  29. data/docs/WebhookSubscription.md +30 -0
  30. data/docs/WebhookSubscriptionBasicAuthentication.md +20 -0
  31. data/docs/WebhookSubscriptionRequestSchema.md +22 -0
  32. data/docs/WebhookSubscriptionTypeEnum.md +15 -0
  33. data/docs/WebhookSubscriptionsListBody.md +22 -0
  34. data/lib/bandwidth-sdk/api/toll_free_verification_api.rb +614 -0
  35. data/lib/bandwidth-sdk/configuration.rb +48 -0
  36. data/lib/bandwidth-sdk/models/additional_denial_reason.rb +254 -0
  37. data/lib/bandwidth-sdk/models/address.rb +501 -0
  38. data/lib/bandwidth-sdk/models/contact.rb +393 -0
  39. data/lib/bandwidth-sdk/models/error.rb +232 -0
  40. data/lib/bandwidth-sdk/models/failure_webhook.rb +304 -0
  41. data/lib/bandwidth-sdk/models/links_object.rb +243 -0
  42. data/lib/bandwidth-sdk/models/opt_in_workflow.rb +265 -0
  43. data/lib/bandwidth-sdk/models/telephone_number.rb +213 -0
  44. data/lib/bandwidth-sdk/models/tfv_basic_authentication.rb +273 -0
  45. data/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb +40 -0
  46. data/lib/bandwidth-sdk/models/tfv_error.rb +232 -0
  47. data/lib/bandwidth-sdk/models/tfv_status.rb +342 -0
  48. data/lib/bandwidth-sdk/models/tfv_status_enum.rb +43 -0
  49. data/lib/bandwidth-sdk/models/tfv_submission_info.rb +452 -0
  50. data/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb +212 -0
  51. data/lib/bandwidth-sdk/models/verification_denial_webhook.rb +325 -0
  52. data/lib/bandwidth-sdk/models/verification_request.rb +547 -0
  53. data/lib/bandwidth-sdk/models/verification_update_request.rb +501 -0
  54. data/lib/bandwidth-sdk/models/verification_webhook.rb +303 -0
  55. data/lib/bandwidth-sdk/models/webhook_subscription.rb +328 -0
  56. data/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb +274 -0
  57. data/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb +306 -0
  58. data/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb +40 -0
  59. data/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb +242 -0
  60. data/lib/bandwidth-sdk/version.rb +1 -1
  61. data/lib/bandwidth-sdk.rb +25 -0
  62. data/openapi-config.yml +1 -1
  63. data/spec/call_utils.rb +2 -2
  64. data/spec/smoke/toll_free_verification_api_spec.rb +69 -0
  65. data/spec/spec_helper.rb +1 -1
  66. data/spec/unit/api/mfa_api_spec.rb +1 -1
  67. data/spec/unit/api/toll_free_verification_api_spec.rb +278 -0
  68. data/spec/unit/client/api_client_spec.rb +1 -1
  69. metadata +100 -46
@@ -0,0 +1,265 @@
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
+ class OptInWorkflow
18
+ attr_accessor :description
19
+
20
+ attr_accessor :image_urls
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'description' => :'description',
26
+ :'image_urls' => :'imageUrls'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'description' => :'String',
39
+ :'image_urls' => :'Array<String>'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::OptInWorkflow` initialize method'
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::OptInWorkflow`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'description')
65
+ self.description = attributes[:'description']
66
+ else
67
+ self.description = nil
68
+ end
69
+
70
+ if attributes.key?(:'image_urls')
71
+ if (value = attributes[:'image_urls']).is_a?(Array)
72
+ self.image_urls = value
73
+ end
74
+ else
75
+ self.image_urls = nil
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
83
+ invalid_properties = Array.new
84
+ if @description.nil?
85
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
86
+ end
87
+
88
+ if @description.to_s.length > 500
89
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 500.')
90
+ end
91
+
92
+ if @description.to_s.length < 1
93
+ invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.')
94
+ end
95
+
96
+ if @image_urls.nil?
97
+ invalid_properties.push('invalid value for "image_urls", image_urls cannot be nil.')
98
+ end
99
+
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ warn '[DEPRECATED] the `valid?` method is obsolete'
107
+ return false if @description.nil?
108
+ return false if @description.to_s.length > 500
109
+ return false if @description.to_s.length < 1
110
+ return false if @image_urls.nil?
111
+ true
112
+ end
113
+
114
+ # Custom attribute writer method with validation
115
+ # @param [Object] description Value to be assigned
116
+ def description=(description)
117
+ if description.nil?
118
+ fail ArgumentError, 'description cannot be nil'
119
+ end
120
+
121
+ if description.to_s.length > 500
122
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 500.'
123
+ end
124
+
125
+ if description.to_s.length < 1
126
+ fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.'
127
+ end
128
+
129
+ @description = description
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ description == o.description &&
138
+ image_urls == o.image_urls
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Integer] Hash code
149
+ def hash
150
+ [description, image_urls].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def self.build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ attributes = attributes.transform_keys(&:to_sym)
159
+ transformed_hash = {}
160
+ openapi_types.each_pair do |key, type|
161
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = nil
163
+ elsif type =~ /\AArray<(.*)>/i
164
+ # check to ensure the input is an array given that the attribute
165
+ # is documented as an array but the input is not
166
+ if attributes[attribute_map[key]].is_a?(Array)
167
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
168
+ end
169
+ elsif !attributes[attribute_map[key]].nil?
170
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
171
+ end
172
+ end
173
+ new(transformed_hash)
174
+ end
175
+
176
+ # Deserializes the data based on type
177
+ # @param string type Data type
178
+ # @param string value Value to be deserialized
179
+ # @return [Object] Deserialized data
180
+ def self._deserialize(type, value)
181
+ case type.to_sym
182
+ when :Time
183
+ Time.parse(value)
184
+ when :Date
185
+ Date.parse(value)
186
+ when :String
187
+ value.to_s
188
+ when :Integer
189
+ value.to_i
190
+ when :Float
191
+ value.to_f
192
+ when :Boolean
193
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
194
+ true
195
+ else
196
+ false
197
+ end
198
+ when :Object
199
+ # generic object (usually a Hash), return directly
200
+ value
201
+ when /\AArray<(?<inner_type>.+)>\z/
202
+ inner_type = Regexp.last_match[:inner_type]
203
+ value.map { |v| _deserialize(inner_type, v) }
204
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
205
+ k_type = Regexp.last_match[:k_type]
206
+ v_type = Regexp.last_match[:v_type]
207
+ {}.tap do |hash|
208
+ value.each do |k, v|
209
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
210
+ end
211
+ end
212
+ else # model
213
+ # models (e.g. Pet) or oneOf
214
+ klass = Bandwidth.const_get(type)
215
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
216
+ end
217
+ end
218
+
219
+ # Returns the string representation of the object
220
+ # @return [String] String presentation of the object
221
+ def to_s
222
+ to_hash.to_s
223
+ end
224
+
225
+ # to_body is an alias to to_hash (backward compatibility)
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_body
228
+ to_hash
229
+ end
230
+
231
+ # Returns the object in the form of hash
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_hash
234
+ hash = {}
235
+ self.class.attribute_map.each_pair do |attr, param|
236
+ value = self.send(attr)
237
+ if value.nil?
238
+ is_nullable = self.class.openapi_nullable.include?(attr)
239
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
240
+ end
241
+
242
+ hash[param] = _to_hash(value)
243
+ end
244
+ hash
245
+ end
246
+
247
+ # Outputs non-array value in the form of hash
248
+ # For object, use to_hash. Otherwise, just return the value
249
+ # @param [Object] value Any valid value
250
+ # @return [Hash] Returns the value in the form of hash
251
+ def _to_hash(value)
252
+ if value.is_a?(Array)
253
+ value.compact.map { |v| _to_hash(v) }
254
+ elsif value.is_a?(Hash)
255
+ {}.tap do |hash|
256
+ value.each { |k, v| hash[k] = _to_hash(v) }
257
+ end
258
+ elsif value.respond_to? :to_hash
259
+ value.to_hash
260
+ else
261
+ value
262
+ end
263
+ end
264
+ end
265
+ end
@@ -0,0 +1,213 @@
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
+ class TelephoneNumber
18
+ # Simple Telephone Number.
19
+ attr_accessor :telephone_number
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'telephone_number' => :'telephoneNumber'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'telephone_number' => :'String'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TelephoneNumber` initialize method'
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TelephoneNumber`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'telephone_number')
62
+ self.telephone_number = attributes[:'telephone_number']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ warn '[DEPRECATED] the `valid?` method is obsolete'
78
+ true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ telephone_number == o.telephone_number
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Integer] Hash code
97
+ def hash
98
+ [telephone_number].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def self.build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ attributes = attributes.transform_keys(&:to_sym)
107
+ transformed_hash = {}
108
+ openapi_types.each_pair do |key, type|
109
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
110
+ transformed_hash["#{key}"] = nil
111
+ elsif type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[attribute_map[key]].is_a?(Array)
115
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
116
+ end
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
119
+ end
120
+ end
121
+ new(transformed_hash)
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def self._deserialize(type, value)
129
+ case type.to_sym
130
+ when :Time
131
+ Time.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :Boolean
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ # models (e.g. Pet) or oneOf
162
+ klass = Bandwidth.const_get(type)
163
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ if value.nil?
186
+ is_nullable = self.class.openapi_nullable.include?(attr)
187
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
+ end
189
+
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+ end
213
+ end