Class: Loqate::Phone::PhoneNumberValidation
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Loqate::Phone::PhoneNumberValidation
- Defined in:
- lib/loqate/phone/phone_number_validation.rb
Overview
Result of a phone number validation.
Constant Summary collapse
- IsValid =
Types::Strict::String.enum('Yes', 'No', 'Unknown')
- NumberType =
Types::Strict::String.enum('Mobile', 'Landline', 'Voip', 'Unknown')
Instance Method Summary collapse
-
#country_prefix ⇒ Integer
The country prefix that must be prepended to the number when dialling internationally.
-
#is_valid ⇒ String
Whether the number is valid or not (Unknown returned if validation wasn’t possible).
-
#national_format ⇒ String
The domestic network format (useful for dialling from within the same country).
-
#network_code ⇒ String
The current operator serving the supplied number.
-
#network_country ⇒ String
The country code of the operator.
-
#network_name ⇒ String
The name of the current operator serving the supplied number.
-
#number_type ⇒ String
The type of number that was detected in the request (Mobile, Landline, VOIP or Unknown).
-
#phone_number ⇒ String
The recipient phone number in international format.
-
#request_processed ⇒ Boolean
Returns true if we managed to process the request on the network or false if the validation attempt was unsuccessful.
-
#valid? ⇒ Boolean
Whether the validation was successful or not.
Instance Method Details
#country_prefix ⇒ Integer
The country prefix that must be prepended to the number when dialling internationally.
55 |
# File 'lib/loqate/phone/phone_number_validation.rb', line 55 attribute :country_prefix, Types::Coercible::Integer |
#is_valid ⇒ String
Whether the number is valid or not (Unknown returned if validation wasn’t possible).
25 |
# File 'lib/loqate/phone/phone_number_validation.rb', line 25 attribute :is_valid, IsValid |
#national_format ⇒ String
The domestic network format (useful for dialling from within the same country).
49 |
# File 'lib/loqate/phone/phone_number_validation.rb', line 49 attribute :national_format, Types::Strict::String |
#network_code ⇒ String
The current operator serving the supplied number.
31 |
# File 'lib/loqate/phone/phone_number_validation.rb', line 31 attribute :network_code, Types::Strict::String |
#network_country ⇒ String
The country code of the operator.
43 |
# File 'lib/loqate/phone/phone_number_validation.rb', line 43 attribute :network_country, Types::Strict::String |
#network_name ⇒ String
The name of the current operator serving the supplied number.
37 |
# File 'lib/loqate/phone/phone_number_validation.rb', line 37 attribute :network_name, Types::Strict::String |
#number_type ⇒ String
The type of number that was detected in the request (Mobile, Landline, VOIP or Unknown).
61 |
# File 'lib/loqate/phone/phone_number_validation.rb', line 61 attribute :number_type, NumberType |
#phone_number ⇒ String
The recipient phone number in international format.
12 |
# File 'lib/loqate/phone/phone_number_validation.rb', line 12 attribute :phone_number, Types::Strict::String |
#request_processed ⇒ Boolean
Returns true if we managed to process the request on the network or false if the validation attempt was unsuccessful.
19 |
# File 'lib/loqate/phone/phone_number_validation.rb', line 19 attribute :request_processed, Types::Strict::Bool |
#valid? ⇒ Boolean
Whether the validation was successful or not.
64 65 66 |
# File 'lib/loqate/phone/phone_number_validation.rb', line 64 def valid? is_valid == 'Yes' end |