Class: NfsePrefeituraSp::Types::TpCpfCnpjNif

Inherits:
Complex
  • Object
show all
Defined in:
lib/nfse_prefeitura_sp/types/tp_cpf_cnpj_nif.rb

Overview

tpCPFCNPJNIF

Instance Method Summary collapse

Methods inherited from Complex

#add_tag_to_xml, #has_any_child_value?, #initialize

Constructor Details

This class inherits a constructor from NfsePrefeituraSp::Types::Complex

Instance Method Details

#add_children_tags_to_xml(xml) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nfse_prefeitura_sp/types/tp_cpf_cnpj_nif.rb', line 10

def add_children_tags_to_xml(xml)
  if !cpf.value.nil?
    cpf.add_tag_to_xml(xml)
  elsif !cnpj.value.nil?
    cnpj.add_tag_to_xml(xml)
  elsif !nif.value.nil?
    nif.add_tag_to_xml(xml)
  elsif !nao_nif.value.nil?
    nao_nif.add_tag_to_xml(xml)
  end
end

#initialize_childrenObject



3
4
5
6
7
8
# File 'lib/nfse_prefeitura_sp/types/tp_cpf_cnpj_nif.rb', line 3

def initialize_children
  @children[:cpf]     = NfsePrefeituraSp::Types::Simple.new('CPF', @data[:cpf])
  @children[:cnpj]    = NfsePrefeituraSp::Types::Simple.new('CNPJ', @data[:cnpj])
  @children[:nif]     = NfsePrefeituraSp::Types::Simple.new('NIF', @data[:nif])
  @children[:nao_nif] = NfsePrefeituraSp::Types::Simple.new('NaoNIF', @data[:nao_nif])
end