Class: BrInvoiceDownload::NfeDistribuicaoDfe

Inherits:
Object
  • Object
show all
Defined in:
lib/br_invoice_download/nfe_distribuicao_dfe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ NfeDistribuicaoDfe

Returns a new instance of NfeDistribuicaoDfe.



11
12
13
14
15
# File 'lib/br_invoice_download/nfe_distribuicao_dfe.rb', line 11

def initialize(opts={})
	opts.each do |key, value|
		instance_variable_set("@#{key}", value)
	end
end

Instance Attribute Details

#certificate_pkcs12_passwordObject

Returns the value of attribute certificate_pkcs12_password.



17
18
19
# File 'lib/br_invoice_download/nfe_distribuicao_dfe.rb', line 17

def certificate_pkcs12_password
  @certificate_pkcs12_password
end

#certificate_pkcs12_pathObject

Returns the value of attribute certificate_pkcs12_path.



18
19
20
# File 'lib/br_invoice_download/nfe_distribuicao_dfe.rb', line 18

def certificate_pkcs12_path
  @certificate_pkcs12_path
end

#certificate_pkcs12_value=(value) ⇒ Object

Sets the attribute certificate_pkcs12_value

Parameters:

  • value

    the value to set the attribute certificate_pkcs12_value to.



19
20
21
# File 'lib/br_invoice_download/nfe_distribuicao_dfe.rb', line 19

def certificate_pkcs12_value=(value)
  @certificate_pkcs12_value = value
end

#cnpjObject

Returns the value of attribute cnpj.



21
22
23
# File 'lib/br_invoice_download/nfe_distribuicao_dfe.rb', line 21

def cnpj
  @cnpj
end

#ibge_ufObject

Returns the value of attribute ibge_uf.



20
21
22
# File 'lib/br_invoice_download/nfe_distribuicao_dfe.rb', line 20

def ibge_uf
  @ibge_uf
end

#invoice_keyObject

Returns the value of attribute invoice_key.



22
23
24
# File 'lib/br_invoice_download/nfe_distribuicao_dfe.rb', line 22

def invoice_key
  @invoice_key
end

Instance Method Details

#invoice_hashObject



38
39
40
# File 'lib/br_invoice_download/nfe_distribuicao_dfe.rb', line 38

def invoice_hash
	@invoice ||= handle_invoice
end

#invoice_xmlObject



42
43
44
# File 'lib/br_invoice_download/nfe_distribuicao_dfe.rb', line 42

def invoice_xml
	@invoice_xml ||= handle_invoice_xml
end

#requestObject



28
29
30
31
32
33
34
35
36
# File 'lib/br_invoice_download/nfe_distribuicao_dfe.rb', line 28

def request
	@response = client_wsdl.call(:nfe_dist_d_fe_interesse, xml: soap_xml)
	rescue Savon::SOAPFault => error
		return @response = {request_status: :soap_error,    request_message_error: error.message}
	rescue Savon::HTTPError => error
		return @response = {request_status: :http_error,    request_message_error: error.message}
	rescue Exception => error
		return @response = {request_status: :unknown_error, request_message_error: error.message}
end

#responseObject



24
25
26
# File 'lib/br_invoice_download/nfe_distribuicao_dfe.rb', line 24

def response
	@response
end