Class: Eancom::Edifact::MOA
- Defined in:
- lib/eancom/edifact/segments/moa.rb
Constant Summary collapse
- TAG =
'MOA'.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
- #group_name ⇒ Object
-
#initialize(tag: nil, monetary_amount_type_code_qualifier:, monetary_amount:, currency_identification_code: nil, currency_type_code_qualifier: nil) ⇒ MOA
constructor
A new instance of MOA.
- #to_json_hash ⇒ Object
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, monetary_amount_type_code_qualifier:, monetary_amount:, currency_identification_code: nil, currency_type_code_qualifier: nil) ⇒ MOA
Returns a new instance of MOA.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/eancom/edifact/segments/moa.rb', line 9 def initialize( tag: nil, monetary_amount_type_code_qualifier:, monetary_amount:, currency_identification_code: nil, currency_type_code_qualifier: nil ) @tag = tag @monetary_amount_type_code_qualifier = monetary_amount_type_code_qualifier @monetary_amount= monetary_amount @currency_identification_code = currency_identification_code @currency_type_code_qualifier = currency_type_code_qualifier 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/moa.rb', line 7 def segment_type @segment_type end |
Instance Method Details
#group_name ⇒ Object
35 36 37 |
# File 'lib/eancom/edifact/segments/moa.rb', line 35 def group_name 'monetary_amounts' end |
#to_json_hash ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/eancom/edifact/segments/moa.rb', line 26 def to_json_hash hash = {} hash.merge!(monetary_amount_type_code_qualifier: find_identifier(:monetary_amount_type_code_qualifier)) if @monetary_amount_type_code_qualifier hash.merge!(monetary_amount: @monetary_amount) if @monetary_amount hash.merge!(currency_identification_code: @currency_identification_code) if @currency_identification_code hash.merge!(currency_type_code_qualifier: find_identifier(@currency_type_code_qualifier)) if @currency_type_code_qualifier hash end |