lib/money_s3/builders/pc.rb in money_s3-0.4.0 vs lib/money_s3/builders/pc.rb in money_s3-0.5.0

- old
+ new

@@ -6,30 +6,93 @@ module MoneyS3 module Builders class PC include BaseBuilder - attr_accessor :dealer_skupina, :sdph, :zaok, :zpusob_zao, :vyp_pr_ceny, :vych_a, :zpusob_zm_a, :vych_b, :zpusob_zm_b, :hladina, :mena, :cena1, :cena2, :cena3, :cena4, :cena5 - def builder root = Ox::Element.new(element_name) - root << (Ox::Element.new('DealerSkupina') << dealer_skupina) if dealer_skupina - root << (Ox::Element.new('SDPH') << sdph) if sdph - root << (Ox::Element.new('Zaok') << zaok) if zaok - root << (Ox::Element.new('ZpusobZao') << zpusob_zao) if zpusob_zao - root << (Ox::Element.new('VypPrCeny') << vyp_pr_ceny) if vyp_pr_ceny - root << (Ox::Element.new('VychA') << vych_a) if vych_a - root << (Ox::Element.new('ZpusobZmA') << zpusob_zm_a) if zpusob_zm_a - root << (Ox::Element.new('VychB') << vych_b) if vych_b - root << (Ox::Element.new('ZpusobZmB') << zpusob_zm_b) if zpusob_zm_b - root << CenovaHladinaType.new(hladina, 'Hladina').builder if hladina - root << MenaType.new(mena, 'Mena').builder if mena - root << CenaType.new(cena1, 'Cena1').builder if cena1 - root << CenaType.new(cena2, 'Cena2').builder if cena2 - root << CenaType.new(cena3, 'Cena3').builder if cena3 - root << CenaType.new(cena4, 'Cena4').builder if cena4 - root << CenaType.new(cena5, 'Cena5').builder if cena5 + if attributes.key? :dealer_skupina + element = Ox::Element.new('DealerSkupina') + element << attributes[:dealer_skupina] if attributes[:dealer_skupina] + root << element + end + + if attributes.key? :sdph + element = Ox::Element.new('SDPH') + element << attributes[:sdph] if attributes[:sdph] + root << element + end + + if attributes.key? :zaok + element = Ox::Element.new('Zaok') + element << attributes[:zaok] if attributes[:zaok] + root << element + end + + if attributes.key? :zpusob_zao + element = Ox::Element.new('ZpusobZao') + element << attributes[:zpusob_zao] if attributes[:zpusob_zao] + root << element + end + + if attributes.key? :vyp_pr_ceny + element = Ox::Element.new('VypPrCeny') + element << attributes[:vyp_pr_ceny] if attributes[:vyp_pr_ceny] + root << element + end + + if attributes.key? :vych_a + element = Ox::Element.new('VychA') + element << attributes[:vych_a] if attributes[:vych_a] + root << element + end + + if attributes.key? :zpusob_zm_a + element = Ox::Element.new('ZpusobZmA') + element << attributes[:zpusob_zm_a] if attributes[:zpusob_zm_a] + root << element + end + + if attributes.key? :vych_b + element = Ox::Element.new('VychB') + element << attributes[:vych_b] if attributes[:vych_b] + root << element + end + + if attributes.key? :zpusob_zm_b + element = Ox::Element.new('ZpusobZmB') + element << attributes[:zpusob_zm_b] if attributes[:zpusob_zm_b] + root << element + end + + if attributes.key? :hladina + root << CenovaHladinaType.new(attributes[:hladina], 'Hladina').builder + end + + if attributes.key? :mena + root << MenaType.new(attributes[:mena], 'Mena').builder + end + + if attributes.key? :cena1 + root << CenaType.new(attributes[:cena1], 'Cena1').builder + end + + if attributes.key? :cena2 + root << CenaType.new(attributes[:cena2], 'Cena2').builder + end + + if attributes.key? :cena3 + root << CenaType.new(attributes[:cena3], 'Cena3').builder + end + + if attributes.key? :cena4 + root << CenaType.new(attributes[:cena4], 'Cena4').builder + end + + if attributes.key? :cena5 + root << CenaType.new(attributes[:cena5], 'Cena5').builder + end root end end end \ No newline at end of file