Sha256: 44ca0412559134cd26541e31db46b38af2320a0996876c15ddadb1925cc92cd5

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

module MoneyS3
  module Builders
    class PolInvDoklType
      include ParserCore::BaseBuilder

      def builder
        root = Ox::Element.new(name)
        if data.respond_to? :attributes
          data.attributes.each { |k, v| root[k] = v }
        end

        root << build_element('Popis', data[:popis]) if data.key? :popis
        root << build_element('Zkrat', data[:zkrat]) if data.key? :zkrat
        root << build_element('Slupina', data[:slupina]) if data.key? :slupina
        root << build_element('MJ', data[:mj]) if data.key? :mj
        root << build_element('MnInv', data[:mn_inv]) if data.key? :mn_inv
        if data.key? :seznam_vc
          element = Ox::Element.new('SeznamVC')
          data[:seznam_vc].each { |i| element << VyrobniCislo.new('VyrobniCislo', i).builder }
          root << element
        end
        if data.key? :sklad
          root << SkladType.new('Sklad', data[:sklad]).builder
        end
        if data.key? :km_karta
          root << KmKartaType.new('KmKarta', data[:km_karta]).builder
        end
        if data.key? :slozeni
          element = Ox::Element.new('Slozeni')
          data[:slozeni].each { |i| element << SubpolInvDType.new('SubPolozka', i).builder }
          root << element
        end

        root
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
money_s3-0.12.0 lib/money_s3/builders/pol_inv_dokl_type.rb
money_s3-0.11.0 lib/money_s3/builders/pol_inv_dokl_type.rb