email-verification 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 280d7dfab6e3eb5b6f4fe8aa6e95423d19f6f7a0fc575c42b8c357d113ea4801
4
- data.tar.gz: 53805c28a691d7285c7c12c05be4f14e46328829c46a501e9954a4b14dc6f81b
3
+ metadata.gz: 5a2ca2ec0c71fd1e8c9fe8b6a36ae069194c4a6236a5881476727c25bfe493a2
4
+ data.tar.gz: 55c3024fdeb7431747d79a7bbae9107136fc27a0b9bb7a58c48042f1063a783c
5
5
  SHA512:
6
- metadata.gz: 6813e1ef4ae7155ea78180943982d5f1acf775d3612ed32ebde9c6fa7abc94558ad71d5acc4c1ff9617cff00ba589f8b8d4cfce561b446b4d0e3834a838e07e2
7
- data.tar.gz: 1b3d4bd66d845ba96cc4c53c0c3fc0708adb730189acf3197c5415fe513a7c03cb55a53e664203a3bc1f088f7195a5aaa18e94c2731c4eeb238b66db73af3409
6
+ metadata.gz: d25a42c1af2d6a26cc686ed11b5158d00d4653ff20e5e83739ca0c3dc32a034df31a94e4ee33597a37ba92f6c917549eba7b8ebcd8fe60d0c7518382f5721c3c
7
+ data.tar.gz: 1496fbeb77c1e864a767110230fd1b12d34aff61cb5756e1772ece1931bafd08a415681a4a457c79adac06819ec9aff68a19a3c9598e186bc04f394e55f93de8
@@ -5,6 +5,7 @@ module Email
5
5
  class Error < StandardError; end
6
6
  class InvalidCredentialsError < Email::Verification::Errors::Error; end
7
7
  class ImapNotSupportedError < Email::Verification::Errors::Error; end
8
+ class InvalidProxyError < Email::Verification::Errors::Error; end
8
9
 
9
10
  end
10
11
  end
@@ -20,21 +20,27 @@ module Email
20
20
 
21
21
  def retrieve_verification_code(email:, password:, mailboxes: %w(Inbox), count: :all, settings: {}, proxy: nil, wait: 3, retries: 3)
22
22
  service = determine_email_service(email)
23
+ result = nil
23
24
 
24
- result = case service
25
- when :gmail
26
- perform_retrieval(::Email::Verification::Gmail.new, email: email, password: password, mailboxes: mailboxes, count: count, settings: settings, proxy: proxy, wait: wait, retries: retries)
27
- when :hotmail
28
- perform_retrieval(::Email::Verification::Hotmail.new, email: email, password: password, mailboxes: mailboxes, count: count, settings: settings, proxy: proxy, wait: wait, retries: retries)
29
- when :protonmail, :tutanota
30
- if self.mode.eql?(:interactive)
31
- puts "[Email::Verification::Verifier] - #{Time.now}: You're using an email account that doesn't have support for POP3 or IMAP. You have to manually retrieve the code or URL from the account and post it below."
32
- capture_cli_input(email)
25
+ begin
26
+ result = case service
27
+ when :gmail
28
+ perform_retrieval(::Email::Verification::Gmail.new, email: email, password: password, mailboxes: mailboxes, count: count, settings: settings, proxy: proxy, wait: wait, retries: retries)
29
+ when :hotmail
30
+ perform_retrieval(::Email::Verification::Hotmail.new, email: email, password: password, mailboxes: mailboxes, count: count, settings: settings, proxy: proxy, wait: wait, retries: retries)
31
+ when :protonmail, :tutanota
32
+ if self.mode.eql?(:interactive)
33
+ puts "[Email::Verification::Verifier] - #{Time.now}: You're using an email account that doesn't have support for POP3 or IMAP. You have to manually retrieve the code or URL from the account and post it below."
34
+ capture_cli_input(email)
35
+ else
36
+ raise ::Email::Verification::Errors::ImapNotSupportedError.new("#{service} doesn't have support for IMAP or POP3 retrieval! Please switch to interactive mode or use another provider!")
37
+ end
33
38
  else
34
- raise ::Email::Verification::Errors::ImapNotSupportedError.new("#{service} doesn't have support for IMAP or POP3 retrieval! Please switch to interactive mode or use another provider!")
35
- end
36
- else
37
- nil
39
+ nil
40
+ end
41
+
42
+ rescue Net::HTTPServerException => e
43
+ raise ::Email::Verification::Errors::InvalidProxyError.new("Proxy isn't working, please retry with a new proxy!")
38
44
  end
39
45
 
40
46
  return result
@@ -1,5 +1,5 @@
1
1
  module Email
2
2
  module Verification
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email-verification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Johnsson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-21 00:00:00.000000000 Z
11
+ date: 2019-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gmail