Class: WhopSDK::Resources::Users

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/users.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Users

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Users.

Parameters:



53
54
55
# File 'lib/whop_sdk/resources/users.rb', line 53

def initialize(client:)
  @client = client
end

Instance Method Details

#check_access(resource_id, id: , request_options: {}) ⇒ WhopSDK::Models::UserCheckAccessResponse

Check if a user has access (and their access level) to a resource

Parameters:

Returns:

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/whop_sdk/resources/users.rb', line 36

def check_access(resource_id, params)
  parsed, options = WhopSDK::UserCheckAccessParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["users/%1$s/access/%2$s", id, resource_id],
    model: WhopSDK::Models::UserCheckAccessResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::UserRetrieveResponse

Retrieves a user by ID or username

Parameters:

Returns:

See Also:



16
17
18
19
20
21
22
23
# File 'lib/whop_sdk/resources/users.rb', line 16

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["users/%1$s", id],
    model: WhopSDK::Models::UserRetrieveResponse,
    options: params[:request_options]
  )
end