Class: Plaid::Identity::Verification::Client
- Inherits:
-
Object
- Object
- Plaid::Identity::Verification::Client
- Defined in:
- lib/plaid/identity/verification/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Plaid::Types::IdentityVerificationCreateResponse
Create a new Identity Verification for the user specified by the
client_user_idand/oruser_idfield. -
#create_autofill(request_options: {}, **params) ⇒ Plaid::Types::IdentityVerificationAutofillCreateResponse
Try to autofill an Identity Verification based on the provided phone number, date of birth and country of residence.
-
#get(request_options: {}, **params) ⇒ Plaid::Types::IdentityVerificationGetResponse
Retrieve a previously created Identity Verification.
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Plaid::Internal::CursorItemIterator
Filter and list Identity Verifications created by your account.
-
#retry_(request_options: {}, **params) ⇒ Plaid::Types::IdentityVerificationRetryResponse
Allow a customer to retry their Identity Verification.
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/plaid/identity/verification/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Plaid::Types::IdentityVerificationCreateResponse
Create a new Identity Verification for the user specified by the client_user_id and/or user_id field. At
least one of these two fields must be provided. The requirements and behavior of the verification are
determined by the template_id provided. If user_id is provided, there must be an associated user;
otherwise, an error will be returned.
If you don't know whether an active Identity Verification exists for a given client_user_id and/or
user_id, you can specify "is_idempotent": true in the request body. With idempotency enabled, a new
Identity Verification will only be created if one does not already exist for the associated client_user_id
and/or user_id, and template_id. If an Identity Verification is found, it will be returned unmodified with
a 200 OK HTTP status code.
If user_id is not provided, you can also use this endpoint to supply information you already have collected
about the user; if any of these fields are specified, the screens prompting the user to enter them will be
skipped during the Link flow. If user_id is provided, user information can not be included in the request
body. Please use the /user/update endpoint to update user data instead.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/plaid/identity/verification/client.rb', line 48 def create(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "identity_verification/create", body: Plaid::Identity::Verification::Types::IdentityVerificationCreateRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::IdentityVerificationCreateResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#create_autofill(request_options: {}, **params) ⇒ Plaid::Types::IdentityVerificationAutofillCreateResponse
Try to autofill an Identity Verification based on the provided phone number, date of birth and country of residence.
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/plaid/identity/verification/client.rb', line 268 def create_autofill(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "identity_verification/autofill/create", body: Plaid::Identity::Verification::Types::IdentityVerificationAutofillCreateRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::IdentityVerificationAutofillCreateResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#get(request_options: {}, **params) ⇒ Plaid::Types::IdentityVerificationGetResponse
Retrieve a previously created Identity Verification.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/plaid/identity/verification/client.rb', line 98 def get(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "identity_verification/get", body: Plaid::Identity::Verification::Types::IdentityVerificationGetRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::IdentityVerificationGetResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#list(request_options: {}, **params) ⇒ Plaid::Internal::CursorItemIterator
Filter and list Identity Verifications created by your account
Returns a Plaid::Internal::CursorItemIterator that yields each Plaid::Types::IdentityVerification in the
identity_verifications field of every page, requesting pages as they are needed. Call pages on it to get
each page as a Plaid::Types::IdentityVerificationListResponse, including its other fields.
No request is sent by this call. The first page is requested when you start iterating (or call
load_first_page), so an API error is raised by the loop (or by load_first_page), not by this call.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/plaid/identity/verification/client.rb', line 155 def list(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) Plaid::Internal::CursorItemIterator.new( cursor_field: :next_cursor, item_field: :identity_verifications, initial_cursor: params[:cursor] ) do |next_cursor| params[:cursor] = next_cursor request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "identity_verification/list", body: Plaid::Identity::Verification::Types::IdentityVerificationListRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin parsed_response = (response.body.to_s.empty? ? nil : Plaid::Types::IdentityVerificationListResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end [parsed_response, response] else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end end |
#retry_(request_options: {}, **params) ⇒ Plaid::Types::IdentityVerificationRetryResponse
Allow a customer to retry their Identity Verification
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/plaid/identity/verification/client.rb', line 217 def retry_(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "identity_verification/retry", body: Plaid::Identity::Verification::Types::IdentityVerificationRetryRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::IdentityVerificationRetryResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |