Class: Plaid::AccountsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/plaid/apis/accounts_api.rb

Overview

AccountsApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Plaid::BaseApi

Instance Method Details

#accounts_balance_get(body) ⇒ ApiResponse

The ‘/accounts/balance/get` endpoint returns the real-time balance for each of an Item’s accounts. While other endpoints may return a balance object, only ‘/accounts/balance/get` forces the available and current balance fields to be refreshed rather than cached. This endpoint can be used for existing Items that were added via any of Plaid’s other products. This endpoint can be used as long as Link has been initialized with any other product, `balance` itself is not a product that can be used to initialize Link. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/plaid/apis/accounts_api.rb', line 52

def accounts_balance_get(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/accounts/balance/get',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AccountsGetResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#accounts_get(body) ⇒ ApiResponse

The ‘/accounts/get` endpoint can be used to retrieve information for any linked Item. Note that some information is nullable. Plaid will only return active bank accounts, i.e. accounts that are not closed and are capable of carrying a balance. This endpoint retrieves cached information, rather than extracting fresh information from the institution. As a result, balances returned may not be up-to-date; for realtime balance information, use `/accounts/balance/get` instead. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/plaid/apis/accounts_api.rb', line 20

def accounts_get(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/accounts/get',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('PLAID-CLIENT-ID', 'PLAID-SECRET', 'Plaid-Version')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AccountsGetResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response.',
                             ErrorErrorException))
    .execute
end