Sha256: eb0b03768474277b1642de4ef45b0c88853662b224c2a4821de142c085a6409d

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

require 'money_s3/builders/base_builder'
require 'money_s3/builders/pol_inv_dokl_type'

module MoneyS3
  module Builders
    class InvDoklType
      include BaseBuilder

      def builder
        root = Ox::Element.new(element_name)

        if attributes.key? :cislo_d
          element = Ox::Element.new('CisloD')
          element << attributes[:cislo_d] if attributes[:cislo_d]
          root << element
        end

        if attributes.key? :inv_id
          element = Ox::Element.new('InvID')
          element << attributes[:inv_id] if attributes[:inv_id]
          root << element
        end

        if attributes.key? :popis
          element = Ox::Element.new('Popis')
          element << attributes[:popis] if attributes[:popis]
          root << element
        end

        if attributes.key? :prac
          element = Ox::Element.new('Prac')
          element << attributes[:prac] if attributes[:prac]
          root << element
        end

        if attributes.key? :kontr
          element = Ox::Element.new('Kontr')
          element << attributes[:kontr] if attributes[:kontr]
          root << element
        end

        if attributes.key? :poznamka
          element = Ox::Element.new('Poznamka')
          element << attributes[:poznamka] if attributes[:poznamka]
          root << element
        end

        if attributes.key? :polozka
          attributes[:polozka].each { |i| root << PolInvDoklType.new(i, 'Polozka').builder }
        end

        root
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
money_s3-0.5.0 lib/money_s3/builders/inv_dokl_type.rb