Class: OFX::Data::Banking::BankAccount

Inherits:
Object
  • Object
show all
Defined in:
lib/ofx/data/banking/bank_account.rb

Constant Summary collapse

VALID_TYPES =
[:checking, :savings, :money_market, :credit_line]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ BankAccount

Returns a new instance of BankAccount.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ofx/data/banking/bank_account.rb', line 8

def initialize(opts)
  @bank_id = opts.fetch(:bank_id)
  raise ArgumentError, ":bank_id must be 1-9 characters long" if @bank_id.length > 9
  @branch_id = opts.fetch(:branch_id, "")
  raise ArgumentError, ":branch_id must be 1-22 characters long" if @branch_id.length > 22
  @account_id = opts.fetch(:account_id)
  raise ArgumentError, ":account_id must be 1-22 characters long" if @account_id.length > 22
  @account_type = opts.fetch(:account_type)
  raise ArgumentError, ":account_type must be one of #{VALID_TYPES.inspect}, it was #{@account_type.inspect}" if !VALID_TYPES.include?(@account_type)
  @account_key = opts.fetch(:account_key, "")
  raise ArgumentError, ":account_key must be 1-22 characters long" if @account_key.length > 22
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



6
7
8
# File 'lib/ofx/data/banking/bank_account.rb', line 6

def 
  @account_id
end

#account_keyObject (readonly)

Returns the value of attribute account_key.



6
7
8
# File 'lib/ofx/data/banking/bank_account.rb', line 6

def 
  @account_key
end

#account_typeObject (readonly)

Returns the value of attribute account_type.



6
7
8
# File 'lib/ofx/data/banking/bank_account.rb', line 6

def 
  @account_type
end

#bank_idObject (readonly)

Returns the value of attribute bank_id.



6
7
8
# File 'lib/ofx/data/banking/bank_account.rb', line 6

def bank_id
  @bank_id
end

#branch_idObject (readonly)

Returns the value of attribute branch_id.



6
7
8
# File 'lib/ofx/data/banking/bank_account.rb', line 6

def branch_id
  @branch_id
end

Instance Method Details

#fitid_strObject



21
22
23
24
25
26
27
# File 'lib/ofx/data/banking/bank_account.rb', line 21

def fitid_str
  [
    :bank_id, :branch_id, :account_id, :account_type, :account_key
  ].map { |meth|
    send(meth)
  }.join("")
end

#ofx_typeObject



29
30
31
# File 'lib/ofx/data/banking/bank_account.rb', line 29

def ofx_type
  :"banking.bank_account"
end