Class: UnionBank::ECrediting::Common::HeaderLine

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/union_bank/e_crediting/common/header_line.rb

Overview

Describes UnionBank eCrediting generic file header line

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(org_short_code:, date:, total_no_of_refs: 0) ⇒ HeaderLine

Returns a new instance of HeaderLine.

Parameters:

  • org_short_code (String)
  • date (Date)
  • total_no_of_refs (Integer) (defaults to: 0)

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
# File 'lib/union_bank/e_crediting/common/header_line.rb', line 21

def initialize(org_short_code:, date:, total_no_of_refs: 0)
  @org_short_code = org_short_code
  @date = date
  @total_no_of_refs = total_no_of_refs

  raise ArgumentError, errors.full_messages.to_sentence unless valid?
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



10
11
12
# File 'lib/union_bank/e_crediting/common/header_line.rb', line 10

def date
  @date
end

#org_short_codeObject

Returns the value of attribute org_short_code.



10
11
12
# File 'lib/union_bank/e_crediting/common/header_line.rb', line 10

def org_short_code
  @org_short_code
end

#total_no_of_refsObject

Returns the value of attribute total_no_of_refs.



10
11
12
# File 'lib/union_bank/e_crediting/common/header_line.rb', line 10

def total_no_of_refs
  @total_no_of_refs
end

Instance Method Details

#ordered_field_valuesArray

Returns:

  • (Array)


30
31
32
33
34
35
36
37
# File 'lib/union_bank/e_crediting/common/header_line.rb', line 30

def ordered_field_values
  [
    "H", # identifier
    org_short_code.strip,
    date.strftime("%m%d%Y"),
    total_no_of_refs
  ]
end