Class: Ach::FileControlRecord
- Inherits:
-
Object
- Object
- Ach::FileControlRecord
- Defined in:
- lib/ach/parser.rb,
lib/ach/creator.rb
Instance Attribute Summary collapse
-
#batch_count ⇒ Object
Returns the value of attribute batch_count.
-
#block_count ⇒ Object
Returns the value of attribute block_count.
-
#entry_addenda ⇒ Object
Returns the value of attribute entry_addenda.
-
#entry_hash_total ⇒ Object
Returns the value of attribute entry_hash_total.
-
#record_type ⇒ Object
Returns the value of attribute record_type.
-
#total_credits ⇒ Object
Returns the value of attribute total_credits.
-
#total_debits ⇒ Object
Returns the value of attribute total_debits.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ FileControlRecord
constructor
A new instance of FileControlRecord.
Constructor Details
#initialize(options = {}) ⇒ FileControlRecord
Returns a new instance of FileControlRecord.
436 437 438 439 440 441 442 443 444 445 446 |
# File 'lib/ach/creator.rb', line 436 def initialize(={}) @record_type = '9' @batch_count = [:batch_count] @block_count = [:block_count] @entry_addenda = [:entry_addenda] @entry_hash_total = [:entry_hash_total] @total_debits = [:total_debits] @total_credits = [:total_credits] @write_to_file = [:write_to_file] encode end |
Instance Attribute Details
#batch_count ⇒ Object
Returns the value of attribute batch_count.
434 435 436 |
# File 'lib/ach/creator.rb', line 434 def batch_count @batch_count end |
#block_count ⇒ Object
Returns the value of attribute block_count.
434 435 436 |
# File 'lib/ach/creator.rb', line 434 def block_count @block_count end |
#entry_addenda ⇒ Object
Returns the value of attribute entry_addenda.
434 435 436 |
# File 'lib/ach/creator.rb', line 434 def entry_addenda @entry_addenda end |
#entry_hash_total ⇒ Object
Returns the value of attribute entry_hash_total.
435 436 437 |
# File 'lib/ach/creator.rb', line 435 def entry_hash_total @entry_hash_total end |
#record_type ⇒ Object
Returns the value of attribute record_type.
434 435 436 |
# File 'lib/ach/creator.rb', line 434 def record_type @record_type end |
#total_credits ⇒ Object
Returns the value of attribute total_credits.
435 436 437 |
# File 'lib/ach/creator.rb', line 435 def total_credits @total_credits end |
#total_debits ⇒ Object
Returns the value of attribute total_debits.
435 436 437 |
# File 'lib/ach/creator.rb', line 435 def total_debits @total_debits end |
Class Method Details
.decode(record, processor) ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/ach/parser.rb', line 106 def self.decode(record) fcr = {} msg_codes = [] msg_codes << record[56,2] unless record[56,2].match(/\s/) msg_codes << record [58,2] unless record[58,2].match(/\s/) msg_codes << record[60,2] unless record[60,2].match(/\s/) fcr[:record_type] = record[0].chr fcr[:batch_count] = record[1,6] fcr[:block_count] = record[7,6] fcr[:entry_addenda_record_count] = record[13,8] fcr[:entry_hash_total] = record[21,10] fcr[:total_file_debit_entry_amount] = record[31,12] fcr[:total_file_credit_entry_amount] = record[43,12] fcr[:message_codes] = msg_codes unless msg_codes.empty? return fcr end |