Class: Loqate::Email::EmailValidation
- Inherits:
-
Dry::Struct::Value
- Object
- Dry::Struct::Value
- Loqate::Email::EmailValidation
- 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
-
#domain ⇒ String
The domain portion of the email address provided.
-
#duration ⇒ Float
The duration (in seconds) that the email validation took (maximum timeout enforced at 15 seconds).
-
#email_address ⇒ String
The email address that verification was attempted on.
-
#invalid? ⇒ Boolean
Whether the email is invalid and shouldn’t be accepted.
-
#is_complainer_or_fraud_risk ⇒ Boolean
True if we recognise the email address against known lists of complainers and/or the email address has been used to defraud.
-
#is_disposable_or_temporary ⇒ Boolean
Whether the email address provided is a disposable mailbox (some companies create temporary mailboxes which shouldn’t be used for marketing communications).
-
#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).
-
#response_message ⇒ String
A textual description of the ResponseCode returned.
-
#timeout? ⇒ Boolean
Whether the validation could not be completed within the timeout specified.
-
#user_account ⇒ String
The account portion of the email address provided.
-
#valid? ⇒ Boolean
Whether the email was fully validated (including the account portion).
-
#valid_domain? ⇒ Boolean
Whether the domain has been validated but the account hasn’t.
Instance Method Details
#domain ⇒ String
The domain portion of the email address provided.
38 |
# File 'lib/loqate/email/email_validation.rb', line 38 attribute :domain, Types::Strict::String |
#duration ⇒ Float
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.
60 |
# File 'lib/loqate/email/email_validation.rb', line 60 attribute :duration, Types::Strict::Float |
#email_address ⇒ String
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.
73 74 75 |
# File 'lib/loqate/email/email_validation.rb', line 73 def invalid? response_code == 'Invalid' end |
#is_complainer_or_fraud_risk ⇒ Boolean
True if we recognise the email address against known lists of complainers and/or the email address has been used to defraud.
52 |
# File 'lib/loqate/email/email_validation.rb', line 52 attribute :is_complainer_or_fraud_risk, Types::Strict::Bool |
#is_disposable_or_temporary ⇒ Boolean
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_message ⇒ String
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.
78 79 80 |
# File 'lib/loqate/email/email_validation.rb', line 78 def timeout? response_code == 'Timeout' end |
#user_account ⇒ String
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).
63 64 65 |
# File 'lib/loqate/email/email_validation.rb', line 63 def valid? response_code == 'Valid' end |
#valid_domain? ⇒ Boolean
Whether the domain has been validated but the account hasn’t.
68 69 70 |
# File 'lib/loqate/email/email_validation.rb', line 68 def valid_domain? response_code == 'Valid' || response_code == 'Valid_CatchAll' end |