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

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



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

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

  @transactions = []

  yield self if block_given?
end

Instance Attribute Details

#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

#process_atObject

Returns the value of attribute process_at.



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

def process_at
  @process_at
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

#add_transaction(transaction) ⇒ Object



40
41
42
# File 'lib/aba.rb', line 40

def add_transaction(transaction)
  @transactions << transaction
end

#to_sObject



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

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