Module: Auth0::Api::V2::ClientGrants

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

Overview

Methods to use the client grants endpoints

Instance Method Summary collapse

Instance Method Details

#client_grantsjson Also known as: get_all_client_grants

Retrieves a list of all client grants.

Returns:

  • (json)

    Returns the client grants.

See Also:



12
13
14
# File 'lib/auth0/api/v2/client_grants.rb', line 12

def client_grants
  get(client_grants_path)
end

#create_client_grant(options = {}) ⇒ json

Creates a new client grant.

Parameters:

  • options (hash) (defaults to: {})

    The Hash options used to define the client grant’s properties.

Returns:

  • (json)

    Returns the created client grant.

See Also:



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

def create_client_grant(options = {})
  request_params = Hash[options.map { |(k, v)| [k.to_sym, v] }]
  post(client_grants_path, request_params)
end

#delete_client_grant(client_grant_id) ⇒ Object

Deletes a client grant given its id.

Parameters:

  • client_id (string)

    The id of the client grant to delete.

Raises:

See Also:



30
31
32
33
34
# File 'lib/auth0/api/v2/client_grants.rb', line 30

def delete_client_grant(client_grant_id)
  raise Auth0::InvalidParameter, 'Must specify a client grant id' if client_grant_id.to_s.empty?
  path = "#{client_grants_path}/#{client_grant_id}"
  delete(path)
end

#patch_client_grant(client_grant_id, options) ⇒ Object Also known as: update_client_grant

Updates a client grant.

Parameters:

  • client_id (string)

    The id of the client grant to update.

  • options (hash)

    The Hash options used to define the client grant’s properties.

Raises:

See Also:



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

def patch_client_grant(client_grant_id, options)
  raise Auth0::InvalidParameter, 'Must specify a client grant id' if client_grant_id.to_s.empty?
  raise Auth0::InvalidParameter, 'Must specify a valid body' if options.to_s.empty?
  path = "#{client_grants_path}/#{client_grant_id}"
  patch(path, options)
end