class Headache::Record::Entry

Attributes

account_number[RW]
amount[RW]
batch[RW]
check_digit[RW]
discretionary[RW]
document[RW]
individual_name[RW]
internal_id[RW]
routing_identification[RW]
routing_number[RW]
trace_number[RW]
transaction_code[RW]

Public Class Methods

new(batch = nil, document = nil) click to toggle source
# File lib/headache/record/entry.rb, line 55
def initialize(batch = nil, document = nil)
  @batch    = batch
  @document = document
end

Public Instance Methods

assemble_routing_number() click to toggle source
# File lib/headache/record/entry.rb, line 28
def assemble_routing_number
  if @routing_identification.present? && @check_digit.present?
    @routing_number = "#{@routing_identification}#{@check_digit}"
  end
end
check_digit=(value) click to toggle source
# File lib/headache/record/entry.rb, line 11
def check_digit=(value)
  rval = (@check_digit = value)
  assemble_routing_number
  rval
end
generate(*args) click to toggle source
Calls superclass method
# File lib/headache/record/entry.rb, line 17
def generate(*args)
  fail ArgumentError, 'transaction_code cannot be blank' unless transaction_code.present?
  super(*args)
end
routing_identification=(value) click to toggle source
# File lib/headache/record/entry.rb, line 22
def routing_identification=(value)
  rval = (@routing_identification = value)
  assemble_routing_number
  rval
end
to_h() click to toggle source
Calls superclass method Headache::Record::Base#to_h
# File lib/headache/record/entry.rb, line 34
def to_h
  new_hsh = {}
  super.each_pair do |key, value|
    next if key == :check_digit
    if key == :routing_identification
      key   = :routing_number
      value = @routing_number
    end
    new_hsh[key] = value
  end
  new_hsh
end