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
-
#client_grants(client_id: nil, audience: nil, page: nil, per_page: nil, allow_any_organization: nil) ⇒ json
(also: #get_all_client_grants)
Retrieves a list of all client grants.
-
#create_client_grant(options = {}) ⇒ json
Creates a new client grant.
-
#delete_client_grant(client_grant_id) ⇒ Object
Deletes a client grant given its id.
-
#get_client_grants_organizations(client_grant_id, options = {}) ⇒ json
Get the organizations associated to a client grant.
-
#patch_client_grant(client_grant_id, options) ⇒ Object
(also: #update_client_grant)
Updates a client grant.
Instance Method Details
#client_grants(client_id: nil, audience: nil, page: nil, per_page: nil, allow_any_organization: nil) ⇒ json Also known as: get_all_client_grants
Retrieves a list of all client grants.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/auth0/api/v2/client_grants.rb', line 16 def client_grants (client_id: nil, audience: nil, page: nil, per_page: nil, allow_any_organization: nil) request_params = { client_id: client_id, audience: audience, page: page, per_page: per_page, allow_any_organization: allow_any_organization } get(client_grants_path, request_params) end |
#create_client_grant(options = {}) ⇒ json
Creates a new client grant.
33 34 35 36 |
# File 'lib/auth0/api/v2/client_grants.rb', line 33 def create_client_grant( = {}) request_params = Hash[.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.
41 42 43 44 45 |
# File 'lib/auth0/api/v2/client_grants.rb', line 41 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 |
#get_client_grants_organizations(client_grant_id, options = {}) ⇒ json
Get the organizations associated to a client grant.
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/auth0/api/v2/client_grants.rb', line 69 def get_client_grants_organizations(client_grant_id, = {}) raise Auth0::InvalidParameter, 'Must specify a client grant id' if client_grant_id.to_s.empty? request_params = { per_page: .fetch(:per_page, nil), page: .fetch(:page, nil), from: .fetch(:from, nil), take: .fetch(:take, nil), include_totals: .fetch(:include_totals, nil) } path = "#{client_grants_path}/#{client_grant_id}/organizations" get(path, request_params) end |
#patch_client_grant(client_grant_id, options) ⇒ Object Also known as: update_client_grant
Updates a client grant.
51 52 53 54 55 56 |
# File 'lib/auth0/api/v2/client_grants.rb', line 51 def patch_client_grant(client_grant_id, ) 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 .to_s.empty? path = "#{client_grants_path}/#{client_grant_id}" patch(path, ) end |