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, #nfe_settings, #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

#evento_request_pathsObject



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

def evento_request_paths
  nfe_settings[:evento_request_paths]
end

#evento_return_pathsObject



15
16
17
# File 'lib/br_nfe/product/response/build/nfe_consulta_protocolo.rb', line 15

def evento_return_paths
  nfe_settings[:evento_return_paths]
end

#pathsObject



8
9
10
# File 'lib/br_nfe/product/response/build/nfe_consulta_protocolo.rb', line 8

def paths
  operation.gateway_settings[:xml_paths][:consulta_protocolo][:return_paths]
end

#response_classObject

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

Type: Class



24
25
26
# File 'lib/br_nfe/product/response/build/nfe_consulta_protocolo.rb', line 24

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



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/br_nfe/product/response/build/nfe_consulta_protocolo.rb', line 33

def specific_attributes
  attrs = {
    environment:              body_xml.xpath( paths[:environment],              paths[:namespaces]).text,
    app_version:              body_xml.xpath( paths[:app_version],              paths[:namespaces]).text,
    processed_at:             body_xml.xpath( paths[:processed_at],             paths[:namespaces]).text,
    processing_status_code:   body_xml.xpath( paths[:processing_status_code],   paths[:namespaces]).text,
    processing_status_motive: body_xml.xpath( paths[:processing_status_motive], paths[:namespaces]).text,
    vers:                     xml_version
  }
  set_events!( attrs )
  attrs[:nota_fiscal] = build_invoice_by_prot_nfe( prot_nfe_doc ) if prot_nfe_doc
  set_invoice_situation!( attrs )
  attrs
end