Class: Nfe::Reader::Customer

Inherits:
Object
  • Object
show all
Includes:
AttributeHelper
Defined in:
lib/nfe_reader/customer.rb

Overview

Identificação do Destinatário da Nota Fiscal eletrônica

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttributeHelper

#attributes, #attributes_to_hash

Constructor Details

#initialize(attrs = {}) ⇒ Customer

Fields Values

indIEDest: 1 - Contribuinte ICMS (informar a IE do destinatário),

2 - Contribuinte isento de Inscrição no cadastro de Contribuintes do ICMS,
9 - Não Contribuinte, que pode ou não possuir Inscrição Estadual


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
62
63
# File 'lib/nfe_reader/customer.rb', line 19

def initialize(attrs = {})
  @cnpj = attrs[:CNPJ]
  @cpf = attrs[:CPF]

  # Razão Social ou nome do destinatário
  @name = attrs[:xNome]
  # Inscrição Estadual do Destinatário
  @state_registration = attrs[:IE]
  # Inscrição na SUFRAMA
  @suframa = attrs[:ISUF]
  # Inscrição Municipal do Tomador do Serviço
  @city_registration = attrs[:IM]
  # Indicador da IE do Destinatário
  @state_registration_code = attrs[:indIEDest]
  # Email
  @email = attrs[:email]
  # Identificação do destinatário no caso de comprador estrangeiro
  @foreign_code = attrs[:idEstrangeiro]

  # Address
  if attrs[:enderDest]
    # Logradouro
    @address = attrs[:enderDest][:xLgr]
    # Numero
    @number = attrs[:enderDest][:nro]
    # Complemento
    @complement = attrs[:enderDest][:xCpl]
    # Bairro
    @neighborhood = attrs[:enderDest][:xBairro]
    # Código do município
    @city_code = attrs[:enderDest][:cMun]
    # Nome do município
    @city = attrs[:enderDest][:xMun]
    # Sigla da UF
    @state = attrs[:enderDest][:UF]
    # Código do CEP
    @zip_code = attrs[:enderDest][:CEP]
    # Codigo Pais
    @country_code = attrs[:enderDest][:cPais]
    # Nome do Pais
    @country = attrs[:enderDest][:xPais]
    # Telefone
    @phone = attrs[:enderDest][:fone]
  end
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def address
  @address
end

#cityObject (readonly)

Returns the value of attribute city.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def city
  @city
end

#city_codeObject (readonly)

Returns the value of attribute city_code.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def city_code
  @city_code
end

#city_registrationObject (readonly)

Returns the value of attribute city_registration.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def city_registration
  @city_registration
end

#cnpjObject (readonly)

Returns the value of attribute cnpj.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def cnpj
  @cnpj
end

#complementObject (readonly)

Returns the value of attribute complement.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def complement
  @complement
end

#countryObject (readonly)

Returns the value of attribute country.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def country
  @country
end

#country_codeObject (readonly)

Returns the value of attribute country_code.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def country_code
  @country_code
end

#cpfObject (readonly)

Returns the value of attribute cpf.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def cpf
  @cpf
end

#emailObject (readonly)

Returns the value of attribute email.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def email
  @email
end

#foreign_codeObject (readonly)

Returns the value of attribute foreign_code.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def foreign_code
  @foreign_code
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def name
  @name
end

#neighborhoodObject (readonly)

Returns the value of attribute neighborhood.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def neighborhood
  @neighborhood
end

#numberObject (readonly)

Returns the value of attribute number.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def number
  @number
end

#phoneObject (readonly)

Returns the value of attribute phone.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def phone
  @phone
end

#stateObject (readonly)

Returns the value of attribute state.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def state
  @state
end

#state_registrationObject (readonly)

Returns the value of attribute state_registration.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def state_registration
  @state_registration
end

#state_registration_codeObject (readonly)

Returns the value of attribute state_registration_code.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def state_registration_code
  @state_registration_code
end

#suframaObject (readonly)

Returns the value of attribute suframa.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def suframa
  @suframa
end

#zip_codeObject (readonly)

Returns the value of attribute zip_code.



8
9
10
# File 'lib/nfe_reader/customer.rb', line 8

def zip_code
  @zip_code
end