Sha256: a0cb1e7dc9fdbd11145341d07681ad197a43a47fff891fcb6e5255e23a2cfa4e

Contents?: true

Size: 1.99 KB

Versions: 16

Compression:

Stored size: 1.99 KB

Contents

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

      attr_reader :segment_type

      def initialize(
        tag: nil,
        class_type_code: nil,
        measurment_attribute_code: nil,
        characteristic_description_code:,
        code_list_identification_code: nil,
        code_list_respobsibility_agency_code: nil,
        characterisitc_description_1: nil,
        characterisitc_description_2: nil
      )
        @tag = tag
        @class_type_code = class_type_code
        @measurment_attribute_code = measurment_attribute_code
        @characteristic_description_code = characteristic_description_code
        @code_list_identification_code = code_list_identification_code
        @code_list_respobsibility_agency_code = code_list_respobsibility_agency_code
        @characterisitc_description_1 = characterisitc_description_1
        @characterisitc_description_2 = characterisitc_description_2

        super(tag: tag || TAG)
      end

      def to_json_hash
        hash = {}
        hash.merge!(class_type_code: find_identifier(:class_type_code)) if @class_type_code
        hash.merge!(measurment_attribute_code: @measurment_attribute_code) if @measurment_attribute_code
        hash.merge!(characteristic_description_code: find_identifier(:characteristic_description_code)) if @characteristic_description_code
        hash.merge!(code_list_identification_code: @code_list_identification_code) if @code_list_identification_code
        hash.merge!(code_list_respobsibility_agency_code: find_identifier(:code_list_respobsibility_agency_code)) if @code_list_respobsibility_agency_code
        hash.merge!(characterisitc_description_1: @characterisitc_description_1) if @characterisitc_description_1
        hash.merge!(characterisitc_description_2: @characterisitc_description_2) if @characterisitc_description_2
        hash
      end

      def group_name
        'characterisitcs'
      end

      def segment_type
        TYPE
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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