module Zerobounce::Response::V2Response

V2 specific methods for the API.

Public Instance Methods

did_you_mean() click to toggle source

@return [String, nil]

# File lib/zerobounce/response/v2_response.rb, line 43
def did_you_mean
  @did_you_mean ||= @body[:did_you_mean]
end
disposable?() click to toggle source

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.

@note If you have valid emails with this flag set to true, you shouldn't email them.

@return [Boolean]

# File lib/zerobounce/response/v2_response.rb, line 76
def disposable?
  @disposable ||= sub_status == :disposable
end
domain_age_days() click to toggle source

@return [Integer]

# 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?() click to toggle source

If the email comes from a free provider.

@return [Boolean]

# File lib/zerobounce/response/v2_response.rb, line 64
def free_email?
  @free_email ||= @body[:free_email] || false
end
mx_found?() click to toggle source

Does the domain have an MX record.

@return [Boolean]

# File lib/zerobounce/response/v2_response.rb, line 92
def mx_found?
  @mx_found ||= @body[:mx_found] == 'true'
end
mx_record() click to toggle source

The preferred MX record of the domain.

@return [String, nil]

# File lib/zerobounce/response/v2_response.rb, line 50
def mx_record
  @mx_record ||= @body[:mx_record]
end
processed_at() click to toggle source

The UTC time the email was validated.

@return [Time, nil]

# 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() click to toggle source

The SMTP Provider of the email.

@return [String, nil]

# File lib/zerobounce/response/v2_response.rb, line 38
def smtp_provider
  @smtp_provider ||= @body[:smtp_provider]
end
status() click to toggle source

Deliverability status

@see www.zerobounce.net/docs/email-validation-api-quickstart/#status_codes_v2_

Possible values:

:valid
:invalid
:catch_all
:unknown
:spamtrap
:abuse
:do_not_mail

@return [Symbol, nil] The status as a Symbol.

# 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() click to toggle source

@return [Symbol, nil]

# 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?() click to toggle source

These domains are known for abuse, spam, or are bot created.

@note If you have a valid email with this flag set to true, you shouldn't email them.

@return [Boolean]

# File lib/zerobounce/response/v2_response.rb, line 85
def toxic?
  @toxic ||= sub_status == :toxic
end