Sha256: 1fe786a6ddcc41b8f6a7ba6381142a4b25db97c309949afc6e854886912a3bfe

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

require 'money_s3/parsers/base_parser'
require 'money_s3/parsers/sklad_type'
require 'money_s3/parsers/km_karta_type'
require 'money_s3/parsers/vyrobni_cislo'
require 'money_s3/parsers/subpol_inv_d_type'

module MoneyS3
  module Parsers
    class PolInvDoklType
      include 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 sklad
        submodel_at(SkladType, 'Sklad')
      end

      def km_karta
        submodel_at(KmKartaType, 'KmKarta')
      end

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

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

      def to_h_with_attrs
        hash = 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[:sklad] = sklad.to_h_with_attrs if has? 'Sklad'
        hash[:km_karta] = km_karta.to_h_with_attrs if has? 'KmKarta'
        hash[:seznam_vc] = seznam_vc.map(&:to_h_with_attrs) if has? 'SeznamVC'
        hash[:slozeni] = slozeni.map(&:to_h_with_attrs) if has? 'Slozeni'

        hash
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
money_s3-0.10.0 lib/money_s3/parsers/pol_inv_dokl_type.rb
money_s3-0.9.0 lib/money_s3/parsers/pol_inv_dokl_type.rb
money_s3-0.8.0 lib/money_s3/parsers/pol_inv_dokl_type.rb
money_s3-0.7.0 lib/money_s3/parsers/pol_inv_dokl_type.rb