Sha256: bae6cb2eb7116cff6d6b6f44ea28373b4cb5b9691c475be7e894531047e74233
Contents?: true
Size: 1.94 KB
Versions: 2
Compression:
Stored size: 1.94 KB
Contents
module Loqate module Phone # Result of a phone number validation. class PhoneNumberValidation < Dry::Struct IsValid = Types::Strict::String.enum('Yes', 'No', 'Unknown', 'Maybe') NumberType = Types::Strict::String.enum('Mobile', 'Landline', 'Voip', 'Unknown') # The recipient phone number in international format. # # @return [String] # attribute :phone_number, Types::Strict::String # Returns true if we managed to process the request on the network or false if the validation # attempt was unsuccessful. # # @return [Boolean] # attribute :request_processed, Types::Strict::Bool # Whether the number is valid or not (Unknown returned if validation wasn't possible). # # @return [String] # attribute :is_valid, IsValid # The current operator serving the supplied number. # # @return [String] # attribute :network_code, Types::Strict::String # The name of the current operator serving the supplied number. # # @return [String] # attribute :network_name, Types::Strict::String # The country code of the operator. # # @return [String] # attribute :network_country, Types::Strict::String # The domestic network format (useful for dialling from within the same country). # # @return [String] # attribute :national_format, Types::Strict::String # The country prefix that must be prepended to the number when dialling internationally. # # @return [Integer] # attribute :country_prefix, Types::Coercible::Integer # The type of number that was detected in the request (Mobile, Landline, VOIP or Unknown). # # @return [String] # attribute :number_type, NumberType # Whether the validation was successful or not. def valid? is_valid == 'Yes' end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
loqate-0.12.0 | lib/loqate/phone/phone_number_validation.rb |
loqate-0.11.1 | lib/loqate/phone/phone_number_validation.rb |