Class: Plaid::Network::Client
- Inherits:
-
Object
- Object
- Plaid::Network::Client
- Defined in:
- lib/plaid/network/client.rb
Instance Method Summary collapse
-
#get_status(request_options: {}, **params) ⇒ Plaid::Types::NetworkStatusGetResponse
The
/network/status/getendpoint can be used to check whether Plaid has a matching profile for the user. - #initialize(client:) ⇒ void constructor
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/plaid/network/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#get_status(request_options: {}, **params) ⇒ Plaid::Types::NetworkStatusGetResponse
The /network/status/get endpoint can be used to check whether Plaid has a matching profile for the user.
This is useful for determining if a user is eligible for a streamlined experience, such as Layer. To access this
endpoint, contact your Plaid account manager.
Note: it is strongly recommended to check for Layer eligibility in the frontend. /network/status/get should
only be used for checking Layer eligibility if a frontend check is not possible for your use case.
For instructions on performing a frontend eligibility check, see the Layer
documentation.
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 68 69 70 |
# File 'lib/plaid/network/client.rb', line 36 def get_status(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "network/status/get", body: Plaid::Network::Types::NetworkStatusGetRequest.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::NetworkStatusGetResponse.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 |