zernio-sdk 0.0.537 → 0.0.539

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -0
  3. data/docs/CheckVerification200Response.md +40 -0
  4. data/docs/CheckVerificationRequest.md +18 -0
  5. data/docs/CreateVerificationRequest.md +28 -0
  6. data/docs/OnVerificationApprovedRequest.md +24 -0
  7. data/docs/OnVerificationApprovedRequestVerification.md +22 -0
  8. data/docs/OnVerificationFailedRequest.md +26 -0
  9. data/docs/OnVerificationFailedRequestVerification.md +22 -0
  10. data/docs/Verification.md +38 -0
  11. data/docs/VerifyApi.md +219 -0
  12. data/docs/WebhookEventsApi.md +138 -0
  13. data/lib/zernio-sdk/api/verify_api.rb +227 -0
  14. data/lib/zernio-sdk/api/webhook_events_api.rb +132 -0
  15. data/lib/zernio-sdk/models/check_verification200_response.rb +301 -0
  16. data/lib/zernio-sdk/models/check_verification_request.rb +175 -0
  17. data/lib/zernio-sdk/models/create_verification_request.rb +333 -0
  18. data/lib/zernio-sdk/models/on_verification_approved_request.rb +208 -0
  19. data/lib/zernio-sdk/models/on_verification_approved_request_verification.rb +199 -0
  20. data/lib/zernio-sdk/models/on_verification_failed_request.rb +229 -0
  21. data/lib/zernio-sdk/models/on_verification_failed_request_verification.rb +199 -0
  22. data/lib/zernio-sdk/models/on_whats_app_number_kyc_submitted_request.rb +2 -2
  23. data/lib/zernio-sdk/models/verification.rb +287 -0
  24. data/lib/zernio-sdk/version.rb +1 -1
  25. data/lib/zernio-sdk.rb +9 -0
  26. data/openapi.yaml +205 -5
  27. data/spec/api/verify_api_spec.rb +72 -0
  28. data/spec/models/check_verification200_response_spec.rb +110 -0
  29. data/spec/models/check_verification_request_spec.rb +36 -0
  30. data/spec/models/create_verification_request_spec.rb +70 -0
  31. data/spec/models/create_webhook_settings_request_spec.rb +1 -1
  32. data/spec/models/on_verification_approved_request_spec.rb +58 -0
  33. data/spec/models/on_verification_approved_request_verification_spec.rb +52 -0
  34. data/spec/models/on_verification_failed_request_spec.rb +68 -0
  35. data/spec/models/on_verification_failed_request_verification_spec.rb +52 -0
  36. data/spec/models/on_whats_app_number_kyc_submitted_request_spec.rb +1 -1
  37. data/spec/models/update_webhook_settings_request_spec.rb +1 -1
  38. data/spec/models/verification_spec.rb +104 -0
  39. data/spec/models/webhook_spec.rb +1 -1
  40. metadata +37 -1
@@ -0,0 +1,227 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Zernio
16
+ class VerifyApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Check a verification code
23
+ # Verify the code the user typed. Wrong, expired, and exhausted codes answer 200 with `valid: false` and the settled `status` — only an unknown id is a 404. A correct code consumes the verification (single-use, `status: approved`) and fires the `verification.approved` webhook; the 5th wrong attempt settles it as `max_attempts_reached` and fires `verification.failed`.
24
+ # @param verification_id [String]
25
+ # @param check_verification_request [CheckVerificationRequest]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [CheckVerification200Response]
28
+ def check_verification(verification_id, check_verification_request, opts = {})
29
+ data, _status_code, _headers = check_verification_with_http_info(verification_id, check_verification_request, opts)
30
+ data
31
+ end
32
+
33
+ # Check a verification code
34
+ # Verify the code the user typed. Wrong, expired, and exhausted codes answer 200 with `valid: false` and the settled `status` — only an unknown id is a 404. A correct code consumes the verification (single-use, `status: approved`) and fires the `verification.approved` webhook; the 5th wrong attempt settles it as `max_attempts_reached` and fires `verification.failed`.
35
+ # @param verification_id [String]
36
+ # @param check_verification_request [CheckVerificationRequest]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(CheckVerification200Response, Integer, Hash)>] CheckVerification200Response data, response status code and response headers
39
+ def check_verification_with_http_info(verification_id, check_verification_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: VerifyApi.check_verification ...'
42
+ end
43
+ # verify the required parameter 'verification_id' is set
44
+ if @api_client.config.client_side_validation && verification_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'verification_id' when calling VerifyApi.check_verification"
46
+ end
47
+ # verify the required parameter 'check_verification_request' is set
48
+ if @api_client.config.client_side_validation && check_verification_request.nil?
49
+ fail ArgumentError, "Missing the required parameter 'check_verification_request' when calling VerifyApi.check_verification"
50
+ end
51
+ # resource path
52
+ local_var_path = '/v1/verify/verifications/{verificationId}/check'.sub('{' + 'verificationId' + '}', CGI.escape(verification_id.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
61
+ # HTTP header 'Content-Type'
62
+ content_type = @api_client.select_header_content_type(['application/json'])
63
+ if !content_type.nil?
64
+ header_params['Content-Type'] = content_type
65
+ end
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(check_verification_request)
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'CheckVerification200Response'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"VerifyApi.check_verification",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: VerifyApi#check_verification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+
96
+ # Send a verification code
97
+ # Generate a one-time code, deliver it to the recipient, and store only its hash. Check the user-typed code with POST /v1/verify/verifications/{verificationId}/check. Re-POSTing for the same (channel, to) while a verification is active RESENDS a fresh code on the existing verification (200 with `resend: true`) instead of creating a new one; resends are limited to one per 60 seconds (429 with `retryAfterSeconds` inside the cooldown). The stored brandName/codeLength/ttlMinutes win on a resend. Codes deliver by SMS from a phone number on your account (`from` optional when you own exactly one SMS-enabled number) and the message uses a fixed template. Each accepted send bills one verification fee plus the standard message rate.
98
+ # @param create_verification_request [CreateVerificationRequest]
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [Verification]
101
+ def create_verification(create_verification_request, opts = {})
102
+ data, _status_code, _headers = create_verification_with_http_info(create_verification_request, opts)
103
+ data
104
+ end
105
+
106
+ # Send a verification code
107
+ # Generate a one-time code, deliver it to the recipient, and store only its hash. Check the user-typed code with POST /v1/verify/verifications/{verificationId}/check. Re-POSTing for the same (channel, to) while a verification is active RESENDS a fresh code on the existing verification (200 with &#x60;resend: true&#x60;) instead of creating a new one; resends are limited to one per 60 seconds (429 with &#x60;retryAfterSeconds&#x60; inside the cooldown). The stored brandName/codeLength/ttlMinutes win on a resend. Codes deliver by SMS from a phone number on your account (&#x60;from&#x60; optional when you own exactly one SMS-enabled number) and the message uses a fixed template. Each accepted send bills one verification fee plus the standard message rate.
108
+ # @param create_verification_request [CreateVerificationRequest]
109
+ # @param [Hash] opts the optional parameters
110
+ # @return [Array<(Verification, Integer, Hash)>] Verification data, response status code and response headers
111
+ def create_verification_with_http_info(create_verification_request, opts = {})
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug 'Calling API: VerifyApi.create_verification ...'
114
+ end
115
+ # verify the required parameter 'create_verification_request' is set
116
+ if @api_client.config.client_side_validation && create_verification_request.nil?
117
+ fail ArgumentError, "Missing the required parameter 'create_verification_request' when calling VerifyApi.create_verification"
118
+ end
119
+ # resource path
120
+ local_var_path = '/v1/verify/verifications'
121
+
122
+ # query parameters
123
+ query_params = opts[:query_params] || {}
124
+
125
+ # header parameters
126
+ header_params = opts[:header_params] || {}
127
+ # HTTP header 'Accept' (if needed)
128
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
129
+ # HTTP header 'Content-Type'
130
+ content_type = @api_client.select_header_content_type(['application/json'])
131
+ if !content_type.nil?
132
+ header_params['Content-Type'] = content_type
133
+ end
134
+
135
+ # form parameters
136
+ form_params = opts[:form_params] || {}
137
+
138
+ # http body (model)
139
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_verification_request)
140
+
141
+ # return_type
142
+ return_type = opts[:debug_return_type] || 'Verification'
143
+
144
+ # auth_names
145
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
146
+
147
+ new_options = opts.merge(
148
+ :operation => :"VerifyApi.create_verification",
149
+ :header_params => header_params,
150
+ :query_params => query_params,
151
+ :form_params => form_params,
152
+ :body => post_body,
153
+ :auth_names => auth_names,
154
+ :return_type => return_type
155
+ )
156
+
157
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
158
+ if @api_client.config.debugging
159
+ @api_client.config.logger.debug "API called: VerifyApi#create_verification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
160
+ end
161
+ return data, status_code, headers
162
+ end
163
+
164
+ # Get a verification
165
+ # Current state of a verification. `status` is effective (a pending code past its expiry reads as `expired`). Verification records are deleted 24 hours after creation, after which this returns 404.
166
+ # @param verification_id [String]
167
+ # @param [Hash] opts the optional parameters
168
+ # @return [Verification]
169
+ def get_verification(verification_id, opts = {})
170
+ data, _status_code, _headers = get_verification_with_http_info(verification_id, opts)
171
+ data
172
+ end
173
+
174
+ # Get a verification
175
+ # Current state of a verification. &#x60;status&#x60; is effective (a pending code past its expiry reads as &#x60;expired&#x60;). Verification records are deleted 24 hours after creation, after which this returns 404.
176
+ # @param verification_id [String]
177
+ # @param [Hash] opts the optional parameters
178
+ # @return [Array<(Verification, Integer, Hash)>] Verification data, response status code and response headers
179
+ def get_verification_with_http_info(verification_id, opts = {})
180
+ if @api_client.config.debugging
181
+ @api_client.config.logger.debug 'Calling API: VerifyApi.get_verification ...'
182
+ end
183
+ # verify the required parameter 'verification_id' is set
184
+ if @api_client.config.client_side_validation && verification_id.nil?
185
+ fail ArgumentError, "Missing the required parameter 'verification_id' when calling VerifyApi.get_verification"
186
+ end
187
+ # resource path
188
+ local_var_path = '/v1/verify/verifications/{verificationId}'.sub('{' + 'verificationId' + '}', CGI.escape(verification_id.to_s))
189
+
190
+ # query parameters
191
+ query_params = opts[:query_params] || {}
192
+
193
+ # header parameters
194
+ header_params = opts[:header_params] || {}
195
+ # HTTP header 'Accept' (if needed)
196
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
197
+
198
+ # form parameters
199
+ form_params = opts[:form_params] || {}
200
+
201
+ # http body (model)
202
+ post_body = opts[:debug_body]
203
+
204
+ # return_type
205
+ return_type = opts[:debug_return_type] || 'Verification'
206
+
207
+ # auth_names
208
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
209
+
210
+ new_options = opts.merge(
211
+ :operation => :"VerifyApi.get_verification",
212
+ :header_params => header_params,
213
+ :query_params => query_params,
214
+ :form_params => form_params,
215
+ :body => post_body,
216
+ :auth_names => auth_names,
217
+ :return_type => return_type
218
+ )
219
+
220
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
221
+ if @api_client.config.debugging
222
+ @api_client.config.logger.debug "API called: VerifyApi#get_verification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
223
+ end
224
+ return data, status_code, headers
225
+ end
226
+ end
227
+ end
@@ -2197,6 +2197,138 @@ module Zernio
2197
2197
  return data, status_code, headers
2198
2198
  end
2199
2199
 
2200
+ # Verification approved event
2201
+ # Fired when a managed-OTP verification is approved (the user submitted the correct code to POST /v1/verify/verifications/{verificationId}/check).
2202
+ # @param on_verification_approved_request [OnVerificationApprovedRequest]
2203
+ # @param [Hash] opts the optional parameters
2204
+ # @return [nil]
2205
+ def on_verification_approved(on_verification_approved_request, opts = {})
2206
+ on_verification_approved_with_http_info(on_verification_approved_request, opts)
2207
+ nil
2208
+ end
2209
+
2210
+ # Verification approved event
2211
+ # Fired when a managed-OTP verification is approved (the user submitted the correct code to POST /v1/verify/verifications/{verificationId}/check).
2212
+ # @param on_verification_approved_request [OnVerificationApprovedRequest]
2213
+ # @param [Hash] opts the optional parameters
2214
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
2215
+ def on_verification_approved_with_http_info(on_verification_approved_request, opts = {})
2216
+ if @api_client.config.debugging
2217
+ @api_client.config.logger.debug 'Calling API: WebhookEventsApi.on_verification_approved ...'
2218
+ end
2219
+ # verify the required parameter 'on_verification_approved_request' is set
2220
+ if @api_client.config.client_side_validation && on_verification_approved_request.nil?
2221
+ fail ArgumentError, "Missing the required parameter 'on_verification_approved_request' when calling WebhookEventsApi.on_verification_approved"
2222
+ end
2223
+ # resource path
2224
+ local_var_path = '/verification.approved'
2225
+
2226
+ # query parameters
2227
+ query_params = opts[:query_params] || {}
2228
+
2229
+ # header parameters
2230
+ header_params = opts[:header_params] || {}
2231
+ # HTTP header 'Content-Type'
2232
+ content_type = @api_client.select_header_content_type(['application/json'])
2233
+ if !content_type.nil?
2234
+ header_params['Content-Type'] = content_type
2235
+ end
2236
+
2237
+ # form parameters
2238
+ form_params = opts[:form_params] || {}
2239
+
2240
+ # http body (model)
2241
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(on_verification_approved_request)
2242
+
2243
+ # return_type
2244
+ return_type = opts[:debug_return_type]
2245
+
2246
+ # auth_names
2247
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
2248
+
2249
+ new_options = opts.merge(
2250
+ :operation => :"WebhookEventsApi.on_verification_approved",
2251
+ :header_params => header_params,
2252
+ :query_params => query_params,
2253
+ :form_params => form_params,
2254
+ :body => post_body,
2255
+ :auth_names => auth_names,
2256
+ :return_type => return_type
2257
+ )
2258
+
2259
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
2260
+ if @api_client.config.debugging
2261
+ @api_client.config.logger.debug "API called: WebhookEventsApi#on_verification_approved\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2262
+ end
2263
+ return data, status_code, headers
2264
+ end
2265
+
2266
+ # Verification failed event
2267
+ # Fired when a managed-OTP verification is exhausted (the maximum number of wrong code attempts was reached).
2268
+ # @param on_verification_failed_request [OnVerificationFailedRequest]
2269
+ # @param [Hash] opts the optional parameters
2270
+ # @return [nil]
2271
+ def on_verification_failed(on_verification_failed_request, opts = {})
2272
+ on_verification_failed_with_http_info(on_verification_failed_request, opts)
2273
+ nil
2274
+ end
2275
+
2276
+ # Verification failed event
2277
+ # Fired when a managed-OTP verification is exhausted (the maximum number of wrong code attempts was reached).
2278
+ # @param on_verification_failed_request [OnVerificationFailedRequest]
2279
+ # @param [Hash] opts the optional parameters
2280
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
2281
+ def on_verification_failed_with_http_info(on_verification_failed_request, opts = {})
2282
+ if @api_client.config.debugging
2283
+ @api_client.config.logger.debug 'Calling API: WebhookEventsApi.on_verification_failed ...'
2284
+ end
2285
+ # verify the required parameter 'on_verification_failed_request' is set
2286
+ if @api_client.config.client_side_validation && on_verification_failed_request.nil?
2287
+ fail ArgumentError, "Missing the required parameter 'on_verification_failed_request' when calling WebhookEventsApi.on_verification_failed"
2288
+ end
2289
+ # resource path
2290
+ local_var_path = '/verification.failed'
2291
+
2292
+ # query parameters
2293
+ query_params = opts[:query_params] || {}
2294
+
2295
+ # header parameters
2296
+ header_params = opts[:header_params] || {}
2297
+ # HTTP header 'Content-Type'
2298
+ content_type = @api_client.select_header_content_type(['application/json'])
2299
+ if !content_type.nil?
2300
+ header_params['Content-Type'] = content_type
2301
+ end
2302
+
2303
+ # form parameters
2304
+ form_params = opts[:form_params] || {}
2305
+
2306
+ # http body (model)
2307
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(on_verification_failed_request)
2308
+
2309
+ # return_type
2310
+ return_type = opts[:debug_return_type]
2311
+
2312
+ # auth_names
2313
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
2314
+
2315
+ new_options = opts.merge(
2316
+ :operation => :"WebhookEventsApi.on_verification_failed",
2317
+ :header_params => header_params,
2318
+ :query_params => query_params,
2319
+ :form_params => form_params,
2320
+ :body => post_body,
2321
+ :auth_names => auth_names,
2322
+ :return_type => return_type
2323
+ )
2324
+
2325
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
2326
+ if @api_client.config.debugging
2327
+ @api_client.config.logger.debug "API called: WebhookEventsApi#on_verification_failed\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2328
+ end
2329
+ return data, status_code, headers
2330
+ end
2331
+
2200
2332
  # Webhook test event
2201
2333
  # Fired when sending a test webhook to verify the endpoint configuration.
2202
2334
  # @param webhook_payload_test [WebhookPayloadTest]
@@ -0,0 +1,301 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class CheckVerification200Response < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :status
21
+
22
+ attr_accessor :channel
23
+
24
+ attr_accessor :to
25
+
26
+ attr_accessor :expires_at
27
+
28
+ attr_accessor :attempts
29
+
30
+ attr_accessor :max_attempts
31
+
32
+ # Accepted deliveries (initial send + resends); each bills one verification fee.
33
+ attr_accessor :send_count
34
+
35
+ attr_accessor :last_sent_at
36
+
37
+ attr_accessor :created_at
38
+
39
+ # Present on create responses: true when an active verification was resent instead of created.
40
+ attr_accessor :resend
41
+
42
+ attr_accessor :valid
43
+
44
+ class EnumAttributeValidator
45
+ attr_reader :datatype
46
+ attr_reader :allowable_values
47
+
48
+ def initialize(datatype, allowable_values)
49
+ @allowable_values = allowable_values.map do |value|
50
+ case datatype.to_s
51
+ when /Integer/i
52
+ value.to_i
53
+ when /Float/i
54
+ value.to_f
55
+ else
56
+ value
57
+ end
58
+ end
59
+ end
60
+
61
+ def valid?(value)
62
+ !value || allowable_values.include?(value)
63
+ end
64
+ end
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ :'id' => :'id',
70
+ :'status' => :'status',
71
+ :'channel' => :'channel',
72
+ :'to' => :'to',
73
+ :'expires_at' => :'expiresAt',
74
+ :'attempts' => :'attempts',
75
+ :'max_attempts' => :'maxAttempts',
76
+ :'send_count' => :'sendCount',
77
+ :'last_sent_at' => :'lastSentAt',
78
+ :'created_at' => :'createdAt',
79
+ :'resend' => :'resend',
80
+ :'valid' => :'valid'
81
+ }
82
+ end
83
+
84
+ # Returns attribute mapping this model knows about
85
+ def self.acceptable_attribute_map
86
+ attribute_map
87
+ end
88
+
89
+ # Returns all the JSON keys this model knows about
90
+ def self.acceptable_attributes
91
+ acceptable_attribute_map.values
92
+ end
93
+
94
+ # Attribute type mapping.
95
+ def self.openapi_types
96
+ {
97
+ :'id' => :'String',
98
+ :'status' => :'String',
99
+ :'channel' => :'String',
100
+ :'to' => :'String',
101
+ :'expires_at' => :'Time',
102
+ :'attempts' => :'Integer',
103
+ :'max_attempts' => :'Integer',
104
+ :'send_count' => :'Integer',
105
+ :'last_sent_at' => :'Time',
106
+ :'created_at' => :'Time',
107
+ :'resend' => :'Boolean',
108
+ :'valid' => :'Boolean'
109
+ }
110
+ end
111
+
112
+ # List of attributes with nullable: true
113
+ def self.openapi_nullable
114
+ Set.new([
115
+ ])
116
+ end
117
+
118
+ # List of class defined in allOf (OpenAPI v3)
119
+ def self.openapi_all_of
120
+ [
121
+ :'Verification'
122
+ ]
123
+ end
124
+
125
+ # Initializes the object
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ def initialize(attributes = {})
128
+ if (!attributes.is_a?(Hash))
129
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CheckVerification200Response` initialize method"
130
+ end
131
+
132
+ # check to see if the attribute exists and convert string to symbol for hash key
133
+ acceptable_attribute_map = self.class.acceptable_attribute_map
134
+ attributes = attributes.each_with_object({}) { |(k, v), h|
135
+ if (!acceptable_attribute_map.key?(k.to_sym))
136
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CheckVerification200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
137
+ end
138
+ h[k.to_sym] = v
139
+ }
140
+
141
+ if attributes.key?(:'id')
142
+ self.id = attributes[:'id']
143
+ end
144
+
145
+ if attributes.key?(:'status')
146
+ self.status = attributes[:'status']
147
+ end
148
+
149
+ if attributes.key?(:'channel')
150
+ self.channel = attributes[:'channel']
151
+ end
152
+
153
+ if attributes.key?(:'to')
154
+ self.to = attributes[:'to']
155
+ end
156
+
157
+ if attributes.key?(:'expires_at')
158
+ self.expires_at = attributes[:'expires_at']
159
+ end
160
+
161
+ if attributes.key?(:'attempts')
162
+ self.attempts = attributes[:'attempts']
163
+ end
164
+
165
+ if attributes.key?(:'max_attempts')
166
+ self.max_attempts = attributes[:'max_attempts']
167
+ end
168
+
169
+ if attributes.key?(:'send_count')
170
+ self.send_count = attributes[:'send_count']
171
+ end
172
+
173
+ if attributes.key?(:'last_sent_at')
174
+ self.last_sent_at = attributes[:'last_sent_at']
175
+ end
176
+
177
+ if attributes.key?(:'created_at')
178
+ self.created_at = attributes[:'created_at']
179
+ end
180
+
181
+ if attributes.key?(:'resend')
182
+ self.resend = attributes[:'resend']
183
+ end
184
+
185
+ if attributes.key?(:'valid')
186
+ self.valid = attributes[:'valid']
187
+ end
188
+ end
189
+
190
+ # Show invalid properties with the reasons. Usually used together with valid?
191
+ # @return Array for valid properties with the reasons
192
+ def list_invalid_properties
193
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
194
+ invalid_properties = Array.new
195
+ invalid_properties
196
+ end
197
+
198
+ # Check to see if the all the properties in the model are valid
199
+ # @return true if the model is valid
200
+ def valid?
201
+ warn '[DEPRECATED] the `valid?` method is obsolete'
202
+ status_validator = EnumAttributeValidator.new('String', ["pending", "approved", "expired", "max_attempts_reached", "canceled", "delivery_failed"])
203
+ return false unless status_validator.valid?(@status)
204
+ channel_validator = EnumAttributeValidator.new('String', ["sms"])
205
+ return false unless channel_validator.valid?(@channel)
206
+ true
207
+ end
208
+
209
+ # Custom attribute writer method checking allowed values (enum).
210
+ # @param [Object] status Object to be assigned
211
+ def status=(status)
212
+ validator = EnumAttributeValidator.new('String', ["pending", "approved", "expired", "max_attempts_reached", "canceled", "delivery_failed"])
213
+ unless validator.valid?(status)
214
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
215
+ end
216
+ @status = status
217
+ end
218
+
219
+ # Custom attribute writer method checking allowed values (enum).
220
+ # @param [Object] channel Object to be assigned
221
+ def channel=(channel)
222
+ validator = EnumAttributeValidator.new('String', ["sms"])
223
+ unless validator.valid?(channel)
224
+ fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}."
225
+ end
226
+ @channel = channel
227
+ end
228
+
229
+ # Checks equality by comparing each attribute.
230
+ # @param [Object] Object to be compared
231
+ def ==(o)
232
+ return true if self.equal?(o)
233
+ self.class == o.class &&
234
+ id == o.id &&
235
+ status == o.status &&
236
+ channel == o.channel &&
237
+ to == o.to &&
238
+ expires_at == o.expires_at &&
239
+ attempts == o.attempts &&
240
+ max_attempts == o.max_attempts &&
241
+ send_count == o.send_count &&
242
+ last_sent_at == o.last_sent_at &&
243
+ created_at == o.created_at &&
244
+ resend == o.resend &&
245
+ valid == o.valid
246
+ end
247
+
248
+ # @see the `==` method
249
+ # @param [Object] Object to be compared
250
+ def eql?(o)
251
+ self == o
252
+ end
253
+
254
+ # Calculates hash code according to all attributes.
255
+ # @return [Integer] Hash code
256
+ def hash
257
+ [id, status, channel, to, expires_at, attempts, max_attempts, send_count, last_sent_at, created_at, resend, valid].hash
258
+ end
259
+
260
+ # Builds the object from hash
261
+ # @param [Hash] attributes Model attributes in the form of hash
262
+ # @return [Object] Returns the model itself
263
+ def self.build_from_hash(attributes)
264
+ return nil unless attributes.is_a?(Hash)
265
+ attributes = attributes.transform_keys(&:to_sym)
266
+ transformed_hash = {}
267
+ openapi_types.each_pair do |key, type|
268
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
269
+ transformed_hash["#{key}"] = nil
270
+ elsif type =~ /\AArray<(.*)>/i
271
+ # check to ensure the input is an array given that the attribute
272
+ # is documented as an array but the input is not
273
+ if attributes[attribute_map[key]].is_a?(Array)
274
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
275
+ end
276
+ elsif !attributes[attribute_map[key]].nil?
277
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
278
+ end
279
+ end
280
+ new(transformed_hash)
281
+ end
282
+
283
+ # Returns the object in the form of hash
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_hash
286
+ hash = {}
287
+ self.class.attribute_map.each_pair do |attr, param|
288
+ value = self.send(attr)
289
+ if value.nil?
290
+ is_nullable = self.class.openapi_nullable.include?(attr)
291
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
292
+ end
293
+
294
+ hash[param] = _to_hash(value)
295
+ end
296
+ hash
297
+ end
298
+
299
+ end
300
+
301
+ end