module Eancom module Edifact class RFF < Segment TAG = 'RFF'.freeze TYPE = :body.freeze def initialize( tag: nil, reference_code_qualifier:, reference_identifier: nil, document_line_identifier: nil ) @tag = tag @reference_code_qualifier = reference_code_qualifier @reference_identifier = reference_identifier @document_line_identifier = document_line_identifier super(tag: @tag || TAG) end def to_json_hash { identifier => { reference_identifier: @reference_identifier, document_line_identifier: @document_line_identifier }, identifier: @identifier } end def group_name 'references' end def segment_type TYPE end private def identifier @identifier ||= structure.find(:reference_code_qualifier).dictionary[@reference_code_qualifier][:identifier] end end end end