Class: ACH::Records::EntryDetail
- Defined in:
- lib/ach/records/entry_detail.rb
Overview
PPD Entry Detail. Some other entry details, such as CCD, are close enough to use this class. Version 1.x will have support for other types.
Direct Known Subclasses
Constant Summary collapse
- CREDIT_RECORD_TRANSACTION_CODE_ENDING_DIGITS =
["0", "1", "2", "3", "4"]
Constants included from FieldIdentifiers
FieldIdentifiers::ENCODING_OPTIONS
Instance Attribute Summary collapse
-
#addenda ⇒ Object
readonly
Returns the value of attribute addenda.
-
#sorter ⇒ Object
Returns the value of attribute sorter.
Attributes inherited from Record
Instance Method Summary collapse
- #addenda_records? ⇒ Boolean
- #amount_value ⇒ Object
- #credit? ⇒ Boolean
- #debit? ⇒ Boolean
-
#initialize ⇒ EntryDetail
constructor
A new instance of EntryDetail.
-
#records_count ⇒ Integer
Length of addenda plus 1, used by Batch#entry_count.
- #to_ach(eol: ACH.eol) ⇒ Object
Methods inherited from Record
Methods included from FieldIdentifiers
#const_field, #field, #left_justify, #spaceless_routing_field
Constructor Details
#initialize ⇒ EntryDetail
Returns a new instance of EntryDetail.
37 38 39 |
# File 'lib/ach/records/entry_detail.rb', line 37 def initialize @addenda = [] end |
Instance Attribute Details
#addenda ⇒ Object (readonly)
Returns the value of attribute addenda.
35 36 37 |
# File 'lib/ach/records/entry_detail.rb', line 35 def addenda @addenda end |
#sorter ⇒ Object
Returns the value of attribute sorter.
9 10 11 |
# File 'lib/ach/records/entry_detail.rb', line 9 def sorter @sorter end |
Instance Method Details
#addenda_records? ⇒ Boolean
53 54 55 |
# File 'lib/ach/records/entry_detail.rb', line 53 def addenda_records? return !self.addenda.empty? end |
#amount_value ⇒ Object
49 50 51 |
# File 'lib/ach/records/entry_detail.rb', line 49 def amount_value return self.amount end |
#credit? ⇒ Boolean
41 42 43 |
# File 'lib/ach/records/entry_detail.rb', line 41 def credit? CREDIT_RECORD_TRANSACTION_CODE_ENDING_DIGITS.include?(@transaction_code[1..1]) end |
#debit? ⇒ Boolean
45 46 47 |
# File 'lib/ach/records/entry_detail.rb', line 45 def debit? !credit? end |
#records_count ⇒ Integer
Returns Length of addenda plus 1, used by Batch#entry_count.
71 72 73 |
# File 'lib/ach/records/entry_detail.rb', line 71 def records_count 1 + self.addenda.length end |
#to_ach(eol: ACH.eol) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/ach/records/entry_detail.rb', line 57 def to_ach eol: ACH.eol self.addenda_record_indicator = (self.addenda.empty? ? 0 : 1) if self.respond_to?(:addenda_record_indicator) self.number_of_addenda_records = self.addenda.length if self.respond_to?(:number_of_addenda_records) ach_string = super self.addenda.each {|a| a.entry_detail_sequence_number = self.trace_number ach_string << eol + a.to_ach } return ach_string end |