Class: Eancom::Edifact::QVR
Constant Summary
collapse
- TAG =
'QVR'
- TYPE =
:body
Instance Attribute Summary
Attributes inherited from Segment
#tag
Instance Method Summary
collapse
Methods inherited from Segment
#array, initialize_by_components, #is_body?, #is_footer?, #is_header?, #item_group_name, #starts_item?, #starts_location?, #starts_message?, #structure, #tag?, #to_edi, #to_hash, #to_s, #validate_structure
Constructor Details
#initialize(tag: nil, quantity_variance_value:, quantity_type_code_qualifier:, discrepancy_nature_identification_code: nil, change_reason_description_code: nil, code_list_identification_code: nil, code_list_responsible_agency_code: nil, change_reason_description: nil) ⇒ QVR
Returns a new instance of QVR.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/eancom/edifact/segments/qvr.rb', line 9
def initialize(
tag: nil,
quantity_variance_value:,
quantity_type_code_qualifier:,
discrepancy_nature_identification_code: nil,
change_reason_description_code: nil,
code_list_identification_code: nil,
code_list_responsible_agency_code: nil,
change_reason_description: nil
)
@tag = tag
@quantity_variance_value = quantity_variance_value
@quantity_type_code_qualifier = quantity_type_code_qualifier
@discrepancy_nature_identification_code = discrepancy_nature_identification_code
@change_reason_description_code = change_reason_description_code
@code_list_identification_code = code_list_identification_code
@code_list_responsible_agency_code = code_list_responsible_agency_code
@change_reason_description = change_reason_description
super(tag: tag || TAG)
end
|
Instance Method Details
#group_name ⇒ Object
41
42
43
|
# File 'lib/eancom/edifact/segments/qvr.rb', line 41
def group_name
'quantity_variances'
end
|
#segment_type ⇒ Object
45
46
47
|
# File 'lib/eancom/edifact/segments/qvr.rb', line 45
def segment_type
TYPE
end
|
#to_json_hash ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/eancom/edifact/segments/qvr.rb', line 32
def to_json_hash
hash = {}
hash.merge!(quantity_variance_value: quantity_variance_value)
hash.merge!(quantity_type_code_qualifier: find_identifier(:quantity_type_code_qualifier))
hash.merge!(discrepancy_nature_identification_code: find_identifier(:discrepancy_nature_identification_code)) if @discrepancy_nature_identification_code
hash.merge!(change_reason_description: @change_reason_description) if @change_reason_description
hash
end
|