Class: MoneyS3::Builders::PC

Inherits:
Object
  • Object
show all
Includes:
ParserCore::BaseBuilder
Defined in:
lib/money_s3/builders/pc.rb

Instance Method Summary collapse

Instance Method Details

#builderObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/money_s3/builders/pc.rb', line 6

def builder
  root = Ox::Element.new(name)
  root = add_attributes_and_namespaces(root)

  if data.key? :hladina
    root << CenovaHladinaType.new('Hladina', data[:hladina]).builder
  end
  root << build_element('DealerSkupina', data[:dealer_skupina], data[:dealer_skupina_attributes]) if data.key? :dealer_skupina
  root << build_element('SDPH', data[:sdph], data[:sdph_attributes]) if data.key? :sdph
  root << build_element('Zaok', data[:zaok], data[:zaok_attributes]) if data.key? :zaok
  root << build_element('ZpusobZao', data[:zpusob_zao], data[:zpusob_zao_attributes]) if data.key? :zpusob_zao
  if data.key? :mena
    root << MenaType.new('Mena', data[:mena]).builder
  end
  root << build_element('VypPrCeny', data[:vyp_pr_ceny], data[:vyp_pr_ceny_attributes]) if data.key? :vyp_pr_ceny
  root << build_element('VychA', data[:vych_a], data[:vych_a_attributes]) if data.key? :vych_a
  root << build_element('ZpusobZmA', data[:zpusob_zm_a], data[:zpusob_zm_a_attributes]) if data.key? :zpusob_zm_a
  root << build_element('VychB', data[:vych_b], data[:vych_b_attributes]) if data.key? :vych_b
  root << build_element('ZpusobZmB', data[:zpusob_zm_b], data[:zpusob_zm_b_attributes]) if data.key? :zpusob_zm_b
  if data.key? :cena1
    root << CenaType.new('Cena1', data[:cena1]).builder
  end
  if data.key? :cena2
    root << CenaType.new('Cena2', data[:cena2]).builder
  end
  if data.key? :cena3
    root << CenaType.new('Cena3', data[:cena3]).builder
  end
  if data.key? :cena4
    root << CenaType.new('Cena4', data[:cena4]).builder
  end
  if data.key? :cena5
    root << CenaType.new('Cena5', data[:cena5]).builder
  end

  root
end