Module: Auth0::Api::V2::Guardian

Includes:
Mixins::Validation
Included in:
Auth0::Api::V2
Defined in:
lib/auth0/api/v2/guardian.rb

Overview

Methods to use the guardian endpoints

Instance Method Summary collapse

Methods included from Mixins::Validation

#validate_permissions_array, #validate_strings_array

Instance Method Details

#delete_guardian_enrollment(enrollment_id) ⇒ Object

Deletes a single Guardian enrollment given its id.

Parameters:

  • enrollment_id (string)

    The enrollment_id of the Guardian enrollment to delete.

Raises:

See Also:


31
32
33
34
35
36
# File 'lib/auth0/api/v2/guardian.rb', line 31

def delete_guardian_enrollment(enrollment_id)
  raise Auth0::MissingParameter, 'Must supply a valid enrollment_id' if enrollment_id.to_s.empty?

  path = "#{guardian_enrollments_path}/#{enrollment_id}"
  delete(path)
end

#guardian_create_enrollment_ticket(body) ⇒ json

Creates a Guardian enrollment ticket.

Parameters:

  • body (hash)

    User details to create enrollment ticket for.

Returns:

  • (json)

    Returns details of created enrollment ticket.

Raises:

See Also:


105
106
107
108
109
110
# File 'lib/auth0/api/v2/guardian.rb', line 105

def guardian_create_enrollment_ticket(body)
  raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty?

  path = "#{guardian_enrollments_path}/ticket"
  post(path, body)
end

#guardian_enrollment(enrollment_id) ⇒ json Also known as: get_guardian_enrollment

Retrieves a single Guardian enrollment.

Parameters:

  • enrollment_id (string)

    The enrollment_id of the Guardian enrollment to delete.

Returns:

  • (json)

    Returns details of the Guardian enrollment.

Raises:

See Also:


20
21
22
23
24
25
# File 'lib/auth0/api/v2/guardian.rb', line 20

def guardian_enrollment(enrollment_id)
  raise Auth0::MissingParameter, 'Must supply a valid enrollment_id' if enrollment_id.to_s.empty?

  path = "#{guardian_enrollments_path}/#{enrollment_id}"
  get(path)
end

#guardian_factorsjson Also known as: get_guardian_factors

Retrieves a list of Guardian factors.

Returns:

  • (json)

    Returns the list of all Guardian factors.

See Also:


11
12
13
# File 'lib/auth0/api/v2/guardian.rb', line 11

def guardian_factors
  get(guardian_factors_path)
end

#guardian_sms_templatesjson Also known as: get_guardian_sms_templates

Retrieves SMS enrollment and verification templates.

Returns:

  • (json)

    Returns enrollment and verification templates.

See Also:


41
42
43
44
# File 'lib/auth0/api/v2/guardian.rb', line 41

def guardian_sms_templates
  path = "#{guardian_factors_path}/sms/templates"
  get(path)
end

#guardian_sns_provider_configjson Also known as: get_guardian_sns_provider_config

Retrieves provider configuration for AWS SNS.

Returns:

  • (json)

    Returns provider configuration for AWS SNS.

See Also:


62
63
64
65
# File 'lib/auth0/api/v2/guardian.rb', line 62

def guardian_sns_provider_config
  path = "#{guardian_factors_path}/push-notification/providers/sns"
  get(path)
end

#guardian_twillo_provider_configjson Also known as: get_guardian_twillo_provider_config

Retrieves provider configuration for Twilio.

Returns:

  • (json)

    Returns provider configuration for Twilio.

See Also:


83
84
85
86
# File 'lib/auth0/api/v2/guardian.rb', line 83

def guardian_twillo_provider_config
  path = "#{guardian_factors_path}/sms/providers/twilio"
  get(path)
end

#guardian_update_enrollment_verification_templates(body) ⇒ json

Updates SMS enrollment and verification SMS templates.

Parameters:

  • body (hash)

    The parameters to update.

Returns:

  • (json)

    Returns updated SMS enrollment and verification templates.

Raises:

See Also:


52
53
54
55
56
57
# File 'lib/auth0/api/v2/guardian.rb', line 52

def guardian_update_enrollment_verification_templates(body)
  raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty?

  path = "#{guardian_factors_path}/sms/templates"
  put(path, body)
end

#guardian_update_factor(name, body) ⇒ json

Updates a Guardian factor.

Parameters:

  • name (string)

    Name of Guardian factor to update.

  • body (hash)

    The parameters to update.

Returns:

  • (json)

    Returns details of updated Guardian factor.

Raises:

See Also:


117
118
119
120
121
122
123
# File 'lib/auth0/api/v2/guardian.rb', line 117

def guardian_update_factor(name, body)
  raise Auth0::MissingParameter, 'Must supply a valid name' if name.to_s.empty?
  raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty?

  path = "#{guardian_factors_path}/#{name}"
  put(path, body)
end

#guardian_update_sns_provider_config(body) ⇒ json

Updates provider configuration for AWS SNS.

Parameters:

  • body (hash)

    The parameters to update.

Returns:

  • (json)

    Returns updated provider configuration for AWS SNS.

Raises:

See Also:


73
74
75
76
77
78
# File 'lib/auth0/api/v2/guardian.rb', line 73

def guardian_update_sns_provider_config(body)
  raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty?

  path = "#{guardian_factors_path}/push-notification/providers/sns"
  put(path, body)
end

#guardian_update_twillo_provider_config(body) ⇒ json

Updates provider configuration for Twilio.

Parameters:

  • body (hash)

    The parameters to update.

Returns:

  • (json)

    Returns updated provider configuration for Twilio.

Raises:

See Also:


94
95
96
97
98
99
# File 'lib/auth0/api/v2/guardian.rb', line 94

def guardian_update_twillo_provider_config(body)
  raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty?

  path = "#{guardian_factors_path}/sms/providers/twilio"
  put(path, body)
end