lib/cieloz/requisicao.rb in cieloz-0.0.2 vs lib/cieloz/requisicao.rb in cieloz-0.0.3
- old
+ new
@@ -50,10 +50,10 @@
end
end
def parse res
body = res.body.force_encoding("ISO-8859-1").encode "UTF-8"
- return Erro.new(codigo: res.code, mensagem: body) if res.code != "200"
+ return Erro.from(body).tap { |e| e.codigo = res.code } if res.code != "200"
root = Nokogiri::XML(body).root
response_class = case root.name
when 'erro' then Erro
when 'transacao' then Transacao