Class: Square::BankAccountsApi
- Defined in:
- lib/square/api/bank_accounts_api.rb
Overview
BankAccountsApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#get_bank_account(bank_account_id:) ⇒ GetBankAccountResponse Hash
Returns details of a [BankAccount]($m/BankAccount) linked to a Square account.
-
#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.
-
#initialize(config, http_call_back: nil) ⇒ BankAccountsApi
constructor
A new instance of BankAccountsApi.
-
#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.
Methods inherited from BaseApi
#execute_request, #get_user_agent, #validate_parameters, #validate_parameters_types
Constructor Details
#initialize(config, http_call_back: nil) ⇒ BankAccountsApi
Returns a new instance of BankAccountsApi.
4 5 6 |
# File 'lib/square/api/bank_accounts_api.rb', line 4 def initialize(config, http_call_back: nil) super(config, http_call_back: http_call_back) end |
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`.
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 |
# File 'lib/square/api/bank_accounts_api.rb', line 102 def get_bank_account(bank_account_id:) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bank-accounts/{bank_account_id}' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'bank_account_id' => { 'value' => bank_account_id, 'encode' => true } ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) 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).
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/square/api/bank_accounts_api.rb', line 66 def get_bank_account_by_v1_id(v1_bank_account_id:) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bank-accounts/by-v1-id/{v1_bank_account_id}' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'v1_bank_account_id' => { 'value' => v1_bank_account_id, 'encode' => true } ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) 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.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/square/api/bank_accounts_api.rb', line 23 def list_bank_accounts(cursor: nil, limit: nil, location_id: nil) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/bank-accounts' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, 'cursor' => cursor, 'limit' => limit, 'location_id' => location_id ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |