Module: Zerobounce::Response::V2Response

Defined in:
lib/zerobounce/response/v2_response.rb

Overview

V2 specific methods for the API.

Instance Method Summary collapse

Instance Method Details

#did_you_meanString?

Returns:

  • (String, nil)


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

Note:

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.

Returns:

  • (Boolean)


76
77
78
# File 'lib/zerobounce/response/v2_response.rb', line 76

def disposable?
  @disposable ||= sub_status == :disposable
end

#domain_age_daysInteger

Returns:

  • (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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


92
93
94
# File 'lib/zerobounce/response/v2_response.rb', line 92

def mx_found?
  @mx_found ||= @body[:mx_found] == 'true'
end

#mx_recordString?

The preferred MX record of the domain.

Returns:

  • (String, nil)


50
51
52
# File 'lib/zerobounce/response/v2_response.rb', line 50

def mx_record
  @mx_record ||= @body[:mx_record]
end

#processed_atTime?

The UTC time the email was validated.

Returns:

  • (Time, nil)


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_providerString?

The SMTP Provider of the email.

Returns:

  • (String, nil)


38
39
40
# File 'lib/zerobounce/response/v2_response.rb', line 38

def smtp_provider
  @smtp_provider ||= @body[:smtp_provider]
end

#statusSymbol?

Deliverability status

Possible values:

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

Returns:

  • (Symbol, nil)

    The status as a Symbol.

See Also:



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_statusSymbol?

Returns:

  • (Symbol, nil)


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

Note:

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.

Returns:

  • (Boolean)


85
86
87
# File 'lib/zerobounce/response/v2_response.rb', line 85

def toxic?
  @toxic ||= sub_status == :toxic
end