Class: Nfe::Reader::Provider

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

Overview

Identificação do Emitente 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 = {}) ⇒ Provider

Fields Values

CRT: 1 - Simples Nacional,

2 - Simples Nacional – excesso de sublimite de receita bruta,
3 - Regime Normal


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
# File 'lib/nfe_reader/provider.rb', line 18

def initialize(attrs = {})
  # Provider Info
  @cnpj = attrs[:CNPJ]
  @cpf = attrs[:CPF]
  @name = attrs[:xNome]
  @fantasy = attrs[:xFant]
  @state_registration = attrs[:IE]
  @state_registration_st = attrs[:IEST]
  @city_registration = attrs[:IM]
  @regime = attrs[:CRT]
  @cnae = attrs[:CNAE]

  # Address
  if attrs[:enderEmit]
    @phone = attrs[:enderEmit][:fone]
    @address = attrs[:enderEmit][:xLgr]
    @number = attrs[:enderEmit][:nro]
    @complement = attrs[:enderEmit][:xCpl]
    @neighborhood = attrs[:enderEmit][:xBairro]
    @city_code = attrs[:enderEmit][:cMun]
    @city = attrs[:enderEmit][:xMun]
    @zip_code = attrs[:enderEmit][:CEP]
    @country_code = attrs[:enderEmit][:cPais]
    @country = attrs[:enderEmit][:xPais]
    @state = attrs[:enderEmit][:UF]
  end
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



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

def address
  @address
end

#cityObject (readonly)

Returns the value of attribute city.



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

def city
  @city
end

#city_codeObject (readonly)

Returns the value of attribute city_code.



8
9
10
# File 'lib/nfe_reader/provider.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/provider.rb', line 8

def city_registration
  @city_registration
end

#cnaeObject (readonly)

Returns the value of attribute cnae.



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

def cnae
  @cnae
end

#cnpjObject (readonly)

Returns the value of attribute cnpj.



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

def cnpj
  @cnpj
end

#complementObject (readonly)

Returns the value of attribute complement.



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

def complement
  @complement
end

#countryObject (readonly)

Returns the value of attribute country.



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

def country
  @country
end

#country_codeObject (readonly)

Returns the value of attribute country_code.



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

def country_code
  @country_code
end

#cpfObject (readonly)

Returns the value of attribute cpf.



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

def cpf
  @cpf
end

#fantasyObject (readonly)

Returns the value of attribute fantasy.



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

def fantasy
  @fantasy
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#neighborhoodObject (readonly)

Returns the value of attribute neighborhood.



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

def neighborhood
  @neighborhood
end

#numberObject (readonly)

Returns the value of attribute number.



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

def number
  @number
end

#phoneObject (readonly)

Returns the value of attribute phone.



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

def phone
  @phone
end

#regimeObject (readonly)

Returns the value of attribute regime.



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

def regime
  @regime
end

#stateObject (readonly)

Returns the value of attribute state.



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

def state
  @state
end

#state_registrationObject (readonly)

Returns the value of attribute state_registration.



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

def state_registration
  @state_registration
end

#state_registration_stObject (readonly)

Returns the value of attribute state_registration_st.



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

def state_registration_st
  @state_registration_st
end

#zip_codeObject (readonly)

Returns the value of attribute zip_code.



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

def zip_code
  @zip_code
end