Class: Eancom::Edifact::LOC
- Defined in:
- lib/eancom/edifact/segments/loc.rb
Constant Summary collapse
- TAG =
'LOC'.freeze
- TYPE =
:body.freeze
Instance Attribute Summary collapse
-
#segment_type ⇒ Object
readonly
Returns the value of attribute segment_type.
Attributes inherited from Segment
Instance Method Summary collapse
-
#initialize(tag: nil, location_function_qualifier:, location_name_code: nil, first_related_name_code: nil, code_list_identification_code: nil, code_list_responsible_agency_code: nil) ⇒ LOC
constructor
A new instance of LOC.
- #to_json_hash ⇒ Object
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, location_function_qualifier:, location_name_code: nil, first_related_name_code: nil, code_list_identification_code: nil, code_list_responsible_agency_code: nil) ⇒ LOC
Returns a new instance of LOC.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/eancom/edifact/segments/loc.rb', line 9 def initialize( tag: nil, location_function_qualifier:, location_name_code: nil, first_related_name_code: nil, code_list_identification_code: nil, code_list_responsible_agency_code: nil ) @tag = tag @location_function_qualifier = location_function_qualifier @location_name_code = location_name_code @first_related_name_code = @code_list_identification_code = code_list_identification_code @code_list_responsible_agency_code = code_list_responsible_agency_code super(tag: tag || TAG) end |
Instance Attribute Details
#segment_type ⇒ Object (readonly)
Returns the value of attribute segment_type.
7 8 9 |
# File 'lib/eancom/edifact/segments/loc.rb', line 7 def segment_type @segment_type end |
Instance Method Details
#to_json_hash ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/eancom/edifact/segments/loc.rb', line 27 def to_json_hash hash = {} hash.merge!(location_function_qualifier: find_identifier(:location_function_qualifier)) if @location_function_qualifier hash.merge!(location_name_code: @location_name_code) if @location_name_code hash.merge!(first_related_name_code: @first_related_name_code) if @first_related_name_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 outer_hash = {} outer_hash.merge!({ location: hash }) outer_hash end |