Sha256: ac3de4f1cef89c765589faa9c557257a003a8c60792a671d40c2bd0426ce1931

Contents?: true

Size: 894 Bytes

Versions: 4

Compression:

Stored size: 894 Bytes

Contents

require 'money_s3/parsers/base_parser'
require 'money_s3/parsers/stav_zasoby_type'
require 'money_s3/parsers/km_karta_type'
require 'money_s3/parsers/sklad_type'

module MoneyS3
  module Parsers
    class KomponentaType
      include BaseParser

      def poc_mj
        at 'PocMJ'
      end

      def stav_zasoby
        submodel_at(StavZasobyType, 'StavZasoby')
      end

      def km_karta
        submodel_at(KmKartaType, 'KmKarta')
      end

      def sklad
        submodel_at(SkladType, 'Sklad')
      end

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

        hash[:poc_mj] = poc_mj if has? 'PocMJ'
        hash[:stav_zasoby] = stav_zasoby.to_h_with_attrs if has? 'StavZasoby'
        hash[:km_karta] = km_karta.to_h_with_attrs if has? 'KmKarta'
        hash[:sklad] = sklad.to_h_with_attrs if has? 'Sklad'

        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/komponenta_type.rb
money_s3-0.9.0 lib/money_s3/parsers/komponenta_type.rb
money_s3-0.8.0 lib/money_s3/parsers/komponenta_type.rb
money_s3-0.7.0 lib/money_s3/parsers/komponenta_type.rb