Module: Auth0::Api::V2::Grants

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

Instance Method Summary collapse

Instance Method Details

#delete_grant(id, user_id) ⇒ Object

Delete a grant associated with your account.

Parameters:

  • id (string)

    The id of the grant to delete.

  • user_id (string)

    The user_id of the grant to delete.

Raises:

See Also:



33
34
35
36
37
38
# File 'lib/auth0/api/v2/grants.rb', line 33

def delete_grant(id, user_id)
  raise Auth0::InvalidParameter, 'Must specify a grant id as id' if id.to_s.empty?
  raise Auth0::InvalidParameter, 'Must specify a user id' if user_id.to_s.empty?
  path = "#{grants_path}/#{id}"
  delete(path, user_id: user_id)
end

#grants(client_id: nil, user_id: nil, audience: nil, page: nil, per_page: nil, include_totals: nil) ⇒ json Also known as: get_all_grants

Retrieve the grants associated with your account.

Parameters:

  • client_id (string) (defaults to: nil)

    The client_id of the grants to retrieve.

  • user_id (string) (defaults to: nil)

    The user_id of the grants to retrieve.

  • audience (string) (defaults to: nil)

    The audience of the grants to retrieve.

  • page (int) (defaults to: nil)

    The page index of the results to return. First page is 0.

  • per_page (int) (defaults to: nil)

    The number of results per page. Paging is disabled if parameter not sent.

  • include_totals (boolean) (defaults to: nil)

    Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).

Returns:

  • (json)

    Returns the grants.

See Also:



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

def grants(client_id: nil, user_id: nil, audience: nil, page: nil, per_page: nil, include_totals: nil)
  request_params = {
    client_id: client_id,
    user_id: user_id,
    audience: audience,
    page: page,
    per_page: per_page,
    include_totals: include_totals
  }
  get(grants_path, request_params)
end