Class: BrNfe::Service::Response::Build::ConsultaSituacaoLoteRps

Inherits:
Base show all
Defined in:
lib/br_nfe/service/response/build/consulta_situacao_lote_rps.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#body_xml_path, #keys_root_path, #message_code_key, #message_errors_path, #message_msg_key, #message_solution_key, #savon_response, #xml_encode

Attributes inherited from ActiveModelBase

#reference

Instance Method Summary collapse

Methods inherited from Base

#body_converted_to_xml, #find_value_for_keys, #get_lot_number, #get_message_for_hash, #get_message_for_path, #path_with_root, #savon_body

Methods inherited from ActiveModelBase

#assign_attributes, #initialize

Constructor Details

This class inherits a constructor from BrNfe::ActiveModelBase

Instance Attribute Details

#lot_number_pathObject

o numero do lote



10
11
12
# File 'lib/br_nfe/service/response/build/consulta_situacao_lote_rps.rb', line 10

def lot_number_path
  @lot_number_path
end

#situation_key_valuesObject

Returns the value of attribute situation_key_values.



15
16
17
# File 'lib/br_nfe/service/response/build/consulta_situacao_lote_rps.rb', line 15

def situation_key_values
  @situation_key_values
end

#situation_pathObject

a situação do lote rps



13
14
15
# File 'lib/br_nfe/service/response/build/consulta_situacao_lote_rps.rb', line 13

def situation_path
  @situation_path
end

Instance Method Details

#default_valuesObject



25
26
27
28
29
30
31
# File 'lib/br_nfe/service/response/build/consulta_situacao_lote_rps.rb', line 25

def default_values
	super.merge({
		message_errors_path: [:consultar_situacao_lote_rps_resposta, :lista_mensagem_retorno, :mensagem_retorno],
		lot_number_path:     [:consultar_situacao_lote_rps_resposta, :numero_lote],
		situation_path:      [:consultar_situacao_lote_rps_resposta, :situacao],
	})
end

#get_situationObject

Método utilizado para pegar a situação do RPS

Tipo de retorno: Symbol



47
48
49
50
51
# File 'lib/br_nfe/service/response/build/consulta_situacao_lote_rps.rb', line 47

def get_situation
	situation_value = find_value_for_keys(savon_body, path_with_root(situation_path))
	situation_value = situation_key_values[situation_value.to_s.strip] if situation_value.present?
	situation_value
end

#responseObject

FIM DA DEFINIÇÃO DOS CAMINHOS ############################



34
35
36
37
38
39
40
41
# File 'lib/br_nfe/service/response/build/consulta_situacao_lote_rps.rb', line 34

def response
	@response ||= BrNfe::Service::Response::ConsultaSituacaoLoteRps.new({
		error_messages:   get_message_for_path(message_errors_path),
		numero_lote:      get_lot_number,
		situation:        get_situation,
		original_xml:     savon_response.xml.force_encoding('UTF-8'),
	})
end