Sha256: ce9bd56336732eefcf89f16e198c9086fa58c51c993901255162b63fae6aebe6

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

require 'money_s3/builders/base_builder'
require 'money_s3/builders/msg_firma_type'
require 'money_s3/builders/data'
require 'money_s3/builders/reference_type'
require 'money_s3/builders/msg_fakt_poloz_type'
require 'money_s3/builders/message_type'
require 'money_s3/builders/error_info_type'

module MoneyS3
  module Builders
    class Import
      include 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('Status', data[:status]) if data.key? :status

        if data.key? :dod_odb
          root << MsgFirmaType.new('DodOdb', data[:dod_odb]).builder
        end

        if data.key? :konec_prij
          root << MsgFirmaType.new('KonecPrij', data[:konec_prij]).builder
        end

        if data.key? :data
          root << Data.new('Data', data[:data]).builder
        end

        if data.key? :reference
          root << ReferenceType.new('Reference', data[:reference]).builder
        end

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

        if data.key? :uhrada
          data[:uhrada].each { |i| root << MessageType.new('Uhrada', i).builder }
        end

        if data.key? :error_info
          data[:error_info].each { |i| root << ErrorInfoType.new('ErrorInfo', i).builder }
        end

        root
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
money_s3-0.10.0 lib/money_s3/builders/import.rb
money_s3-0.9.0 lib/money_s3/builders/import.rb
money_s3-0.8.0 lib/money_s3/builders/import.rb
money_s3-0.7.0 lib/money_s3/builders/import.rb
money_s3-0.6.0 lib/money_s3/builders/import.rb