Class: Plaid::Auth::Client
- Inherits:
-
Object
- Object
- Plaid::Auth::Client
- Defined in:
- lib/plaid/auth/client.rb
Instance Method Summary collapse
-
#get(request_options: {}, **params) ⇒ Plaid::Types::AuthGetResponse
The
/auth/getendpoint returns the bank account and bank identification numbers (such as routing numbers, for US accounts) associated with an Item's checking, savings, and cash management accounts, along with high-level account data and balances when available. - #initialize(client:) ⇒ void constructor
-
#verify(request_options: {}, **params) ⇒ Plaid::Types::AuthVerifyResponse
The
/auth/verifyendpoint verifies bank account and routing numbers and (optionally) account owner names against Plaid's database via Database Auth.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/plaid/auth/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#get(request_options: {}, **params) ⇒ Plaid::Types::AuthGetResponse
The /auth/get endpoint returns the bank account and bank identification numbers (such as routing numbers, for
US accounts) associated with an Item's checking, savings, and cash management accounts, along with high-level
account data and balances when available.
Versioning note: In API version 2017-03-08, the schema of the numbers object returned by this endpoint is
substantially different. For details, see Plaid API
versioning.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/plaid/auth/client.rb', line 33 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: "auth/get", body: Plaid::Auth::Types::AuthGetRequest.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::AuthGetResponse.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 |
#verify(request_options: {}, **params) ⇒ Plaid::Types::AuthVerifyResponse
The /auth/verify endpoint verifies bank account and routing numbers and (optionally) account owner names
against Plaid's database via Database Auth. It can be
used to verify account numbers that were not collected via the Plaid Link flow.
This endpoint is currently in Early Availability; contact sales or your Plaid account manager to request access.
92 93 94 95 96 97 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 |
# File 'lib/plaid/auth/client.rb', line 92 def verify(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "auth/verify", body: Plaid::Auth::Types::AuthVerifyRequest.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::AuthVerifyResponse.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 |