Class: WhopSDK::Resources::Users
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Users
- Defined in:
- lib/whop_sdk/resources/users.rb
Overview
Users
Instance Method Summary collapse
-
#check_access(resource_id, id:, request_options: {}) ⇒ WhopSDK::Models::UserCheckAccessResponse
Some parameter documentations has been truncated, see Models::UserCheckAccessParams for more details.
-
#initialize(client:) ⇒ Users
constructor
private
A new instance of Users.
-
#list(after: nil, before: nil, first: nil, last: nil, query: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::UserListResponse>
Search for users by name or username, ranked by social proximity to the authenticated user.
-
#retrieve(id, company_id: nil, request_options: {}) ⇒ WhopSDK::Models::User
Some parameter documentations has been truncated, see Models::UserRetrieveParams for more details.
-
#update(id, bio: nil, company_id: nil, name: nil, profile_picture: nil, username: nil, request_options: {}) ⇒ WhopSDK::Models::User
Some parameter documentations has been truncated, see Models::UserUpdateParams for more details.
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.
141 142 143 |
# File 'lib/whop_sdk/resources/users.rb', line 141 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 whether a user has access to a specific resource, and return their access level.
124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/whop_sdk/resources/users.rb', line 124 def check_access(resource_id, params) parsed, = 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: ) end |
#list(after: nil, before: nil, first: nil, last: nil, query: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::UserListResponse>
Search for users by name or username, ranked by social proximity to the authenticated user.
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/whop_sdk/resources/users.rb', line 94 def list(params = {}) parsed, = WhopSDK::UserListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "users", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::UserListResponse, options: ) end |
#retrieve(id, company_id: nil, request_options: {}) ⇒ WhopSDK::Models::User
Some parameter documentations has been truncated, see Models::UserRetrieveParams for more details.
Retrieves the details of an existing user.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/whop_sdk/resources/users.rb', line 23 def retrieve(id, params = {}) parsed, = WhopSDK::UserRetrieveParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["users/%1$s", id], query: query, model: WhopSDK::User, options: ) end |
#update(id, bio: nil, company_id: nil, name: nil, profile_picture: nil, username: nil, request_options: {}) ⇒ WhopSDK::Models::User
Some parameter documentations has been truncated, see Models::UserUpdateParams for more details.
Update a user’s profile by their ID.
Required permissions:
-
‘user:profile:update`
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/whop_sdk/resources/users.rb', line 63 def update(id, params = {}) parsed, = WhopSDK::UserUpdateParams.dump_request(params) @client.request( method: :patch, path: ["users/%1$s", id], body: parsed, model: WhopSDK::User, options: ) end |