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.

Attributes

account_holder_name[R]
account_number_ending[R]
account_type[R]
bank_name[R]
country_code[R]
created_at[R]
currency[R]
enabled[R]
id[R]
metadata[R]

Public Class Methods

new(object, response = nil) click to toggle source

Initialize a customer_bank_account resource instance @param object [Hash] an object returned from the API

# File lib/gocardless_pro/resources/customer_bank_account.rb, line 39
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_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

Public Instance Methods

api_response() click to toggle source
# File lib/gocardless_pro/resources/customer_bank_account.rb, line 56
def api_response
  ApiResponse.new(@response)
end
to_h() click to toggle source

Provides the customer_bank_account resource as a hash of all its readable attributes

# File lib/gocardless_pro/resources/customer_bank_account.rb, line 66
def to_h
  @object
end