class GoCardlessPro::Resources::CustomerBankAccount
Customer
Bank Accounts hold the bank details of a [customer](core-endpoints-customers). They always belong to a [customer](core-endpoints-customers), and may be linked to several Direct Debit [mandates](core-endpoints-mandates).
Note that customer bank accounts must be unique, and so you will encounter a ‘bank_account_exists` error if you try to create a duplicate bank account. You may wish to handle this by updating the existing record instead, the ID of which will be provided as `links` in the error response.
Note: To ensure the customer’s bank accounts are valid, verify them first using
[bank_details_lookups](bank-details-lookups-perform-a-bank-details-lookup), before proceeding with creating the accounts
Attributes
Public Class Methods
Source
# File lib/gocardless_pro/resources/customer_bank_account.rb, line 36 def initialize(object, response = nil) @object = object @account_holder_name = object['account_holder_name'] @account_number_ending = object['account_number_ending'] @account_type = object['account_type'] @bank_account_token = object['bank_account_token'] @bank_name = object['bank_name'] @country_code = object['country_code'] @created_at = object['created_at'] @currency = object['currency'] @enabled = object['enabled'] @id = object['id'] @links = object['links'] @metadata = object['metadata'] @response = response end
Initialize a customer_bank_account resource instance @param object [Hash] an object returned from the API
Public Instance Methods
Source
# File lib/gocardless_pro/resources/customer_bank_account.rb, line 54 def api_response ApiResponse.new(@response) end
Source
# File lib/gocardless_pro/resources/customer_bank_account.rb, line 59 def links @customer_bank_account_links ||= Links.new(@links) end
Return the links that the resource has
Source
# File lib/gocardless_pro/resources/customer_bank_account.rb, line 64 def to_h @object end
Provides the customer_bank_account resource as a hash of all its readable attributes