class Eancom::Edifact::ALC

Constants

TAG
TYPE

Attributes

segment_type[R]

Public Class Methods

new( tag: nil, allowance_or_charge_code_qualifier:, allowance_or_charge_identifier: nil, allowance_or_charge_identification_code: nil, settlement_mean_code: nil, calculation_sequence_code: nil, special_service_description_code: nil, code_list_identification_code: nil, code_list_responsible_agency_code: nil, special_service_description_1: nil, special_service_description_2: nil ) click to toggle source
Calls superclass method Eancom::Edifact::Segment::new
# File lib/eancom/edifact/segments/alc.rb, line 9
def initialize(
  tag: nil,
  allowance_or_charge_code_qualifier:,
  allowance_or_charge_identifier: nil,
  allowance_or_charge_identification_code: nil,
  settlement_mean_code: nil,
  calculation_sequence_code: nil,
  special_service_description_code: nil,
  code_list_identification_code: nil,
  code_list_responsible_agency_code: nil,
  special_service_description_1: nil,
  special_service_description_2: nil
)
  @tag = tag
  @allowance_or_charge_code_qualifier = allowance_or_charge_code_qualifier
  @allowance_or_charge_identifier = allowance_or_charge_identifier
  @allowance_or_charge_identification_code = allowance_or_charge_identification_code
  @settlement_mean_code = settlement_mean_code
  @calculation_sequence_code = calculation_sequence_code
  @special_service_description_code = special_service_description_code
  @code_list_identification_code = code_list_identification_code
  @code_list_responsible_agency_code = code_list_responsible_agency_code
  @special_service_description_1 = special_service_description_1
  @special_service_description_2 = special_service_description_2
  super(tag: tag || TAG)
end

Public Instance Methods

group_name() click to toggle source
# File lib/eancom/edifact/segments/alc.rb, line 51
def group_name
  'allowances_or_charges'
end
to_json_hash() click to toggle source
# File lib/eancom/edifact/segments/alc.rb, line 36
def to_json_hash
  hash = {}
  hash.merge!(allowance_or_charge_code_qualifier: find_identifier(:allowance_or_charge_code_qualifier)) if @allowance_or_charge_code_qualifier
  hash.merge!(allowance_or_charge_identifier: @allowance_or_charge_identifier) if @allowance_or_charge_identifier
  hash.merge!(allowance_or_charge_identification_code: find_identifier(:allowance_or_charge_identification_code)) if @allowance_or_charge_identification_code
  hash.merge!(settlement_mean_code: find_identifier(:settlement_mean_code)) if @settlement_mean_code
  hash.merge!(calculation_sequence_code: find_identifier(:calculation_sequence_code)) if @calculation_sequence_code
  hash.merge!(special_service_description_code: find_identifier(:special_service_description_code)) if @special_service_description_code
  hash.merge!(code_list_identification_code: @code_list_identification_code) if @code_list_identification_code
  hash.merge!(code_list_responsible_agency_code: find_identifier(:code_list_responsible_agency_code)) if @code_list_responsible_agency_code
  hash.merge!(special_service_description_1: @special_service_description_1) if @special_service_description_1
  hash.merge!(special_service_description_2: @special_service_description_2) if @special_service_description_2
  hash
end