notasegura 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/notasegura.rb +17 -0
- metadata +1 -1
data/lib/notasegura.rb
CHANGED
@@ -59,6 +59,23 @@ class NotaSegura
|
|
59
59
|
return resultado
|
60
60
|
end
|
61
61
|
|
62
|
+
def reenviar_email(chave, email)
|
63
|
+
begin
|
64
|
+
url = "#{@url}/api/invoices/resend"
|
65
|
+
url = "#{url}?token=#{@token}" if @token
|
66
|
+
requisicao = RestClient::Resource.new(url, @email, @senha)
|
67
|
+
resposta = requisicao.post({:email => email, :key => chave})
|
68
|
+
resultado = XmlSimple.xml_in resposta
|
69
|
+
return resultado
|
70
|
+
rescue => e
|
71
|
+
if e.message.include? '401'
|
72
|
+
raise AuthError, 'Erro ao autenticar: token inválido'
|
73
|
+
else
|
74
|
+
raise RequestError, "Erro ao reenviar email: #{e}"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
62
79
|
private
|
63
80
|
|
64
81
|
def ler_xml!
|