Class: Loqate::Email::EmailValidation

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/loqate/email/email_validation.rb

Overview

Result of a email address validation.

Constant Summary collapse

ResponseCode =
Types::Strict::String.enum('Valid', 'Valid_CatchAll', 'Invalid', 'Timeout')

Instance Method Summary collapse

Instance Method Details

#domainString

The domain portion of the email address provided.



38
# File 'lib/loqate/email/email_validation.rb', line 38

attribute :domain, Types::Strict::String

#durationFloat

The duration (in seconds) that the email validation took (maximum timeout enforced at 15 seconds). We recommend a high timeout (at least 5 seconds) value as it will minimise the number of “Timeout” responses returned.



53
# File 'lib/loqate/email/email_validation.rb', line 53

attribute :duration, Types::Coercible::Float

#email_addressString

The email address that verification was attempted on.



26
# File 'lib/loqate/email/email_validation.rb', line 26

attribute :email_address, Types::Strict::String

#invalid?Boolean

Whether the email is invalid and shouldn’t be accepted.



66
67
68
# File 'lib/loqate/email/email_validation.rb', line 66

def invalid?
  response_code == 'Invalid'
end

#is_disposable_or_temporaryBoolean

Whether the email address provided is a disposable mailbox (some companies create temporary mailboxes which shouldn’t be used for marketing communications).



45
# File 'lib/loqate/email/email_validation.rb', line 45

attribute :is_disposable_or_temporary, Types::Strict::Bool

#response_code'Valid', ...

Valid - The email address has been fully validated (including the account portion) Valid_CatchAll - The domain has been validated but the account could not be validated Invalid - The email address is invalid and shouldn’t be accepted Timeout - The validation could not be completed within the timeout specified (try increasing the timeout value)



14
# File 'lib/loqate/email/email_validation.rb', line 14

attribute :response_code, ResponseCode

#response_messageString

A textual description of the ResponseCode returned



20
# File 'lib/loqate/email/email_validation.rb', line 20

attribute :response_message, Types::Strict::String

#timeout?Boolean

Whether the validation could not be completed within the timeout specified.



71
72
73
# File 'lib/loqate/email/email_validation.rb', line 71

def timeout?
  response_code == 'Timeout'
end

#user_accountString

The account portion of the email address provided.



32
# File 'lib/loqate/email/email_validation.rb', line 32

attribute :user_account, Types::Strict::String

#valid?Boolean

Whether the email was fully validated (including the account portion).



56
57
58
# File 'lib/loqate/email/email_validation.rb', line 56

def valid?
  response_code == 'Valid'
end

#valid_domain?Boolean

Whether the domain has been validated but the account hasn’t.



61
62
63
# File 'lib/loqate/email/email_validation.rb', line 61

def valid_domain?
  response_code == 'Valid' || response_code == 'Valid_CatchAll'
end