Sha256: fdd9ddec642ded59291b9567c80afedf2ca22ea51f1f1ae6fab886b04e8c133b

Contents?: true

Size: 1.76 KB

Versions: 16

Compression:

Stored size: 1.76 KB

Contents

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

      attr_reader :segment_type

      def initialize(
        tag: nil,
        characterisitc_value_description_code: nil,
        code_list_identification_code: nil,
        code_list_respobsibility_agency_code: nil,
        characterisitc_value_description_1: nil,
        characterisitc_value_description_2: nil
      )
        @tag = tag
        @characterisitc_value_description_code = characterisitc_value_description_code
        @code_list_identification_code = code_list_identification_code
        @code_list_respobsibility_agency_code = code_list_respobsibility_agency_code
        @characterisitc_value_description_1 = characterisitc_value_description_1
        @characterisitc_value_description_2 = characterisitc_value_description_2

        super(tag: tag || TAG)
      end

      def to_json_hash
        hash = {}
        hash.merge!(characterisitc_value_description_code: find_identifier(:characterisitc_value_description_code)) if @characterisitc_value_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_value_description_1: find_identifier(:characterisitc_value_description_1)) if @characterisitc_value_description_1
        hash.merge!(characterisitc_value_description_2: @characterisitc_value_description_2) if @characterisitc_value_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/cav.rb
eancom-1.6.2 lib/eancom/edifact/segments/cav.rb
eancom-1.6.0 lib/eancom/edifact/segments/cav.rb
eancom-1.5.7 lib/eancom/edifact/segments/cav.rb
eancom-1.5.6 lib/eancom/edifact/segments/cav.rb
eancom-1.5.5 lib/eancom/edifact/segments/cav.rb
eancom-1.5.4 lib/eancom/edifact/segments/cav.rb
eancom-1.5.2 lib/eancom/edifact/segments/cav.rb
eancom-1.5.1 lib/eancom/edifact/segments/cav.rb
eancom-1.5.0 lib/eancom/edifact/segments/cav.rb
eancom-1.4.0 lib/eancom/edifact/segments/cav.rb
eancom-1.3.0 lib/eancom/edifact/segments/cav.rb
eancom-1.2.0 lib/eancom/edifact/segments/cav.rb
eancom-1.1.1 lib/eancom/edifact/segments/cav.rb
eancom-1.1.0 lib/eancom/edifact/segments/cav.rb
eancom-2.0.0 lib/eancom/edifact/segments/cav.rb