class Eancom::Edifact::ALI

Constants

TAG
TYPE

Attributes

segment_type[R]

Public Class Methods

new( tag: nil, country_of_origin_name_code: nil, duty_regime_type_code: nil, special_condition_code_1: nil, special_condition_code_2: nil, special_condition_code_3: nil, special_condition_code_4: nil, special_condition_code_5: nil ) click to toggle source
Calls superclass method Eancom::Edifact::Segment::new
# File lib/eancom/edifact/segments/ali.rb, line 9
def initialize(
  tag: nil,
  country_of_origin_name_code: nil,
  duty_regime_type_code: nil,
  special_condition_code_1: nil,
  special_condition_code_2: nil,
  special_condition_code_3: nil,
  special_condition_code_4: nil,
  special_condition_code_5: nil
)
  @tag = tag
  @country_of_origin_name_code = country_of_origin_name_code
  @duty_regime_type_code = duty_regime_type_code
  @special_condition_code_1 = special_condition_code_1
  @special_condition_code_2 = special_condition_code_2
  @special_condition_code_3 = special_condition_code_3
  @special_condition_code_4 = special_condition_code_4
  @special_condition_code_5 = special_condition_code_5

  super(tag: tag || TAG)
end

Public Instance Methods

to_json_hash() click to toggle source
# File lib/eancom/edifact/segments/ali.rb, line 31
def to_json_hash
  hash = {}
  hash.merge!(country_of_origin_name_code: @country_of_origin_name_code) if @country_of_origin_name_code
  hash.merge!(duty_regime_type_code: @duty_regime_type_code) if @duty_regime_type_code
  hash.merge!(special_condition_code_1: find_identifier(:special_condition_code_1)) if @special_condition_code_1
  hash.merge!(special_condition_code_2: find_identifier(:special_condition_code_2)) if @special_condition_code_2
  hash.merge!(special_condition_code_3: find_identifier(:special_condition_code_3)) if @special_condition_code_3
  hash.merge!(special_condition_code_4: find_identifier(:special_condition_code_4)) if @special_condition_code_4
  hash.merge!(special_condition_code_5: find_identifier(:special_condition_code_5)) if @special_condition_code_5
  outer_hash = {}
  outer_hash.merge!(additional_information: hash)
  outer_hash
end