Class: Hotfile::Record::BKT06

Inherits:
Hotfile::Record show all
Defined in:
lib/hotfile/record/BKT06.rb

Overview

Transaction Header Record

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ BKT06

Returns a new instance of BKT06.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/hotfile/record/BKT06.rb', line 7

def initialize(line)
  super

  transaction, net_report, record, airline_code, agreement_ref, file_ref, system_id, auth_code, status,
      net_report_method, net_report_calc_type, are_indicator, reserved =
    line.scan(/
      (\d{6})
      ([A-Z0-9 ]{2})
      (\d{3})
      ([A-Z0-9]{3})
      ([A-Z0-9 ]{10})
      ([A-Z0-9 ]{27})
      ([A-Z0-9]{4})
      ([A-Z0-9 ]{14})
      ([A-Z0-9 ])
      ([A-Z0-9 ])
      ([A-Z0-9 ])
      ([A-Z0-9 ])
      (.{50})
    /x).flatten

  @data = {
    transaction: transaction.to_i,
    net_reporting: {
      indicator: net_report.strip,
      method: net_report_method.strip,
      calc_type: net_report_calc_type.strip
    },
    record: record.to_i,
    airline_code: airline_code,
    agreement_ref: agreement_ref.strip,
    file_ref: file_ref.strip,
    system_id: system_id,
    auth_code: auth_code.strip,
    input_status: status.strip,
    are_indicator: are_indicator.strip,
    reserved: reserved.strip
  }
end