Module: Zerobounce::Response::V1Response

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

Overview

V1 specific methods for the API.

Instance Method Summary collapse

Instance Method Details

#creation_dateTime?

The creation date of the email when available.

Returns:

  • (Time, nil)


91
92
93
# File 'lib/zerobounce/response/v1_response.rb', line 91

def creation_date
  @creation_date ||= @body[:creationdate] && Time.parse("#{@body[:creationdate]} UTC")
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)


61
62
63
# File 'lib/zerobounce/response/v1_response.rb', line 61

def disposable?
  @disposable ||= @body[:disposable] || false
end

#locationString?

The location of the owner of the email when available.

Returns:

  • (String, nil)


77
78
79
# File 'lib/zerobounce/response/v1_response.rb', line 77

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

#processed_atTime?

The UTC time the email was validated.

Returns:

  • (Time, nil)


84
85
86
# File 'lib/zerobounce/response/v1_response.rb', line 84

def processed_at
  @processed_at ||= @body[:processedat] && Time.parse("#{@body[:processedat]} UTC")
end

#statusSymbol

Deliverability status

Possible values:

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

Returns:

  • (Symbol)

    The status as a Symbol.



19
20
21
# File 'lib/zerobounce/response/v1_response.rb', line 19

def status
  @status ||= @body[:status].to_s.empty? ? nil : underscore(@body[:status]).to_sym
end

#sub_statusSymbol

A more detailed status

Possible values:

:antispam_system
:greylisted
:mail_server_temporary_error
:forcible_disconnect
:mail_server_did_not_respond
:timeout_exceeded
:failed_smtp_connection
:mailbox_quota_exceeded
:exception_occurred
:possible_traps
:role_based
:global_suppression
:mailbox_not_found
:no_dns_entries
:failed_syntax_check
:possible_typo
:unroutable_ip_address
:leading_period_removed
:does_not_accept_mail
:alias_address
:unknown

Returns:

  • (Symbol)

    The sub_status as a Symbol.



49
50
51
# File 'lib/zerobounce/response/v1_response.rb', line 49

def sub_status
  @sub_status ||= @body[:sub_status].to_s.empty? ? nil : underscore(@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)


70
71
72
# File 'lib/zerobounce/response/v1_response.rb', line 70

def toxic?
  @toxic ||= @body[:toxic] || false
end