Sha256: a60f184ac17f4e34edc95126ae0bb0439f0666279dc5b37603f132b9735ef493

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

module MoneyS3
  module Parsers
    class PolInvDoklType
      include ParserCore::BaseParser

      def popis
        at 'Popis'
      end

      def zkrat
        at 'Zkrat'
      end

      def slupina
        at 'Slupina'
      end

      def mj
        at 'MJ'
      end

      def mn_inv
        at 'MnInv'
      end

      def seznam_vc
        array_of_at(VyrobniCislo, ['SeznamVC', 'VyrobniCislo'])
      end

      def sklad
        submodel_at(SkladType, 'Sklad')
      end

      def km_karta
        submodel_at(KmKartaType, 'KmKarta')
      end

      def slozeni
        array_of_at(SubpolInvDType, ['Slozeni', 'SubPolozka'])
      end

      def to_h_with_attrs
        hash = ParserCore::HashWithAttributes.new({}, attributes)

        hash[:popis] = popis if has? 'Popis'
        hash[:zkrat] = zkrat if has? 'Zkrat'
        hash[:slupina] = slupina if has? 'Slupina'
        hash[:mj] = mj if has? 'MJ'
        hash[:mn_inv] = mn_inv if has? 'MnInv'
        hash[:seznam_vc] = seznam_vc.map(&:to_h_with_attrs) if has? 'SeznamVC'
        hash[:sklad] = sklad.to_h_with_attrs if has? 'Sklad'
        hash[:km_karta] = km_karta.to_h_with_attrs if has? 'KmKarta'
        hash[:slozeni] = slozeni.map(&:to_h_with_attrs) if has? 'Slozeni'

        hash
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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