Class: Whop_sdk::Permissions::Client
- Inherits:
-
Object
- Object
- Whop_sdk::Permissions::Client
- Defined in:
- lib/whop_sdk/permissions/client.rb
Instance Method Summary collapse
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Whop_sdk::Permissions::Types::ListPermissionsResponse
Lists permission actions and whether the calling credential is granted each one for a resource.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/whop_sdk/permissions/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#list(request_options: {}, **params) ⇒ Whop_sdk::Permissions::Types::ListPermissionsResponse
Lists permission actions and whether the calling credential is granted each one for a resource. Answers for whichever identity authenticated the request — a user session, an OAuth token, or an account or app API key — so it never describes who else can reach the resource.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/whop_sdk/permissions/client.rb', line 31 def list(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["resource_id"] = params[:resource_id] if params.key?(:resource_id) query_params["actions"] = params[:actions] if params.key?(:actions) request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "permissions", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Whop_sdk::Permissions::Types::ListPermissionsResponse.load(response.body) else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |