email_detected 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 79315f08dcc21055770445254efa77c8fc327cf9
4
- data.tar.gz: 856b108d3eddf128133cad9418176e38f2089ebc
3
+ metadata.gz: 347e647a4741ba319e4af10c64e7efd367bf8d5d
4
+ data.tar.gz: 1267dab70b3fbdce14049bed1380978ad0c67494
5
5
  SHA512:
6
- metadata.gz: 2f64c8b4661656aaa8ad5b690aed1d05fff285c352056da0588190d1a9d574a4b5cca9c636c0ce3c956c9289a71a5d8d9de5fd86212836d6606bb3b58dd6c218
7
- data.tar.gz: 24e1f0889957a65fc66cb3ddd2bd1ac621db02930b77be33c96a56e823723d579f1eb01b8eb7afba8c840963706c6732fcb0722b702400feef6f2d58c4524f74
6
+ metadata.gz: 447f8551a3cf83e5dfe843a6d70e073980ed1c8459f2ac9761c1811c0d2ce5a349af17a491578dbb70482b246123e3696cdf9f00bef82caeeb68aafcec1b3654
7
+ data.tar.gz: b0e2086071e5f9a358334402b3b943c31a6ef68c47510fe5baf1fbb306cbdd771e3e5007792741b4474f227bce2d4e34046d4440d52ed9cfb5d96fa70e37cd1d
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # EmailDetected
1
+ # Email Detected
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/email_detected`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Email Detected is a simple tool for verifying an email address exists. It's free and quite easy to use :smile: .
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Many times as developers we were putting validation statements for checking email addresses format. This gem will complete your existing setups with validator that actually connects with a given mail server and asks if the address in question exists for real.
6
6
 
7
7
  ## Installation
8
8
 
@@ -22,7 +22,38 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ To get info about realness of given email address, email_detected connects with a mail server that email's domain points to and pretends to send an email. Some smtp servers will not allow you to do this if you will not present yourself as a real user.
26
+
27
+ This only needs to be something the receiving SMTP server. We aren't actually sending any mail.
28
+
29
+ First thing you need to set up is placing something like this either in initializer or in application.rb file:
30
+
31
+ ```ruby
32
+ EmailDetected.config do |config|
33
+ config.verifier_email = "quannguyen@bestcoder.info"
34
+ end
35
+ ```
36
+
37
+ Then just put this in your model e. g:
38
+
39
+ ```ruby
40
+ validates_exist_email_of :email
41
+ ```
42
+ Or - if you'd like to use it outside of your models:
43
+
44
+ ```ruby
45
+ EmailDetected.exist?(youremail)
46
+ ```
47
+
48
+ This method will return with status `true || false` and `message` look like:
49
+ ```
50
+ {:status=>true, :message=>"The email address has already been registered."}
51
+ ```
52
+
53
+ ```
54
+ {:status=>false, :message=>"The email address invalid."}
55
+ ```
56
+ or will throw an exception with nicely detailed info about what's wrong.
26
57
 
27
58
  ## Development
28
59
 
@@ -1,3 +1,3 @@
1
1
  module EmailDetected
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -10,7 +10,7 @@ module EmailDetected
10
10
 
11
11
  def self.exist?(email)
12
12
  return true if config.test_mode
13
- return { status: false, errors: ['The email address invalid.'] } unless email.match VALID_EMAIL_REGEX
13
+ return { status: false, message: 'The email address invalid.' } unless email.match VALID_EMAIL_REGEX
14
14
  email_detected = EmailDetected::Checker.run(email)
15
15
  if email_detected.invalid?
16
16
  resp = { status: false, message: email_detected.errors.first }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_detected
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nguyen Quan