Class: Eancom::Edifact::CCI

Inherits:
Segment
  • Object
show all
Defined in:
lib/eancom/edifact/segments/cci.rb

Constant Summary collapse

TAG =
'CCI'.freeze
TYPE =
:body.freeze

Instance Attribute Summary collapse

Attributes inherited from Segment

#tag

Instance Method Summary collapse

Methods inherited from Segment

#array, initialize_by_components, #is_body?, #is_footer?, #is_header?, #item_group_name, #starts_item?, #starts_message?, #structure, #tag?, #to_edi, #to_hash, #to_s, #validate_structure

Constructor Details

#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) ⇒ CCI

Returns a new instance of CCI.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/eancom/edifact/segments/cci.rb', line 9

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

Instance Attribute Details

#segment_typeObject (readonly)

Returns the value of attribute segment_type.



7
8
9
# File 'lib/eancom/edifact/segments/cci.rb', line 7

def segment_type
  @segment_type
end

Instance Method Details

#group_nameObject



43
44
45
# File 'lib/eancom/edifact/segments/cci.rb', line 43

def group_name
  'characterisitcs'
end

#to_json_hashObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/eancom/edifact/segments/cci.rb', line 31

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