Class: BrNfe::Product::Response::Build::NfeStatusServico

Inherits:
Base show all
Defined in:
lib/br_nfe/product/response/build/nfe_status_servico.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



12
13
14
# File 'lib/br_nfe/product/response/build/nfe_status_servico.rb', line 12

def response_class
	BrNfe::Product::Response::NfeStatusServico
end

#specific_attributesObject

Responsável por setar os atributos específicos para cada tipo de operação. Nesse caso irá setar as notas fiscais com seus respectivos XMLs.

Type: Hash



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

def specific_attributes
	{
		environment:              body_xml.xpath('//ret:nfeStatusServicoNF2Result/nf:retConsStatServ/nf:tpAmb',    nf: nf_xmlns, ret: url_xmlns_retorno).text,
		app_version:              body_xml.xpath('//ret:nfeStatusServicoNF2Result/nf:retConsStatServ/nf:verAplic', nf: nf_xmlns, ret: url_xmlns_retorno).text,
		processed_at:             body_xml.xpath('//ret:nfeStatusServicoNF2Result/nf:retConsStatServ/nf:dhRecbto', nf: nf_xmlns, ret: url_xmlns_retorno).text,
		
		processing_status_code:   body_xml.xpath('//ret:nfeStatusServicoNF2Result/nf:retConsStatServ/nf:cStat',    nf: nf_xmlns, ret: url_xmlns_retorno).text,
		processing_status_motive: body_xml.xpath('//ret:nfeStatusServicoNF2Result/nf:retConsStatServ/nf:xMotivo',  nf: nf_xmlns, ret: url_xmlns_retorno).text,
		
		uf:               body_xml.xpath('//ret:nfeStatusServicoNF2Result/nf:retConsStatServ/nf:cUF',  nf: nf_xmlns, ret: url_xmlns_retorno).text,
		average_time:     body_xml.xpath('//ret:nfeStatusServicoNF2Result/nf:retConsStatServ/nf:tMed',  nf: nf_xmlns, ret: url_xmlns_retorno).text.to_i,
		observation:      body_xml.xpath('//ret:nfeStatusServicoNF2Result/nf:retConsStatServ/nf:xObs',  nf: nf_xmlns, ret: url_xmlns_retorno).text,
		return_prevision: body_xml.xpath('//ret:nfeStatusServicoNF2Result/nf:retConsStatServ/nf:dhRetorno',  nf: nf_xmlns, ret: url_xmlns_retorno).text,
	}
end