Class: Aba

Inherits:
Object
  • Object
show all
Includes:
Validations
Defined in:
lib/aba.rb,
lib/aba/version.rb,
lib/aba/transaction.rb,
lib/aba/validations.rb

Defined Under Namespace

Modules: Validations Classes: Transaction

Constant Summary collapse

VERSION =
"0.1.0"

Instance Attribute Summary collapse

Attributes included from Validations

#errors

Instance Method Summary collapse

Methods included from Validations

included, #valid?

Constructor Details

#initialize(attrs = {}) {|_self| ... } ⇒ Aba

Returns a new instance of Aba.

Yields:

  • (_self)

Yield Parameters:

  • _self (Aba)

    the object that the method was called on



21
22
23
24
25
26
27
28
29
# File 'lib/aba.rb', line 21

def initialize(attrs = {})
  attrs.each do |key, value|
    send("#{key}=", value)
  end

  self.transactions = []

  yield self if block_given?
end

Instance Attribute Details

#account_numberObject

Returns the value of attribute account_number.



8
9
10
# File 'lib/aba.rb', line 8

def 
  @account_number
end

#bsbObject

Returns the value of attribute bsb.



8
9
10
# File 'lib/aba.rb', line 8

def bsb
  @bsb
end

#descriptionObject

Returns the value of attribute description.



8
9
10
# File 'lib/aba.rb', line 8

def description
  @description
end

#financial_institutionObject

Returns the value of attribute financial_institution.



8
9
10
# File 'lib/aba.rb', line 8

def financial_institution
  @financial_institution
end

#name_of_remitterObject

Returns the value of attribute name_of_remitter.



8
9
10
# File 'lib/aba.rb', line 8

def name_of_remitter
  @name_of_remitter
end

#process_atObject

Returns the value of attribute process_at.



8
9
10
# File 'lib/aba.rb', line 8

def process_at
  @process_at
end

#transactionsObject

Returns the value of attribute transactions.



8
9
10
# File 'lib/aba.rb', line 8

def transactions
  @transactions
end

#user_idObject

Returns the value of attribute user_id.



8
9
10
# File 'lib/aba.rb', line 8

def user_id
  @user_id
end

#user_nameObject

Returns the value of attribute user_name.



8
9
10
# File 'lib/aba.rb', line 8

def user_name
  @user_name
end

Instance Method Details

#to_sObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/aba.rb', line 31

def to_s
  # Descriptive record
  output = "#{descriptive_record}\r\n"
  
  # Transactions records
  output += @transactions.map{ |t| t.to_s }.join("\r\n")

  # Batch control record
  output += "\r\n#{batch_control_record}"
end