Class: NfsePrefeituraSp::Services::Sync::TesteEnvioLoteRPS
- Inherits:
-
Object
- Object
- NfsePrefeituraSp::Services::Sync::TesteEnvioLoteRPS
- Defined in:
- lib/nfse_prefeitura_sp/services/sync/teste_envio_lote_rps.rb
Overview
TestePedidoEnvioLoteRPS
Constant Summary collapse
- OPERATION_REQUEST =
:teste_envio_lote_rps- OPERATION_RESPONSE =
:teste_envio_lote_rps_response
Instance Method Summary collapse
-
#initialize(data, signer) ⇒ TesteEnvioLoteRPS
constructor
A new instance of TesteEnvioLoteRPS.
- #request_xml ⇒ Object
Constructor Details
#initialize(data, signer) ⇒ TesteEnvioLoteRPS
Returns a new instance of TesteEnvioLoteRPS.
6 7 8 9 10 |
# File 'lib/nfse_prefeitura_sp/services/sync/teste_envio_lote_rps.rb', line 6 def initialize(data, signer) @data = data @signer = signer @rps = NfsePrefeituraSp::Types::TpRps.new('RPS', @data, @signer) end |
Instance Method Details
#request_xml ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/nfse_prefeitura_sp/services/sync/teste_envio_lote_rps.rb', line 12 def request_xml builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml| xml.PedidoEnvioLoteRPS("xmlns" => "http://www.prefeitura.sp.gov.br/nfe") do xml.Cabecalho('Versao' => '2', 'xmlns' => '') do xml.CPFCNPJRemetente do xml.CNPJ @data[:cnpj_remetente] end xml.transacao false xml.dtInicio @data[:dt_inicio] xml.dtFim @data[:dt_fim] xml.QtdRPS 1 end @rps.add_tag_to_xml(xml, 'xmlns' => '') end end signed_xml = @signer.sign_xml(builder.to_xml) ("<VersaoSchema>#{NfsePrefeituraSp::XSD_VERSION.to_s}</VersaoSchema><MensagemXML>" + "<![CDATA[#{signed_xml}]]>" + "</MensagemXML>").gsub(/\n/,'') end |