Class: Square::BankAccountsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/square/api/bank_accounts_api.rb

Overview

BankAccountsApi

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

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

Constructor Details

This class inherits a constructor from Square::BaseApi

Instance Method Details

#get_bank_account(bank_account_id:) ⇒ GetBankAccountResponse Hash

Returns details of a [BankAccount]($m/BankAccount) linked to a Square account. the desired ‘BankAccount`.

Parameters:

  • bank_account_id (String)

    Required parameter: Square-issued ID of

Returns:

  • (GetBankAccountResponse Hash)

    response from the API call



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/square/api/bank_accounts_api.rb', line 67

def (bank_account_id:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/bank-accounts/{bank_account_id}',
                                 'default')
               .template_param(new_parameter(, key: 'bank_account_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#get_bank_account_by_v1_id(v1_bank_account_id:) ⇒ GetBankAccountByV1IdResponse Hash

Returns details of a [BankAccount]($m/BankAccount) identified by V1 bank account ID. the desired ‘BankAccount`. For more information, see [Retrieve a bank account by using an ID issued by V1 Bank Accounts API](developer.squareup.com/docs/bank-accounts-api#retrieve-a-bank -account-by-using-an-id-issued-by-v1-bank-accounts-api).

Parameters:

  • v1_bank_account_id (String)

    Required parameter: Connect V1 ID of

Returns:

  • (GetBankAccountByV1IdResponse Hash)

    response from the API call



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/square/api/bank_accounts_api.rb', line 46

def (v1_bank_account_id:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/bank-accounts/by-v1-id/{v1_bank_account_id}',
                                 'default')
               .template_param(new_parameter(, key: 'v1_bank_account_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#list_bank_accounts(cursor: nil, limit: nil, location_id: nil) ⇒ ListBankAccountsResponse Hash

Returns a list of [BankAccount]($m/BankAccount) objects linked to a Square account. by a previous call to this endpoint. Use it in the next ‘ListBankAccounts` request to retrieve the next set of results. See the [Pagination](developer.squareup.com/docs/working-with-apis/paginat ion) guide for more information. bank accounts to return in the response. Currently, 1000 is the largest supported limit. You can specify a limit of up to 1000 bank accounts. This is also the default limit. specify this optional filter to retrieve only the linked bank accounts belonging to a specific location.

Parameters:

  • cursor (String) (defaults to: nil)

    Optional parameter: The pagination cursor returned

  • limit (Integer) (defaults to: nil)

    Optional parameter: Upper limit on the number of

  • location_id (String) (defaults to: nil)

    Optional parameter: Location ID. You can

Returns:

  • (ListBankAccountsResponse Hash)

    response from the API call



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/square/api/bank_accounts_api.rb', line 19

def list_bank_accounts(cursor: nil,
                       limit: nil,
                       location_id: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/bank-accounts',
                                 'default')
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(location_id, key: 'location_id'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end