class Xrechnung::Party

Attributes

nested[RW]

Public Class Methods

new(nested: true, **kwargs) click to toggle source
Calls superclass method Xrechnung::MemberContainer::new
# File lib/xrechnung/party.rb, line 31
def initialize(nested: true, **kwargs)
  super(**kwargs)
  self.nested = nested
end

Public Instance Methods

to_xml(xml) click to toggle source

noinspection RubyResolve

# File lib/xrechnung/party.rb, line 37
def to_xml(xml)
  if nested
    xml.cac :Party do
      party_body(xml)
    end
  else
    party_body(xml)
  end
end

Private Instance Methods

party_body(xml) click to toggle source
# File lib/xrechnung/party.rb, line 49
def party_body(xml)
  unless name.nil? # if blank? -> empty name tag
    xml.cac :PartyName do
      if name == ""
        xml.cbc :Name
      else
        xml.cbc :Name, name
      end
    end
  end
  party_identification&.to_xml(xml)
  postal_address&.to_xml(xml)
  party_tax_scheme&.to_xml(xml)
  party_legal_entity&.to_xml(xml)
  contact&.to_xml(xml)
end