Class: Headache::Record::Entry
- Includes:
- Definition::Entry
- Defined in:
- lib/headache/record/entry.rb
Instance Attribute Summary collapse
-
#account_number ⇒ Object
Returns the value of attribute account_number.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#batch ⇒ Object
Returns the value of attribute batch.
-
#check_digit ⇒ Object
Returns the value of attribute check_digit.
-
#discretionary ⇒ Object
Returns the value of attribute discretionary.
-
#document ⇒ Object
Returns the value of attribute document.
-
#individual_name ⇒ Object
Returns the value of attribute individual_name.
-
#internal_id ⇒ Object
Returns the value of attribute internal_id.
-
#routing_identification ⇒ Object
Returns the value of attribute routing_identification.
-
#routing_number ⇒ Object
Returns the value of attribute routing_number.
-
#trace_number ⇒ Object
Returns the value of attribute trace_number.
-
#transaction_code ⇒ Object
Returns the value of attribute transaction_code.
Instance Method Summary collapse
- #assemble_routing_number ⇒ Object
- #generate(*args) ⇒ Object
-
#initialize(batch = nil, document = nil) ⇒ Entry
constructor
A new instance of Entry.
- #to_h ⇒ Object
Methods inherited from Base
fields, #normalize_field_value, normalize_field_value, #parse, parse_fields, #parse_fields, parse_fields_normalize
Constructor Details
#initialize(batch = nil, document = nil) ⇒ Entry
Returns a new instance of Entry.
55 56 57 58 |
# File 'lib/headache/record/entry.rb', line 55 def initialize(batch = nil, document = nil) @batch = batch @document = document end |
Instance Attribute Details
#account_number ⇒ Object
Returns the value of attribute account_number.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def account_number @account_number end |
#amount ⇒ Object
Returns the value of attribute amount.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def amount @amount end |
#batch ⇒ Object
Returns the value of attribute batch.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def batch @batch end |
#check_digit ⇒ Object
Returns the value of attribute check_digit.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def check_digit @check_digit end |
#discretionary ⇒ Object
Returns the value of attribute discretionary.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def discretionary @discretionary end |
#document ⇒ Object
Returns the value of attribute document.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def document @document end |
#individual_name ⇒ Object
Returns the value of attribute individual_name.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def individual_name @individual_name end |
#internal_id ⇒ Object
Returns the value of attribute internal_id.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def internal_id @internal_id end |
#routing_identification ⇒ Object
Returns the value of attribute routing_identification.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def routing_identification @routing_identification end |
#routing_number ⇒ Object
Returns the value of attribute routing_number.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def routing_number @routing_number end |
#trace_number ⇒ Object
Returns the value of attribute trace_number.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def trace_number @trace_number end |
#transaction_code ⇒ Object
Returns the value of attribute transaction_code.
6 7 8 |
# File 'lib/headache/record/entry.rb', line 6 def transaction_code @transaction_code end |
Instance Method Details
#assemble_routing_number ⇒ Object
28 29 30 31 32 |
# 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 |
#generate(*args) ⇒ Object
17 18 19 20 |
# 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 |
#to_h ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# 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 |