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,342 @@
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 TfvStatus
18
+ # Toll-free telephone number in E.164 format.
19
+ attr_accessor :phone_number
20
+
21
+ attr_accessor :status
22
+
23
+ # Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads.
24
+ attr_accessor :internal_ticket_number
25
+
26
+ # Explanation for why a verification request was declined.
27
+ attr_accessor :decline_reason_description
28
+
29
+ # Whether a Toll-Free Verification request qualifies for resubmission via PUT.
30
+ attr_accessor :resubmit_allowed
31
+
32
+ # Date and time the verification request was created.
33
+ attr_accessor :created_date_time
34
+
35
+ # Date and time the verification request was last modified.
36
+ attr_accessor :modified_date_time
37
+
38
+ attr_accessor :submission
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'phone_number' => :'phoneNumber',
66
+ :'status' => :'status',
67
+ :'internal_ticket_number' => :'internalTicketNumber',
68
+ :'decline_reason_description' => :'declineReasonDescription',
69
+ :'resubmit_allowed' => :'resubmitAllowed',
70
+ :'created_date_time' => :'createdDateTime',
71
+ :'modified_date_time' => :'modifiedDateTime',
72
+ :'submission' => :'submission'
73
+ }
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'phone_number' => :'String',
85
+ :'status' => :'TfvStatusEnum',
86
+ :'internal_ticket_number' => :'String',
87
+ :'decline_reason_description' => :'String',
88
+ :'resubmit_allowed' => :'Boolean',
89
+ :'created_date_time' => :'Time',
90
+ :'modified_date_time' => :'Time',
91
+ :'submission' => :'TfvSubmissionInfo'
92
+ }
93
+ end
94
+
95
+ # List of attributes with nullable: true
96
+ def self.openapi_nullable
97
+ Set.new([
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvStatus` initialize method'
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'phone_number')
117
+ self.phone_number = attributes[:'phone_number']
118
+ end
119
+
120
+ if attributes.key?(:'status')
121
+ self.status = attributes[:'status']
122
+ end
123
+
124
+ if attributes.key?(:'internal_ticket_number')
125
+ self.internal_ticket_number = attributes[:'internal_ticket_number']
126
+ end
127
+
128
+ if attributes.key?(:'decline_reason_description')
129
+ self.decline_reason_description = attributes[:'decline_reason_description']
130
+ end
131
+
132
+ if attributes.key?(:'resubmit_allowed')
133
+ self.resubmit_allowed = attributes[:'resubmit_allowed']
134
+ end
135
+
136
+ if attributes.key?(:'created_date_time')
137
+ self.created_date_time = attributes[:'created_date_time']
138
+ end
139
+
140
+ if attributes.key?(:'modified_date_time')
141
+ self.modified_date_time = attributes[:'modified_date_time']
142
+ end
143
+
144
+ if attributes.key?(:'submission')
145
+ self.submission = attributes[:'submission']
146
+ end
147
+ end
148
+
149
+ # Show invalid properties with the reasons. Usually used together with valid?
150
+ # @return Array for valid properties with the reasons
151
+ def list_invalid_properties
152
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
153
+ invalid_properties = Array.new
154
+ if !@phone_number.nil? && @phone_number.to_s.length > 12
155
+ invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.')
156
+ end
157
+
158
+ if !@phone_number.nil? && @phone_number.to_s.length < 12
159
+ invalid_properties.push('invalid value for "phone_number", the character length must be great than or equal to 12.')
160
+ end
161
+
162
+ pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
163
+ if !@phone_number.nil? && @phone_number !~ pattern
164
+ invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
165
+ end
166
+
167
+ invalid_properties
168
+ end
169
+
170
+ # Check to see if the all the properties in the model are valid
171
+ # @return true if the model is valid
172
+ def valid?
173
+ warn '[DEPRECATED] the `valid?` method is obsolete'
174
+ return false if !@phone_number.nil? && @phone_number.to_s.length > 12
175
+ return false if !@phone_number.nil? && @phone_number.to_s.length < 12
176
+ return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
177
+ true
178
+ end
179
+
180
+ # Custom attribute writer method with validation
181
+ # @param [Object] phone_number Value to be assigned
182
+ def phone_number=(phone_number)
183
+ if phone_number.nil?
184
+ fail ArgumentError, 'phone_number cannot be nil'
185
+ end
186
+
187
+ if phone_number.to_s.length > 12
188
+ fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.'
189
+ end
190
+
191
+ if phone_number.to_s.length < 12
192
+ fail ArgumentError, 'invalid value for "phone_number", the character length must be great than or equal to 12.'
193
+ end
194
+
195
+ pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
196
+ if phone_number !~ pattern
197
+ fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}."
198
+ end
199
+
200
+ @phone_number = phone_number
201
+ end
202
+
203
+ # Checks equality by comparing each attribute.
204
+ # @param [Object] Object to be compared
205
+ def ==(o)
206
+ return true if self.equal?(o)
207
+ self.class == o.class &&
208
+ phone_number == o.phone_number &&
209
+ status == o.status &&
210
+ internal_ticket_number == o.internal_ticket_number &&
211
+ decline_reason_description == o.decline_reason_description &&
212
+ resubmit_allowed == o.resubmit_allowed &&
213
+ created_date_time == o.created_date_time &&
214
+ modified_date_time == o.modified_date_time &&
215
+ submission == o.submission
216
+ end
217
+
218
+ # @see the `==` method
219
+ # @param [Object] Object to be compared
220
+ def eql?(o)
221
+ self == o
222
+ end
223
+
224
+ # Calculates hash code according to all attributes.
225
+ # @return [Integer] Hash code
226
+ def hash
227
+ [phone_number, status, internal_ticket_number, decline_reason_description, resubmit_allowed, created_date_time, modified_date_time, submission].hash
228
+ end
229
+
230
+ # Builds the object from hash
231
+ # @param [Hash] attributes Model attributes in the form of hash
232
+ # @return [Object] Returns the model itself
233
+ def self.build_from_hash(attributes)
234
+ return nil unless attributes.is_a?(Hash)
235
+ attributes = attributes.transform_keys(&:to_sym)
236
+ transformed_hash = {}
237
+ openapi_types.each_pair do |key, type|
238
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
239
+ transformed_hash["#{key}"] = nil
240
+ elsif type =~ /\AArray<(.*)>/i
241
+ # check to ensure the input is an array given that the attribute
242
+ # is documented as an array but the input is not
243
+ if attributes[attribute_map[key]].is_a?(Array)
244
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
245
+ end
246
+ elsif !attributes[attribute_map[key]].nil?
247
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
248
+ end
249
+ end
250
+ new(transformed_hash)
251
+ end
252
+
253
+ # Deserializes the data based on type
254
+ # @param string type Data type
255
+ # @param string value Value to be deserialized
256
+ # @return [Object] Deserialized data
257
+ def self._deserialize(type, value)
258
+ case type.to_sym
259
+ when :Time
260
+ Time.parse(value)
261
+ when :Date
262
+ Date.parse(value)
263
+ when :String
264
+ value.to_s
265
+ when :Integer
266
+ value.to_i
267
+ when :Float
268
+ value.to_f
269
+ when :Boolean
270
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
271
+ true
272
+ else
273
+ false
274
+ end
275
+ when :Object
276
+ # generic object (usually a Hash), return directly
277
+ value
278
+ when /\AArray<(?<inner_type>.+)>\z/
279
+ inner_type = Regexp.last_match[:inner_type]
280
+ value.map { |v| _deserialize(inner_type, v) }
281
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
282
+ k_type = Regexp.last_match[:k_type]
283
+ v_type = Regexp.last_match[:v_type]
284
+ {}.tap do |hash|
285
+ value.each do |k, v|
286
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
287
+ end
288
+ end
289
+ else # model
290
+ # models (e.g. Pet) or oneOf
291
+ klass = Bandwidth.const_get(type)
292
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
293
+ end
294
+ end
295
+
296
+ # Returns the string representation of the object
297
+ # @return [String] String presentation of the object
298
+ def to_s
299
+ to_hash.to_s
300
+ end
301
+
302
+ # to_body is an alias to to_hash (backward compatibility)
303
+ # @return [Hash] Returns the object in the form of hash
304
+ def to_body
305
+ to_hash
306
+ end
307
+
308
+ # Returns the object in the form of hash
309
+ # @return [Hash] Returns the object in the form of hash
310
+ def to_hash
311
+ hash = {}
312
+ self.class.attribute_map.each_pair do |attr, param|
313
+ value = self.send(attr)
314
+ if value.nil?
315
+ is_nullable = self.class.openapi_nullable.include?(attr)
316
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
317
+ end
318
+
319
+ hash[param] = _to_hash(value)
320
+ end
321
+ hash
322
+ end
323
+
324
+ # Outputs non-array value in the form of hash
325
+ # For object, use to_hash. Otherwise, just return the value
326
+ # @param [Object] value Any valid value
327
+ # @return [Hash] Returns the value in the form of hash
328
+ def _to_hash(value)
329
+ if value.is_a?(Array)
330
+ value.compact.map { |v| _to_hash(v) }
331
+ elsif value.is_a?(Hash)
332
+ {}.tap do |hash|
333
+ value.each { |k, v| hash[k] = _to_hash(v) }
334
+ end
335
+ elsif value.respond_to? :to_hash
336
+ value.to_hash
337
+ else
338
+ value
339
+ end
340
+ end
341
+ end
342
+ end
@@ -0,0 +1,43 @@
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 TfvStatusEnum
18
+ VERIFIED = 'VERIFIED'.freeze
19
+ UNVERIFIED = 'UNVERIFIED'.freeze
20
+ PENDING = 'PENDING'.freeze
21
+ PARTIALLY_VERIFIED = 'PARTIALLY_VERIFIED'.freeze
22
+ INVALID_STATUS = 'INVALID_STATUS'.freeze
23
+
24
+ def self.all_vars
25
+ @all_vars ||= [VERIFIED, UNVERIFIED, PENDING, PARTIALLY_VERIFIED, INVALID_STATUS].freeze
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def self.build_from_hash(value)
32
+ new.build_from_hash(value)
33
+ end
34
+
35
+ # Builds the enum from string
36
+ # @param [String] The enum value in the form of the string
37
+ # @return [String] The enum value
38
+ def build_from_hash(value)
39
+ return value if TfvStatusEnum.all_vars.include?(value)
40
+ raise "Invalid ENUM value #{value} for class #TfvStatusEnum"
41
+ end
42
+ end
43
+ end