Class: BrNfe::Service::Response::Build::RecepcaoLoteRps

Inherits:
Base show all
Defined in:
lib/br_nfe/service/response/build/recepcao_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_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/recepcao_lote_rps.rb', line 10

def lot_number_path
  @lot_number_path
end

#protocol_pathObject

o protocolo



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

def protocol_path
  @protocol_path
end

#received_date_pathObject

a data de recebimento do xml



16
17
18
# File 'lib/br_nfe/service/response/build/recepcao_lote_rps.rb', line 16

def received_date_path
  @received_date_path
end

Instance Method Details

#default_valuesObject



18
19
20
21
22
23
24
25
# File 'lib/br_nfe/service/response/build/recepcao_lote_rps.rb', line 18

def default_values
	super.merge({
		lot_number_path:     [:enviar_lote_rps_resposta, :numero_lote],
		protocol_path:       [:enviar_lote_rps_resposta, :protocolo],
		received_date_path:  [:enviar_lote_rps_resposta, :data_recebimento],
		message_errors_path: [:enviar_lote_rps_resposta, :lista_mensagem_retorno, :mensagem_retorno]
	})
end

#get_lot_numberObject

Método utilizado para pegar o número do lote RPS

Tipo de retorno: String



62
63
64
# File 'lib/br_nfe/service/response/build/recepcao_lote_rps.rb', line 62

def get_lot_number
	find_value_for_keys(savon_body, path_with_root(lot_number_path))
end

#get_protocolObject

Método utilizado para pegar protocolo de solicitação de processamento do RPS. Esse protocolo é utilizado posteriormente para consultar se o RPS já foi processado

Tipo de retorno: String



46
47
48
# File 'lib/br_nfe/service/response/build/recepcao_lote_rps.rb', line 46

def get_protocol
	find_value_for_keys(savon_body, path_with_root(protocol_path))
end

#get_received_dateObject

Método utilizado para pegar a data de recebimento do lote

Tipo de retorno: String



54
55
56
# File 'lib/br_nfe/service/response/build/recepcao_lote_rps.rb', line 54

def get_received_date
	find_value_for_keys(savon_body, path_with_root(received_date_path))
end

#responseObject

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



29
30
31
32
33
34
35
36
37
# File 'lib/br_nfe/service/response/build/recepcao_lote_rps.rb', line 29

def response
	@response ||= BrNfe::Service::Response::RecepcaoLoteRps.new({
		original_xml:     savon_response.xml.force_encoding('UTF-8'),
		error_messages:   get_message_for_path(message_errors_path),
		protocolo:        get_protocol,
		data_recebimento: get_received_date,
		numero_lote:      get_lot_number,
	})
end