class Eancom::Edifact::LIN

Constants

TAG
TYPE

Public Class Methods

new( tag: nil, line_item_identifier_1:, action_request_notification_description_code: '', item_identifier:, item_type_identification_code:, sub_line_indicator_code: nil, line_item_identifier_2: nil ) click to toggle source
Calls superclass method Eancom::Edifact::Segment::new
# File lib/eancom/edifact/segments/lin.rb, line 7
def initialize(
  tag: nil,
  line_item_identifier_1:,
  action_request_notification_description_code: '',
  item_identifier:,
  item_type_identification_code:,
  sub_line_indicator_code: nil,
  line_item_identifier_2: nil
)
  @tag = tag
  @line_item_identifier_1 = line_item_identifier_1
  @action_request_notification_description_code = action_request_notification_description_code
  @item_identifier = item_identifier
  @item_type_identification_code = item_type_identification_code
  @sub_line_indicator_code = sub_line_indicator_code
  @line_item_identifier_2 = line_item_identifier_2

  super(tag: tag || TAG )
end

Public Instance Methods

segment_type() click to toggle source
# File lib/eancom/edifact/segments/lin.rb, line 41
def segment_type
  TYPE
end
starts_item?() click to toggle source
# File lib/eancom/edifact/segments/lin.rb, line 27
def starts_item?
  true
end
to_json_hash() click to toggle source
# File lib/eancom/edifact/segments/lin.rb, line 31
def to_json_hash
  hash = {}
  hash.merge!(ean: @item_identifier) if @item_identifier
  hash.merge!(action_request_notification_description_code: @action_request_notification_description_code) if @action_request_notification_description_code
  hash.merge!(item_type_identification_code: find_identifier(:item_type_identification_code)) if @item_type_identification_code
  hash.merge!(sub_line_indicator_code: @sub_line_indicator_code) if @sub_line_indicator_code
  hash.merge!(line_item_identifier_2: @line_item_identifier_2) if @line_item_identifier_2
  hash
end