lib/descope/mixins/common.rb in descope-1.0.5 vs lib/descope/mixins/common.rb in descope-1.0.6

- old
+ new

@@ -7,11 +7,12 @@ # Common values and methods module Common DEFAULT_BASE_URL = 'https://api.descope.com' # pragma: no cover DEFAULT_TIMEOUT_SECONDS = 60 DEFAULT_JWT_VALIDATION_LEEWAY = 5 - PHONE_REGEX = %r{^(?:\(?(?:00|\+)([1-4]\d\d|[1-9]\d?)\)?)?[-./ \\]?(?:(?:\(?\d{1,}\)?[-./ \\]?){0,})(?:[-./ \\]?(?:#|ext\.?|extension|x)[-./ \\]?(\d+))?$} + # Using E164 format,\A and \z are start and end of string respectively, to prevent multiline matching + PHONE_REGEX = /\A\+[1-9]\d{1,14}\z/ SESSION_COOKIE_NAME = 'DS' REFRESH_SESSION_COOKIE_NAME = 'DSR' SESSION_TOKEN_NAME = 'sessionToken' @@ -22,16 +23,18 @@ module DeliveryMethod WHATSAPP = 1 SMS = 2 EMAIL = 3 + VOICE = 4 end def get_method_string(method) name = { DeliveryMethod::WHATSAPP => 'whatsapp', DeliveryMethod::SMS => 'sms', - DeliveryMethod::EMAIL => 'email' + DeliveryMethod::EMAIL => 'email', + DeliveryMethod::VOICE => 'voice' }[method] raise ArgumentException, "Unknown delivery method: #{method}" if name.nil? name