Sha256: 609f250530b371fab4d050c3fbe69f51d09b23984c265b75c10b8e9b99ca1b5c

Contents?: true

Size: 1.47 KB

Versions: 11

Compression:

Stored size: 1.47 KB

Contents

module Eancom
  module Edifact
    class UNH < Segment
      TAG = 'UNH'.freeze
      TYPE = :header.freeze

      def initialize(
        tag: nil,
        message_reference_number:,
        message_type:,
        message_version_number:,
        message_release_number:,
        controlling_agency:,
        association_assigned_code: nil,
        code_list_directory_version_number: nil
      )

        @tag = tag
        @message_reference_number = message_reference_number
        @message_type = message_type
        @message_version_number = message_version_number
        @message_release_number = message_release_number
        @controlling_agency = controlling_agency
        @association_assigned_code = association_assigned_code
        @code_list_directory_version_number = code_list_directory_version_number
        super(tag: tag || TAG)
      end

      def to_json_hash
        hash = {
          message_reference_number: @message_reference_number,
          message_type: @message_type,
          message_version_number: @message_version_number,
          message_release_number: @message_release_number,
          controlling_agency: @controlling_agency,
        }
        hash[:association_assigned_code] = @association_assigned_code if @association_assigned_code
        hash[:code_list_directory_version_number] = @code_list_directory_version_number if @code_list_directory_version_number
        hash
      end

      def segment_type
        TYPE
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
eancom-1.6.3 lib/eancom/edifact/segments/unh.rb
eancom-1.6.2 lib/eancom/edifact/segments/unh.rb
eancom-1.6.0 lib/eancom/edifact/segments/unh.rb
eancom-1.5.7 lib/eancom/edifact/segments/unh.rb
eancom-1.5.6 lib/eancom/edifact/segments/unh.rb
eancom-1.5.5 lib/eancom/edifact/segments/unh.rb
eancom-1.5.4 lib/eancom/edifact/segments/unh.rb
eancom-1.5.2 lib/eancom/edifact/segments/unh.rb
eancom-1.5.1 lib/eancom/edifact/segments/unh.rb
eancom-1.5.0 lib/eancom/edifact/segments/unh.rb
eancom-1.4.0 lib/eancom/edifact/segments/unh.rb