Module: Descope::Mixins::Common

Included in:
Api::V1::Auth, Api::V1::Session, Descope::Mixins, HTTP, Validation
Defined in:
lib/descope/mixins/common.rb

Overview

Common values and methods

Defined Under Namespace

Modules: DeliveryMethod, EndpointsV1, EndpointsV2

Constant Summary collapse

DEFAULT_BASE_URL =

pragma: no cover

'https://api.descope.com'
DEFAULT_TIMEOUT_SECONDS =
60
DEFAULT_JWT_VALIDATION_LEEWAY =
5
PHONE_REGEX =

Using E164 format,A and z are start and end of string respectively, to prevent multiline matching

/\A\+[1-9]\d{1,14}\z/
'DS'
'DSR'
SESSION_TOKEN_NAME =
'sessionToken'
REFRESH_SESSION_TOKEN_NAME =
'refreshSessionToken'
'cookieData'
'Location'

Instance Method Summary collapse

Instance Method Details

#deep_copy(obj) ⇒ Object



44
45
46
# File 'lib/descope/mixins/common.rb', line 44

def deep_copy(obj)
  Marshal.load(Marshal.dump(obj))
end

#get_method_string(method) ⇒ Object

Raises:



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/descope/mixins/common.rb', line 31

def get_method_string(method)
  name = {
    DeliveryMethod::WHATSAPP => 'whatsapp',
    DeliveryMethod::SMS => 'sms',
    DeliveryMethod::EMAIL => 'email',
    DeliveryMethod::VOICE => 'voice'
  }[method]

  raise ArgumentException, "Unknown delivery method: #{method}" if name.nil?

  name
end