Sha256: 0e15313fcd26398d493e6632d3a321bc3a6c44f75a2323f65eb1bef27837d321
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
require 'savon' module Sigiss module Integration def issue! send(:gerar_nota, data_issue) end def fetch! send(:consultar_nota_valida, data_fetch) end def cancel! send(:cancelar_nota, data_cancel) end def data_issue { DescricaoRps: provider.to_hash.merge(taker.to_hash).merge(data.to_hash) } end def data_fetch { DadosConsultaNota: provider.to_fetch.merge(data.to_hash) } end def data_cancel { DadosCancelaNota: provider.to_cancel.merge(data.to_hash) } end protected def send(action, data) execute do client = Savon.client(wsdl: gateway.url, convert_request_keys_to: :none, log: false) response = client.call(action, message: data) @success, @response = true, response.body end end def execute(&block) yield rescue Timeout::Error => e @success, @response = false, { error: e.message } rescue Savon::SOAPFault => e @success, @response = false, { error: e.message } rescue Exception => e @success, @response = false, { error: e.message } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sigiss-0.1.4 | lib/sigiss/integration.rb |
sigiss-0.1.3 | lib/sigiss/integration.rb |
sigiss-0.1.2 | lib/sigiss/integration.rb |