Module: Auth0::Api::V2::UsersByEmail

Included in:
Auth0::Api::V2
Defined in:
lib/auth0/api/v2/users_by_email.rb

Overview

Methods to use the Users By Email endpoints

Instance Method Summary collapse

Instance Method Details

#users_by_email(email, options = {}) ⇒ json

Retrieves a list of existing users by their email.

Parameters:

  • email (string)

    E-mail to be searched

  • options (hash) (defaults to: {})
    • :fields [string] A comma separated list of fields to include or exclude from the result.

    • :include_fields [boolean] True if the fields specified are to be included in the result, false otherwise.

Returns:

  • (json)

    Returns the list of existing users.

Raises:

See Also:



17
18
19
20
21
22
23
24
25
# File 'lib/auth0/api/v2/users_by_email.rb', line 17

def users_by_email(email, options = {})
  raise Auth0::InvalidParameter, 'Must supply a valid email' if email.to_s.empty?
  request_params = {
    fields:         options.fetch(:fields, nil),
    include_fields: options.fetch(:include_fields, nil)
  }
  request_params[:email] = email
  get(users_by_email_path, request_params)
end