Class: BrNfe::Product::Response::Build::NfeConsultaProtocolo

Inherits:
Base show all
Defined in:
lib/br_nfe/product/response/build/nfe_consulta_protocolo.rb

Instance Attribute Summary

Attributes inherited from Base

#operation, #savon_response

Attributes inherited from ActiveModelBase

#reference

Instance Method Summary collapse

Methods inherited from Base

#body_xml, #doc_original_xml, #header_xml, #nf_xmlns, #original_xml, #response, #response_xml, #url_xmlns_retorno, #xml_version, #xml_version_str

Methods inherited from ActiveModelBase

#assign_attributes, #default_values, #initialize

Constructor Details

This class inherits a constructor from BrNfe::ActiveModelBase

Instance Method Details

#response_classObject

Responsável por definir qual classe será instânciada para setar os valores de retorno referentes a cada operação.

Type: Class



13
14
15
# File 'lib/br_nfe/product/response/build/nfe_consulta_protocolo.rb', line 13

def response_class
	BrNfe::Product::Response::NfeConsultaProtocolo
end

#specific_attributesObject

Responsável por setar os atributos específicos para cada tipo de operação.

Type: Hash



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/br_nfe/product/response/build/nfe_consulta_protocolo.rb', line 22

def specific_attributes
	attrs = {
		environment:              body_xml.xpath('//ret:nfeConsultaNF2Result/nf:retConsSitNFe/nf:tpAmb',    nf: nf_xmlns, ret: url_xmlns_retorno).text,
		app_version:              body_xml.xpath('//ret:nfeConsultaNF2Result/nf:retConsSitNFe/nf:verAplic', nf: nf_xmlns, ret: url_xmlns_retorno).text,
		processed_at:             request_processed_at,
		processing_status_code:   get_processing_status_code,
		processing_status_motive: get_processing_status_motive,
	}

	set_events!( attrs )

	attrs[:nota_fiscal] = build_invoice_by_prot_nfe( prot_nfe_doc ) if prot_nfe_doc

	set_invoice_situation!( attrs )

	attrs
end