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.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -9
- data/README.md +42 -10
- data/bandwidth.yml +1102 -0
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +1204 -231
- data/coverage/index.html +20499 -10053
- data/custom_templates/README.mustache +6 -6
- data/docs/AdditionalDenialReason.md +22 -0
- data/docs/Address.md +30 -0
- data/docs/Contact.md +24 -0
- data/docs/Error.md +22 -0
- data/docs/FailureWebhook.md +28 -0
- data/docs/LinksObject.md +24 -0
- data/docs/OptInWorkflow.md +20 -0
- data/docs/TelephoneNumber.md +18 -0
- data/docs/TfvBasicAuthentication.md +20 -0
- data/docs/TfvCallbackStatusEnum.md +15 -0
- data/docs/TfvError.md +22 -0
- data/docs/TfvStatus.md +32 -0
- data/docs/TfvStatusEnum.md +15 -0
- data/docs/TfvSubmissionInfo.md +34 -0
- data/docs/TfvSubmissionWrapper.md +18 -0
- data/docs/TollFreeVerificationApi.md +585 -0
- data/docs/VerificationDenialWebhook.md +32 -0
- data/docs/VerificationRequest.md +36 -0
- data/docs/VerificationUpdateRequest.md +34 -0
- data/docs/VerificationWebhook.md +24 -0
- data/docs/WebhookSubscription.md +30 -0
- data/docs/WebhookSubscriptionBasicAuthentication.md +20 -0
- data/docs/WebhookSubscriptionRequestSchema.md +22 -0
- data/docs/WebhookSubscriptionTypeEnum.md +15 -0
- data/docs/WebhookSubscriptionsListBody.md +22 -0
- data/lib/bandwidth-sdk/api/toll_free_verification_api.rb +614 -0
- data/lib/bandwidth-sdk/configuration.rb +48 -0
- data/lib/bandwidth-sdk/models/additional_denial_reason.rb +254 -0
- data/lib/bandwidth-sdk/models/address.rb +501 -0
- data/lib/bandwidth-sdk/models/contact.rb +393 -0
- data/lib/bandwidth-sdk/models/error.rb +232 -0
- data/lib/bandwidth-sdk/models/failure_webhook.rb +304 -0
- data/lib/bandwidth-sdk/models/links_object.rb +243 -0
- data/lib/bandwidth-sdk/models/opt_in_workflow.rb +265 -0
- data/lib/bandwidth-sdk/models/telephone_number.rb +213 -0
- data/lib/bandwidth-sdk/models/tfv_basic_authentication.rb +273 -0
- data/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/tfv_error.rb +232 -0
- data/lib/bandwidth-sdk/models/tfv_status.rb +342 -0
- data/lib/bandwidth-sdk/models/tfv_status_enum.rb +43 -0
- data/lib/bandwidth-sdk/models/tfv_submission_info.rb +452 -0
- data/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb +212 -0
- data/lib/bandwidth-sdk/models/verification_denial_webhook.rb +325 -0
- data/lib/bandwidth-sdk/models/verification_request.rb +547 -0
- data/lib/bandwidth-sdk/models/verification_update_request.rb +501 -0
- data/lib/bandwidth-sdk/models/verification_webhook.rb +303 -0
- data/lib/bandwidth-sdk/models/webhook_subscription.rb +328 -0
- data/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb +274 -0
- data/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb +306 -0
- data/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb +40 -0
- data/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb +242 -0
- data/lib/bandwidth-sdk/version.rb +1 -1
- data/lib/bandwidth-sdk.rb +25 -0
- data/openapi-config.yml +1 -1
- data/spec/call_utils.rb +2 -2
- data/spec/smoke/toll_free_verification_api_spec.rb +69 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/api/mfa_api_spec.rb +1 -1
- data/spec/unit/api/toll_free_verification_api_spec.rb +278 -0
- data/spec/unit/client/api_client_spec.rb +1 -1
- metadata +100 -46
@@ -0,0 +1,325 @@
|
|
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 VerificationDenialWebhook
|
18
|
+
# User's account ID.
|
19
|
+
attr_accessor :account_id
|
20
|
+
|
21
|
+
# An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply.
|
22
|
+
attr_accessor :additional_denial_reasons
|
23
|
+
|
24
|
+
# Explanation for why a verification request was declined.
|
25
|
+
attr_accessor :decline_reason_description
|
26
|
+
|
27
|
+
# Reason code for denial.
|
28
|
+
attr_accessor :denial_status_code
|
29
|
+
|
30
|
+
# Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.
|
31
|
+
attr_accessor :internal_ticket_number
|
32
|
+
|
33
|
+
# Toll-free telephone number in E.164 format.
|
34
|
+
attr_accessor :phone_number
|
35
|
+
|
36
|
+
# Whether a Toll-Free Verification request qualifies for resubmission via PUT.
|
37
|
+
attr_accessor :resubmit_allowed
|
38
|
+
|
39
|
+
attr_accessor :status
|
40
|
+
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
42
|
+
def self.attribute_map
|
43
|
+
{
|
44
|
+
:'account_id' => :'accountId',
|
45
|
+
:'additional_denial_reasons' => :'additionalDenialReasons',
|
46
|
+
:'decline_reason_description' => :'declineReasonDescription',
|
47
|
+
:'denial_status_code' => :'denialStatusCode',
|
48
|
+
:'internal_ticket_number' => :'internalTicketNumber',
|
49
|
+
:'phone_number' => :'phoneNumber',
|
50
|
+
:'resubmit_allowed' => :'resubmitAllowed',
|
51
|
+
:'status' => :'status'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# Returns all the JSON keys this model knows about
|
56
|
+
def self.acceptable_attributes
|
57
|
+
attribute_map.values
|
58
|
+
end
|
59
|
+
|
60
|
+
# Attribute type mapping.
|
61
|
+
def self.openapi_types
|
62
|
+
{
|
63
|
+
:'account_id' => :'String',
|
64
|
+
:'additional_denial_reasons' => :'Array<AdditionalDenialReason>',
|
65
|
+
:'decline_reason_description' => :'String',
|
66
|
+
:'denial_status_code' => :'Integer',
|
67
|
+
:'internal_ticket_number' => :'String',
|
68
|
+
:'phone_number' => :'String',
|
69
|
+
:'resubmit_allowed' => :'Boolean',
|
70
|
+
:'status' => :'String'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# List of attributes with nullable: true
|
75
|
+
def self.openapi_nullable
|
76
|
+
Set.new([
|
77
|
+
])
|
78
|
+
end
|
79
|
+
|
80
|
+
# Initializes the object
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
82
|
+
def initialize(attributes = {})
|
83
|
+
if (!attributes.is_a?(Hash))
|
84
|
+
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerificationDenialWebhook` initialize method'
|
85
|
+
end
|
86
|
+
|
87
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
89
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerificationDenialWebhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
91
|
+
end
|
92
|
+
h[k.to_sym] = v
|
93
|
+
}
|
94
|
+
|
95
|
+
if attributes.key?(:'account_id')
|
96
|
+
self.account_id = attributes[:'account_id']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'additional_denial_reasons')
|
100
|
+
if (value = attributes[:'additional_denial_reasons']).is_a?(Array)
|
101
|
+
self.additional_denial_reasons = value
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'decline_reason_description')
|
106
|
+
self.decline_reason_description = attributes[:'decline_reason_description']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'denial_status_code')
|
110
|
+
self.denial_status_code = attributes[:'denial_status_code']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'internal_ticket_number')
|
114
|
+
self.internal_ticket_number = attributes[:'internal_ticket_number']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'phone_number')
|
118
|
+
self.phone_number = attributes[:'phone_number']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'resubmit_allowed')
|
122
|
+
self.resubmit_allowed = attributes[:'resubmit_allowed']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'status')
|
126
|
+
self.status = attributes[:'status']
|
127
|
+
else
|
128
|
+
self.status = 'UNVERIFIED'
|
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 !@phone_number.nil? && @phone_number.to_s.length > 12
|
138
|
+
invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.')
|
139
|
+
end
|
140
|
+
|
141
|
+
if !@phone_number.nil? && @phone_number.to_s.length < 12
|
142
|
+
invalid_properties.push('invalid value for "phone_number", the character length must be great than or equal to 12.')
|
143
|
+
end
|
144
|
+
|
145
|
+
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
|
146
|
+
if !@phone_number.nil? && @phone_number !~ pattern
|
147
|
+
invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
|
148
|
+
end
|
149
|
+
|
150
|
+
invalid_properties
|
151
|
+
end
|
152
|
+
|
153
|
+
# Check to see if the all the properties in the model are valid
|
154
|
+
# @return true if the model is valid
|
155
|
+
def valid?
|
156
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
157
|
+
return false if !@phone_number.nil? && @phone_number.to_s.length > 12
|
158
|
+
return false if !@phone_number.nil? && @phone_number.to_s.length < 12
|
159
|
+
return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
|
160
|
+
true
|
161
|
+
end
|
162
|
+
|
163
|
+
# Custom attribute writer method with validation
|
164
|
+
# @param [Object] phone_number Value to be assigned
|
165
|
+
def phone_number=(phone_number)
|
166
|
+
if phone_number.nil?
|
167
|
+
fail ArgumentError, 'phone_number cannot be nil'
|
168
|
+
end
|
169
|
+
|
170
|
+
if phone_number.to_s.length > 12
|
171
|
+
fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.'
|
172
|
+
end
|
173
|
+
|
174
|
+
if phone_number.to_s.length < 12
|
175
|
+
fail ArgumentError, 'invalid value for "phone_number", the character length must be great than or equal to 12.'
|
176
|
+
end
|
177
|
+
|
178
|
+
pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
|
179
|
+
if phone_number !~ pattern
|
180
|
+
fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}."
|
181
|
+
end
|
182
|
+
|
183
|
+
@phone_number = phone_number
|
184
|
+
end
|
185
|
+
|
186
|
+
# Checks equality by comparing each attribute.
|
187
|
+
# @param [Object] Object to be compared
|
188
|
+
def ==(o)
|
189
|
+
return true if self.equal?(o)
|
190
|
+
self.class == o.class &&
|
191
|
+
account_id == o.account_id &&
|
192
|
+
additional_denial_reasons == o.additional_denial_reasons &&
|
193
|
+
decline_reason_description == o.decline_reason_description &&
|
194
|
+
denial_status_code == o.denial_status_code &&
|
195
|
+
internal_ticket_number == o.internal_ticket_number &&
|
196
|
+
phone_number == o.phone_number &&
|
197
|
+
resubmit_allowed == o.resubmit_allowed &&
|
198
|
+
status == o.status
|
199
|
+
end
|
200
|
+
|
201
|
+
# @see the `==` method
|
202
|
+
# @param [Object] Object to be compared
|
203
|
+
def eql?(o)
|
204
|
+
self == o
|
205
|
+
end
|
206
|
+
|
207
|
+
# Calculates hash code according to all attributes.
|
208
|
+
# @return [Integer] Hash code
|
209
|
+
def hash
|
210
|
+
[account_id, additional_denial_reasons, decline_reason_description, denial_status_code, internal_ticket_number, phone_number, resubmit_allowed, status].hash
|
211
|
+
end
|
212
|
+
|
213
|
+
# Builds the object from hash
|
214
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
215
|
+
# @return [Object] Returns the model itself
|
216
|
+
def self.build_from_hash(attributes)
|
217
|
+
return nil unless attributes.is_a?(Hash)
|
218
|
+
attributes = attributes.transform_keys(&:to_sym)
|
219
|
+
transformed_hash = {}
|
220
|
+
openapi_types.each_pair do |key, type|
|
221
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
222
|
+
transformed_hash["#{key}"] = nil
|
223
|
+
elsif type =~ /\AArray<(.*)>/i
|
224
|
+
# check to ensure the input is an array given that the attribute
|
225
|
+
# is documented as an array but the input is not
|
226
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
227
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
228
|
+
end
|
229
|
+
elsif !attributes[attribute_map[key]].nil?
|
230
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
231
|
+
end
|
232
|
+
end
|
233
|
+
new(transformed_hash)
|
234
|
+
end
|
235
|
+
|
236
|
+
# Deserializes the data based on type
|
237
|
+
# @param string type Data type
|
238
|
+
# @param string value Value to be deserialized
|
239
|
+
# @return [Object] Deserialized data
|
240
|
+
def self._deserialize(type, value)
|
241
|
+
case type.to_sym
|
242
|
+
when :Time
|
243
|
+
Time.parse(value)
|
244
|
+
when :Date
|
245
|
+
Date.parse(value)
|
246
|
+
when :String
|
247
|
+
value.to_s
|
248
|
+
when :Integer
|
249
|
+
value.to_i
|
250
|
+
when :Float
|
251
|
+
value.to_f
|
252
|
+
when :Boolean
|
253
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
254
|
+
true
|
255
|
+
else
|
256
|
+
false
|
257
|
+
end
|
258
|
+
when :Object
|
259
|
+
# generic object (usually a Hash), return directly
|
260
|
+
value
|
261
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
262
|
+
inner_type = Regexp.last_match[:inner_type]
|
263
|
+
value.map { |v| _deserialize(inner_type, v) }
|
264
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
265
|
+
k_type = Regexp.last_match[:k_type]
|
266
|
+
v_type = Regexp.last_match[:v_type]
|
267
|
+
{}.tap do |hash|
|
268
|
+
value.each do |k, v|
|
269
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
else # model
|
273
|
+
# models (e.g. Pet) or oneOf
|
274
|
+
klass = Bandwidth.const_get(type)
|
275
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
# Returns the string representation of the object
|
280
|
+
# @return [String] String presentation of the object
|
281
|
+
def to_s
|
282
|
+
to_hash.to_s
|
283
|
+
end
|
284
|
+
|
285
|
+
# to_body is an alias to to_hash (backward compatibility)
|
286
|
+
# @return [Hash] Returns the object in the form of hash
|
287
|
+
def to_body
|
288
|
+
to_hash
|
289
|
+
end
|
290
|
+
|
291
|
+
# Returns the object in the form of hash
|
292
|
+
# @return [Hash] Returns the object in the form of hash
|
293
|
+
def to_hash
|
294
|
+
hash = {}
|
295
|
+
self.class.attribute_map.each_pair do |attr, param|
|
296
|
+
value = self.send(attr)
|
297
|
+
if value.nil?
|
298
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
299
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
300
|
+
end
|
301
|
+
|
302
|
+
hash[param] = _to_hash(value)
|
303
|
+
end
|
304
|
+
hash
|
305
|
+
end
|
306
|
+
|
307
|
+
# Outputs non-array value in the form of hash
|
308
|
+
# For object, use to_hash. Otherwise, just return the value
|
309
|
+
# @param [Object] value Any valid value
|
310
|
+
# @return [Hash] Returns the value in the form of hash
|
311
|
+
def _to_hash(value)
|
312
|
+
if value.is_a?(Array)
|
313
|
+
value.compact.map { |v| _to_hash(v) }
|
314
|
+
elsif value.is_a?(Hash)
|
315
|
+
{}.tap do |hash|
|
316
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
317
|
+
end
|
318
|
+
elsif value.respond_to? :to_hash
|
319
|
+
value.to_hash
|
320
|
+
else
|
321
|
+
value
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
325
|
+
end
|