Class: Eancom::Edifact::PAC

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

Constant Summary collapse

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

Instance Attribute Summary

Attributes inherited from Segment

#tag

Instance Method Summary collapse

Methods inherited from Segment

#array, #group_name, 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, package_quantity: nil, packaging_level_code: nil, packaging_related_description_code: nil, packaging_terms_and_conditions: nil, package_type_description_code: nil, code_list_identification_code: nil, code_list_responsible_agency_code: nil, type_of_packages: nil, description_format_code: nil, type_of_packages_1: nil, item_type_identification_code_1: nil, type_of_packages_2: nil, item_type_identification_code_2: nil, returnable_package_freight_payment_responsibility_code: nil, returnable_package_load_contents_code: nil) ⇒ PAC

Returns a new instance of PAC.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/eancom/edifact/segments/pac.rb', line 7

def initialize(
  tag: nil,
  package_quantity: nil,
  packaging_level_code: nil,
  packaging_related_description_code: nil,
  packaging_terms_and_conditions: nil,
  package_type_description_code: nil,
  code_list_identification_code: nil,
  code_list_responsible_agency_code: nil,
  type_of_packages: nil,
  description_format_code: nil,
  type_of_packages_1: nil,
  item_type_identification_code_1: nil,
  type_of_packages_2: nil,
  item_type_identification_code_2: nil,
  returnable_package_freight_payment_responsibility_code: nil,
  returnable_package_load_contents_code: nil
)
  @tag = tag
  @package_quantity = package_quantity
  @packaging_level_code = packaging_level_code
  @packaging_related_description_code = packaging_related_description_code
  @packaging_terms_and_conditions = packaging_terms_and_conditions
  @package_type_description_code = package_type_description_code
  @code_list_identification_code = code_list_identification_code
  @code_list_responsible_agency_code = code_list_responsible_agency_code
  @type_of_packages = type_of_packages
  @description_format_code = description_format_code
  @type_of_packages_1 = type_of_packages_1
  @item_type_identification_code_1 = item_type_identification_code_1
  @type_of_packages_2 = type_of_packages_2
  @item_type_identification_code_2 = item_type_identification_code_2
  @returnable_package_freight_payment_responsibility_code = returnable_package_freight_payment_responsibility_code
  @returnable_package_load_contents_code = returnable_package_load_contents_code

  super(tag: tag || TAG)
end

Instance Method Details

#segment_typeObject



51
52
53
# File 'lib/eancom/edifact/segments/pac.rb', line 51

def segment_type
  TYPE
end

#to_json_hashObject



45
46
47
48
49
# File 'lib/eancom/edifact/segments/pac.rb', line 45

def to_json_hash
  hash = {}
  hash.merge!(package_quantity: @package_quantity) if @package_quantity
  hash
end