notasegura 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/notasegura.rb +17 -0
  2. 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!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notasegura
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: