Sha256: 7b9709732f4c423dcfe3d49bc9482aeaa5ee4a786387317cc4f84a9e12a5900f

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

module Eancom
  module Edifact
    class BGM < Segment
      TAG = 'BGM'.freeze
      TYPE = :body.freeze

      attr_reader :segment_type

      def initialize(
        tag: nil,
        document_name_code:,
        code_list_responsible_agency_code: nil,
        code_list_identification_code: nil,
        document_name: nil,
        document_identifier: nil,
        message_function_code: nil
      )
        @tag = tag
        @document_name_code = document_name_code
        @code_list_responsible_agency_code = code_list_responsible_agency_code
        @code_list_identification_code = code_list_identification_code
        @document_name = document_name
        @document_identifier = document_identifier
        @message_function_code = message_function_code

        super(tag: tag || TAG)
      end

      def to_json_hash
        {
          document_name_code: @document_name_code,
          document_identifier: @document_identifier,
          message_function_code: @message_function_code
        }
      end

      def starts_message?
        true
      end

      def segment_type
        TYPE
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eancom-2.0.0 lib/eancom/edifact/segments/bgm.rb