Class: Stupidedi::Editor::FiveOhOneEd

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

Overview

Critiques (edits) interchanges (ISA/IEA) with version "00501", 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) ⇒ FiveOhOneEd

Returns a new instance of FiveOhOneEd.


20
21
22
23
# File 'lib/stupidedi/editor/00501.rb', line 20

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

Instance Attribute Details

#configConfig (readonly)

Returns:


15
16
17
# File 'lib/stupidedi/editor/00501.rb', line 15

def config
  @config
end

#receivedTime (readonly)

Returns:

  • (Time)

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

def received
  @received
end

Instance Method Details

#critique(isa, acc) ⇒ ResultSet

Returns:


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
60
61
# File 'lib/stupidedi/editor/00501.rb', line 26

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