Class: PaymentsApi::BankAccount

Inherits:
BaseModel show all
Defined in:
lib/payments_api/models/bank_account.rb

Overview

Bank Account Information Object.NOTE - originatorBankAccount bank data should not be provided when creating a new Payment. This information is retrieved from the database based on the provided bank ID.NOTE - bank object is required for all BankAccount objects except originatorBankAccount

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(account_number = nil, bank = nil) ⇒ BankAccount

Returns a new instance of BankAccount.



29
30
31
32
33
# File 'lib/payments_api/models/bank_account.rb', line 29

def initialize( = nil,
               bank = nil)
  @account_number = 
  @bank = bank
end

Instance Attribute Details

#account_numberString

Bank Account Number / IBAN. Required for Beneficiary Bank. Optional for Intermediary Bank.

Returns:

  • (String)


15
16
17
# File 'lib/payments_api/models/bank_account.rb', line 15

def 
  @account_number
end

#bankBank

Bank Information Object

Returns:



19
20
21
# File 'lib/payments_api/models/bank_account.rb', line 19

def bank
  @bank
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/payments_api/models/bank_account.rb', line 36

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash['accountNumber']
  bank = Bank.from_hash(hash['bank']) if hash['bank']

  # Create object from extracted values.
  BankAccount.new(,
                  bank)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/payments_api/models/bank_account.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_number'] = 'accountNumber'
  @_hash['bank'] = 'bank'
  @_hash
end