email-verification 0.1.6 → 0.1.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd68753b7d1328e375501221b3341bc3742dbd4cc69ea5f061fd8be079f5ca12
4
- data.tar.gz: 398c820a3ea4983a3fdc09bfc83c6ebadb27a5e619176b30a3865696f55cecf1
3
+ metadata.gz: 40c5295be6ea5dc8c233e564f38700dd867a898d4779da25805814541cf964e1
4
+ data.tar.gz: 81df1b1d6623d692d9bb1b6db51c6c64f297a83890a47b49e2c1d01cb097e164
5
5
  SHA512:
6
- metadata.gz: 9b4e9a4ff5f5e37e4ff943fc473f3a467fa79097dd36401c9f3d529e033ba85b01a28a0f66f17da7c2b346ffe8fca06a9a9384c5df207959fc6cb312fc09b8b4
7
- data.tar.gz: b7d5476b7d3dae7999e979dc16cf963f9a1e1932474417fbac73341d0a78127583dc2e5a3fd283e090b18e60eecc148c43f1f824466eb87e19d40c39c2149fad
6
+ metadata.gz: 1be35e0aadea1f5cbf21281e9888ca2e2942e31cc337f25a3be1e43cf5ceb918135bb24b2dc6c5bb16c714f5823548675591f2d2b4139080215a3c862117767a
7
+ data.tar.gz: 7300ddab7e1319cb7c36a3eb66732a5b6268b005201f93f17c7fdc304cb0489ad1bfe54c68401d00c6f839754a92d1c8ea640c112a7b885bd81bb822fc39ce76
@@ -7,7 +7,7 @@ module Email
7
7
  self.configuration = configuration
8
8
  end
9
9
 
10
- def retrieve_verification_code(email:, password:, host:, port: 993, enable_ssl: true, mailboxes: %w(Inbox), settings: {})
10
+ def retrieve_verification_code(email:, password:, host:, port: 993, enable_ssl: true, count: :all, mailboxes: %w(Inbox), settings: {})
11
11
  emails = []
12
12
  result = nil
13
13
 
@@ -21,7 +21,7 @@ module Email
21
21
  end
22
22
 
23
23
  mailboxes.each do |mailbox|
24
- Mail.find(mailbox: mailbox, order: :desc)&.each do |email|
24
+ Mail.find(mailbox: mailbox, order: :desc, count: count)&.each do |email|
25
25
  log("From: #{email.from&.first&.strip}. Subject: #{email.subject}")
26
26
 
27
27
  if settings_provided?(settings)
@@ -2,8 +2,8 @@ module Email
2
2
  module Verification
3
3
  class Hotmail < Base
4
4
 
5
- def retrieve_verification_code(email:, password:, mailboxes: %w(Inbox Junk), settings: {})
6
- super(email: email, password: password, host: "outlook.office365.com", port: 993, enable_ssl: true, mailboxes: mailboxes, settings: settings)
5
+ def retrieve_verification_code(email:, password:, mailboxes: %w(Inbox Junk), count: :all, settings: {})
6
+ super(email: email, password: password, host: "outlook.office365.com", port: 993, enable_ssl: true, mailboxes: mailboxes, count: count, settings: settings)
7
7
  end
8
8
 
9
9
  end
@@ -15,7 +15,7 @@ module Email
15
15
  end
16
16
  end
17
17
 
18
- def retrieve_verification_code(email:, password:, mailboxes: %w(Inbox), settings: {}, wait: 3, retries: 3)
18
+ def retrieve_verification_code(email:, password:, mailboxes: %w(Inbox), count: :all, settings: {}, wait: 3, retries: 3)
19
19
  result = nil
20
20
  service = determine_email_service(email)
21
21
 
@@ -30,20 +30,20 @@ module Email
30
30
 
31
31
  if verifier
32
32
  if settings_provided?(settings) && !wait.nil? && !retries.nil?
33
- result = retrieve_with_retries(verifier, email: email, password: password, mailboxes: mailboxes, settings: settings, wait: wait, retries: retries)
33
+ result = retrieve_with_retries(verifier, email: email, password: password, mailboxes: mailboxes, count: count, settings: settings, wait: wait, retries: retries)
34
34
  else
35
- result = verifier.retrieve_verification_code(email: email, password: password, mailboxes: mailboxes, settings: settings)
35
+ result = verifier.retrieve_verification_code(email: email, password: password, mailboxes: mailboxes, count: count, settings: settings)
36
36
  end
37
37
  end
38
38
 
39
39
  return result
40
40
  end
41
41
 
42
- def retrieve_with_retries(verifier, email:, password:, mailboxes: %w(Inbox), settings: {}, wait: 3, retries: 3)
42
+ def retrieve_with_retries(verifier, email:, password:, mailboxes: %w(Inbox), count: :all, settings: {}, wait: 3, retries: 3)
43
43
  result = nil
44
44
 
45
45
  begin
46
- result = verifier.retrieve_verification_code(email: email, password: password, mailboxes: mailboxes, settings: settings)
46
+ result = verifier.retrieve_verification_code(email: email, password: password, mailboxes: mailboxes, count: count, settings: settings)
47
47
 
48
48
  if result.to_s.empty?
49
49
  sleep wait if wait
@@ -1,5 +1,5 @@
1
1
  module Email
2
2
  module Verification
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email-verification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Johnsson