Class: Stupidedi::Editor::FourOhOneEd

Inherits:
AbstractEd
  • Object
show all
Defined in:
lib/stupidedi/editor/00401.rb

Overview

Critiques (edits) interchanges (ISA/IEA) with version "00401", then selects the appropriate editor, according to the config, and edits each functional group (GS/GE)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractEd

#edit, edit, #rewrite, rewrite

Methods included from Inspect

#inspect

Constructor Details

#initialize(config, received) ⇒ FourOhOneEd

Returns a new instance of FourOhOneEd.



18
19
20
21
# File 'lib/stupidedi/editor/00401.rb', line 18

def initialize(config, received)
  @config, @received =
    config, received
end

Instance Attribute Details

#configConfig (readonly)

Returns:



13
14
15
# File 'lib/stupidedi/editor/00401.rb', line 13

def config
  @config
end

#receivedTime (readonly)

Returns:

  • (Time)


16
17
18
# File 'lib/stupidedi/editor/00401.rb', line 16

def received
  @received
end

Instance Method Details

#critique(isa, acc) ⇒ ResultSet

Returns:



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/stupidedi/editor/00401.rb', line 24

def critique(isa, acc)
  # 000: No error

  # 002: This Standard as Noted in the Control Standards Identifier is Not Supported
  #   Check for InvalidEnvelope

  # 003: This Version of the Controls is Not Supported
  #   Check for InvalidEnvelope

  # 004: The Segment Terminator is Invalid
  #   We couldn't have produced a parse tree, StreamReader#next_segment
  #   would have returned an Either.failure<Result.failure>

  # 009: Unknown Interchange Receiver ID
  #   This isn't for Stupidedi to decide

  # 016: Invalid Interchange Standards Identifier Value
  #   Check for InvalidEnvelope

  # 022: Invalid Control Characters
  #   What does this mean? TokenReader ignores control characters anyway,
  #   so there will be no evidence of this in the parse tree

  # 025: Duplicate Interchange Control Numbers
  #   Need to critique the parent, TransmissionVal

  # 028: Invalid Date in Deferred Delivery Request
  # 029: Invalid Time in Deferred Delivery Request
  # 030: Invalid Delivery Time Code in Deferred Delivery Request
  # 031: Invalid Grade of Service
  #   It seems these elements should not be sent to a trading partner,
  #   they are used internally to schedule a delivery. Not sure what to do
  #   about validating them in a general way...

  acc.tap { critique_isa(isa, received, acc) }
end