Class: MoneyS3::Builders::DokladFirmaType

Inherits:
Object
  • Object
show all
Includes:
ParserCore::BaseBuilder
Defined in:
lib/money_s3/builders/doklad_firma_type.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/money_s3/builders/doklad_firma_type.rb', line 6

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

  root << build_element('ObchNazev', data[:obch_nazev], data[:obch_nazev_attributes]) if data.key? :obch_nazev
  if data.key? :obch_adresa
    root << AdresaType.new('ObchAdresa', data[:obch_adresa]).builder
  end
  root << build_element('FaktNazev', data[:fakt_nazev], data[:fakt_nazev_attributes]) if data.key? :fakt_nazev
  root << build_element('ICO', data[:ico], data[:ico_attributes]) if data.key? :ico
  root << build_element('DIC', data[:dic], data[:dic_attributes]) if data.key? :dic
  root << build_element('DICSK', data[:dicsk], data[:dicsk_attributes]) if data.key? :dicsk
  if data.key? :fakt_adresa
    root << AdresaType.new('FaktAdresa', data[:fakt_adresa]).builder
  end
  root << build_element('GUID', data[:guid], data[:guid_attributes]) if data.key? :guid
  root << build_element('Nazev', data[:nazev], data[:nazev_attributes]) if data.key? :nazev
  if data.key? :adresa
    root << AdresaType.new('Adresa', data[:adresa]).builder
  end
  if data.key? :tel
    root << TelefonType.new('Tel', data[:tel]).builder
  end
  if data.key? :fax
    root << TelefonType.new('Fax', data[:fax]).builder
  end
  if data.key? :mobil
    root << TelefonType.new('Mobil', data[:mobil]).builder
  end
  root << build_element('EMail', data[:e_mail], data[:e_mail_attributes]) if data.key? :e_mail
  root << build_element('EMailKopie', data[:e_mail_kopie], data[:e_mail_kopie_attributes]) if data.key? :e_mail_kopie
  root << build_element('EMailSkryt', data[:e_mail_skryt], data[:e_mail_skryt_attributes]) if data.key? :e_mail_skryt
  root << build_element('WWW', data[:www], data[:www_attributes]) if data.key? :www
  root << build_element('PlatceDPH', data[:platce_dph], data[:platce_dph_attributes]) if data.key? :platce_dph
  root << build_element('FyzOsoba', data[:fyz_osoba], data[:fyz_osoba_attributes]) if data.key? :fyz_osoba
  root << build_element('Banka', data[:banka], data[:banka_attributes]) if data.key? :banka
  root << build_element('Ucet', data[:ucet], data[:ucet_attributes]) if data.key? :ucet
  root << build_element('KodBanky', data[:kod_banky], data[:kod_banky_attributes]) if data.key? :kod_banky
  root << build_element('VSymb', data[:v_symb], data[:v_symb_attributes]) if data.key? :v_symb
  root << build_element('SpecSym', data[:spec_sym], data[:spec_sym_attributes]) if data.key? :spec_sym
  root << build_element('KodPartn', data[:kod_partn], data[:kod_partn_attributes]) if data.key? :kod_partn
  root << build_element('ISDOC', data[:isdoc], data[:isdoc_attributes]) if data.key? :isdoc
  if data.key? :eshop
    root << Eshop2.new('eshop', data[:eshop]).builder
  end
  if data.key? :seznam_bank_spojeni
    element = Ox::Element.new('SeznamBankSpojeni')
    data[:seznam_bank_spojeni].each { |i| element << BankSpojeniType.new('BankSpojeni', i).builder }
    root << element
  end
  if data.key? :vlajky
    root << Vlajky.new('Vlajky', data[:vlajky]).builder
  end

  root
end