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

#pathsObject



7
8
9
# File 'lib/br_nfe/product/response/build/nfe_status_servico.rb', line 7

def paths
  operation.gateway_settings[:xml_paths][:status_servico][: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



16
17
18
# File 'lib/br_nfe/product/response/build/nfe_status_servico.rb', line 16

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



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/br_nfe/product/response/build/nfe_status_servico.rb', line 27

def specific_attributes
  {
    
    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,
    uf:                       body_xml.xpath( paths[:uf],           paths[:namespaces]).text,
    average_time:             body_xml.xpath( paths[:average_time],  paths[:namespaces]).text.to_i,
    observation:              body_xml.xpath( paths[:observation],  paths[:namespaces]).text,
    return_prevision:         body_xml.xpath( paths[:return_prevision],   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,
    
  }
end