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.0.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

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_number ⇒ Object

Returns the value of attribute account_number.



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

def 
  @account_number
end

#bsb ⇒ Object

Returns the value of attribute bsb.



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

def bsb
  @bsb
end

#description ⇒ Object

Returns the value of attribute description.



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

def description
  @description
end

#financial_institution ⇒ Object

Returns the value of attribute financial_institution.



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

def financial_institution
  @financial_institution
end

#name_of_remitter ⇒ Object

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_at ⇒ Object

Returns the value of attribute process_at.



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

def process_at
  @process_at
end

#transactions ⇒ Object

Returns the value of attribute transactions.



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

def transactions
  @transactions
end

#user_id ⇒ Object

Returns the value of attribute user_id.



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

def user_id
  @user_id
end

#user_name ⇒ Object

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_s ⇒ Object



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