Sha256: 862785c67d01f60120012bd264fd024e9085fcdfb87d8816f7e73d3d4501123c

Contents?: true

Size: 1.09 KB

Versions: 16

Compression:

Stored size: 1.09 KB

Contents

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

      attr_reader :segment_type

      def initialize(
        tag: nil,
        product_group_type_code:,
        product_group_name_code: nil,
        code_list_identification_code: nil,
        code_list_responsibility_agency_code: nil,
        product_group_name: nil
      )
        @tag = tag
        @product_group_type_code = product_group_type_code
        @product_group_name_code = product_group_name_code
        @code_list_identification_code = code_list_identification_code
        @code_list_responsibility_agency_code = code_list_responsibility_agency_code
        @product_group_name = product_group_name_code

        super(tag: tag || TAG)
      end

      def to_json_hash
        hash = {
          'product_group_identifier': identifier
        }
      end

      def segment_type
        TYPE
      end

      private

      def identifier
        @identifier ||= structure.find(:product_group_type_code).dictionary[@product_group_type_code][:identifier]
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
eancom-1.6.3 lib/eancom/edifact/segments/pgi.rb
eancom-1.6.2 lib/eancom/edifact/segments/pgi.rb
eancom-1.6.0 lib/eancom/edifact/segments/pgi.rb
eancom-1.5.7 lib/eancom/edifact/segments/pgi.rb
eancom-1.5.6 lib/eancom/edifact/segments/pgi.rb
eancom-1.5.5 lib/eancom/edifact/segments/pgi.rb
eancom-1.5.4 lib/eancom/edifact/segments/pgi.rb
eancom-1.5.2 lib/eancom/edifact/segments/pgi.rb
eancom-1.5.1 lib/eancom/edifact/segments/pgi.rb
eancom-1.5.0 lib/eancom/edifact/segments/pgi.rb
eancom-1.4.0 lib/eancom/edifact/segments/pgi.rb
eancom-1.3.0 lib/eancom/edifact/segments/pgi.rb
eancom-1.2.0 lib/eancom/edifact/segments/pgi.rb
eancom-1.1.1 lib/eancom/edifact/segments/pgi.rb
eancom-1.1.0 lib/eancom/edifact/segments/pgi.rb
eancom-2.0.0 lib/eancom/edifact/segments/pgi.rb