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:



59
60
61
# File 'lib/whop_sdk/resources/users.rb', line 59

def initialize(client:)
  @client = client
end

Instance Method Details

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

Some parameter documentations has been truncated, see Models::UserCheckAccessParams for more details.

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

Parameters:

  • resource_id (String)

    The ID of the resource. Can be a company (biz_xxx), product (prod_xxx), or exper

  • id (String)

    The ID (user_xxx) or username of the user

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/whop_sdk/resources/users.rb', line 42

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:

  • id (String)

    The ID (user_xxx) or username of the user

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



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

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