module Zerobounce::Response::V1Response

V1 specific methods for the API.

Public Instance Methods

creation_date() click to toggle source

The creation date of the email when available.

@return [Time, nil]

# File lib/zerobounce/response/v1_response.rb, line 91
def creation_date
  @creation_date ||= @body[:creationdate] && Time.parse("#{@body[:creationdate]} UTC")
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/v1_response.rb, line 61
def disposable?
  @disposable ||= @body[:disposable] || false
end
location() click to toggle source

The location of the owner of the email when available.

@return [String, nil]

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

The UTC time the email was validated.

@return [Time, nil]

# File lib/zerobounce/response/v1_response.rb, line 84
def processed_at
  @processed_at ||= @body[:processedat] && Time.parse("#{@body[:processedat]} UTC")
end
status() click to toggle source

Deliverability status

Possible values:

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

@return [Symbol] The status as a Symbol.

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

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

@return [Symbol] The sub_status as a Symbol.

# 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?() 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/v1_response.rb, line 70
def toxic?
  @toxic ||= @body[:toxic] || false
end

Private Instance Methods

underscore(word) click to toggle source

@param [String] word @return [String]

# File lib/zerobounce/response/v1_response.rb, line 99
def underscore(word)
  word.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase.tr('-', '_')
end