Sha256: 7aacc6e6c01e7a374d2758eaa51f65aea87228fc62dd79443c5c86b08836d346

Contents?: true

Size: 1019 Bytes

Versions: 1

Compression:

Stored size: 1019 Bytes

Contents

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

      def initialize(
        tag: nil,
        hierarchical_structure_level_identifier:,
        hierarchical_structure_parent_identifier: nil,
        packaging_level_code: nil
      )
        @tag = tag
        @hierarchical_structure_level_identifier = hierarchical_structure_level_identifier
        @hierarchical_structure_parent_identifier = hierarchical_structure_parent_identifier
        @packaging_level_code = packaging_level_code

        super(tag: tag || TAG)
      end

      def to_json_hash
        hash = {}
        hash.merge!(hierarchical_structure_level_identifier: @hierarchical_structure_level_identifier) if @hierarchical_structure_level_identifier
        hash.merge!(hierarchical_structure_parent_identifier: @hierarchical_structure_parent_identifier) if @hierarchical_structure_parent_identifier
        hash
      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/cps.rb