Module: Zerobounce::Response::V2Response
- Defined in:
- lib/zerobounce/response/v2_response.rb
Overview
V2 specific methods for the API.
Instance Method Summary collapse
- #did_you_mean ⇒ String?
-
#disposable? ⇒ Boolean
If the email domain is disposable, which are usually temporary email addresses.
- #domain_age_days ⇒ Integer
-
#free_email? ⇒ Boolean
If the email comes from a free provider.
-
#mx_found? ⇒ Boolean
Does the domain have an MX record.
-
#mx_record ⇒ String?
The preferred MX record of the domain.
-
#processed_at ⇒ Time?
The UTC time the email was validated.
-
#smtp_provider ⇒ String?
The SMTP Provider of the email.
-
#status ⇒ Symbol?
Deliverability status.
- #sub_status ⇒ Symbol?
-
#toxic? ⇒ Boolean
These domains are known for abuse, spam, or are bot created.
Instance Method Details
#did_you_mean ⇒ String?
43 44 45 |
# File 'lib/zerobounce/response/v2_response.rb', line 43 def did_you_mean @did_you_mean ||= @body[:did_you_mean] end |
#disposable? ⇒ Boolean
If you have valid emails with this flag set to true
, you shouldn’t email them.
If the email domain is disposable, which are usually temporary email addresses.
These are temporary emails created for the sole purpose to sign up to websites without giving their real email address. These emails are short lived from 15 minutes to around 6 months.
76 77 78 |
# File 'lib/zerobounce/response/v2_response.rb', line 76 def disposable? @disposable ||= sub_status == :disposable end |
#domain_age_days ⇒ Integer
31 32 33 |
# File 'lib/zerobounce/response/v2_response.rb', line 31 def domain_age_days @domain_age_days ||= @body[:domain_age_days].to_i end |
#free_email? ⇒ Boolean
If the email comes from a free provider.
64 65 66 |
# File 'lib/zerobounce/response/v2_response.rb', line 64 def free_email? @free_email ||= @body[:free_email] || false end |
#mx_found? ⇒ Boolean
Does the domain have an MX record.
92 93 94 |
# File 'lib/zerobounce/response/v2_response.rb', line 92 def mx_found? @mx_found ||= @body[:mx_found] == 'true' end |
#mx_record ⇒ String?
The preferred MX record of the domain.
50 51 52 |
# File 'lib/zerobounce/response/v2_response.rb', line 50 def mx_record @mx_record ||= @body[:mx_record] end |
#processed_at ⇒ Time?
The UTC time the email was validated.
57 58 59 |
# File 'lib/zerobounce/response/v2_response.rb', line 57 def processed_at @processed_at ||= @body[:processed_at] && Time.parse("#{@body[:processed_at]} UTC") end |
#smtp_provider ⇒ String?
The SMTP Provider of the email.
38 39 40 |
# File 'lib/zerobounce/response/v2_response.rb', line 38 def smtp_provider @smtp_provider ||= @body[:smtp_provider] end |
#status ⇒ Symbol?
Deliverability status
Possible values:
:valid
:invalid
:catch_all
:unknown
:spamtrap
:abuse
:do_not_mail
21 22 23 |
# File 'lib/zerobounce/response/v2_response.rb', line 21 def status @status ||= @body[:status].to_s.empty? ? nil : @body[:status].tr('-', '_').to_sym end |
#sub_status ⇒ Symbol?
26 27 28 |
# File 'lib/zerobounce/response/v2_response.rb', line 26 def sub_status @sub_status ||= @body[:sub_status].to_s.empty? ? nil : @body[:sub_status].to_sym end |
#toxic? ⇒ Boolean
If you have a valid email with this flag set to true
, you shouldn’t email them.
These domains are known for abuse, spam, or are bot created.
85 86 87 |
# File 'lib/zerobounce/response/v2_response.rb', line 85 def toxic? @toxic ||= sub_status == :toxic end |