Class: WhopSDK::Resources::Accounts
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Accounts
- Defined in:
- lib/whop_sdk/resources/accounts.rb,
lib/whop_sdk/resources/accounts/preferences.rb,
sig/whop_sdk/resources/accounts.rbs,
sig/whop_sdk/resources/accounts/preferences.rbs
Overview
An Account represents a person or business on Whop that can have its own profile, wallet, and account-scoped settings. Use accounts for customers, creators, merchants, sellers, or connected businesses your integration supports.
Use the Accounts API to create accounts, list accounts visible to your credentials, retrieve or update an account, and retrieve the account associated with the current API key.
Defined Under Namespace
Classes: Preferences
Instance Attribute Summary collapse
-
#preferences ⇒ WhopSDK::Resources::Accounts::Preferences
readonly
An Account represents a person or business on Whop that can have its own profile, wallet, and account-scoped settings.
Instance Method Summary collapse
-
#create(email: nil, metadata: nil, title: nil, request_options: {}) ⇒ WhopSDK::Models::Account
Some parameter documentations has been truncated, see Models::AccountCreateParams for more details.
-
#initialize(client:) ⇒ Accounts
constructor
private
A new instance of Accounts.
-
#list(after: nil, before: nil, direction: nil, first: nil, last: nil, order: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::Account>
Lists accounts visible to the credential.
-
#me(request_options: {}) ⇒ WhopSDK::Models::Account
Retrieves the business account associated with the current business account API key.
-
#recommend_actions(account_id, request_options: {}) ⇒ WhopSDK::Models::AccountRecommendActionsResponse
Lists the recommended actions computed for the account — the same set embedded on the account resource, served on their own so a caller can fetch just the recommendations.
-
#retrieve(account_id, request_options: {}) ⇒ WhopSDK::Models::Account
Retrieves a single account visible to the credential, including its crypto wallet.
-
#update(account_id, affiliate_application_required: nil, affiliate_instructions: nil, banner_image: nil, business_address: nil, business_type: nil, country: nil, description: nil, featured_affiliate_product_id: nil, home_preferences: nil, industry_group: nil, industry_type: nil, invoice_prefix: nil, logo: nil, metadata: nil, onboarding_type: nil, opengraph_image: nil, opengraph_image_variant: nil, other_business_description: nil, other_industry_description: nil, product_tax_code_id: nil, require_2fa: nil, route: nil, send_customer_emails: nil, show_joined_whops: nil, show_reviews_dtc: nil, show_user_directory: nil, social_links: nil, store_page_config: nil, target_audience: nil, tax_identifiers: nil, tax_remitted_by: nil, title: nil, use_logo_as_opengraph_image_fallback: nil, request_options: {}) ⇒ WhopSDK::Models::Account
Some parameter documentations has been truncated, see Models::AccountUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Accounts
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 Accounts.
248 249 250 251 |
# File 'lib/whop_sdk/resources/accounts.rb', line 248 def initialize(client:) @client = client @preferences = WhopSDK::Resources::Accounts::Preferences.new(client: client) end |
Instance Attribute Details
#preferences ⇒ WhopSDK::Resources::Accounts::Preferences (readonly)
An Account represents a person or business on Whop that can have its own profile, wallet, and account-scoped settings. Use accounts for customers, creators, merchants, sellers, or connected businesses your integration supports.
Use the Accounts API to create accounts, list accounts visible to your credentials, retrieve or update an account, and retrieve the account associated with the current API key.
21 22 23 |
# File 'lib/whop_sdk/resources/accounts.rb', line 21 def preferences @preferences end |
Instance Method Details
#create(email: nil, metadata: nil, title: nil, request_options: {}) ⇒ WhopSDK::Models::Account
Some parameter documentations has been truncated, see Models::AccountCreateParams for more details.
Creates an account. User tokens create business accounts; business account API
keys create connected accounts. Tax fields (tax_remitted_by,
product_tax_code_id, business_address, tax_identifiers) are configured
with Update Account, not at creation.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/whop_sdk/resources/accounts.rb', line 44 def create(params = {}) parsed, = WhopSDK::AccountCreateParams.dump_request(params) @client.request( method: :post, path: "accounts", body: parsed, model: WhopSDK::Account, options: ) end |
#list(after: nil, before: nil, direction: nil, first: nil, last: nil, order: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::Account>
Lists accounts visible to the credential. User tokens return the user's business accounts; business account API keys return the requesting business account and its connected accounts.
191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/whop_sdk/resources/accounts.rb', line 191 def list(params = {}) parsed, = WhopSDK::AccountListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "accounts", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Account, options: ) end |
#me(request_options: {}) ⇒ WhopSDK::Models::Account
Retrieves the business account associated with the current business account API key.
214 215 216 217 218 219 220 221 |
# File 'lib/whop_sdk/resources/accounts.rb', line 214 def me(params = {}) @client.request( method: :get, path: "accounts/me", model: WhopSDK::Account, options: params[:request_options] ) end |
#recommend_actions(account_id, request_options: {}) ⇒ WhopSDK::Models::AccountRecommendActionsResponse
Lists the recommended actions computed for the account — the same set embedded on the account resource, served on their own so a caller can fetch just the recommendations.
236 237 238 239 240 241 242 243 |
# File 'lib/whop_sdk/resources/accounts.rb', line 236 def recommend_actions(account_id, params = {}) @client.request( method: :get, path: ["accounts/%1$s/recommend_actions", account_id], model: WhopSDK::Models::AccountRecommendActionsResponse, options: params[:request_options] ) end |
#retrieve(account_id, request_options: {}) ⇒ WhopSDK::Models::Account
Retrieves a single account visible to the credential, including its crypto wallet.
67 68 69 70 71 72 73 74 |
# File 'lib/whop_sdk/resources/accounts.rb', line 67 def retrieve(account_id, params = {}) @client.request( method: :get, path: ["accounts/%1$s", account_id], model: WhopSDK::Account, options: params[:request_options] ) end |
#update(account_id, affiliate_application_required: nil, affiliate_instructions: nil, banner_image: nil, business_address: nil, business_type: nil, country: nil, description: nil, featured_affiliate_product_id: nil, home_preferences: nil, industry_group: nil, industry_type: nil, invoice_prefix: nil, logo: nil, metadata: nil, onboarding_type: nil, opengraph_image: nil, opengraph_image_variant: nil, other_business_description: nil, other_industry_description: nil, product_tax_code_id: nil, require_2fa: nil, route: nil, send_customer_emails: nil, show_joined_whops: nil, show_reviews_dtc: nil, show_user_directory: nil, social_links: nil, store_page_config: nil, target_audience: nil, tax_identifiers: nil, tax_remitted_by: nil, title: nil, use_logo_as_opengraph_image_fallback: nil, request_options: {}) ⇒ WhopSDK::Models::Account
Some parameter documentations has been truncated, see Models::AccountUpdateParams for more details.
Updates an account. User tokens can update business accounts; business account API keys can update connected accounts.
157 158 159 160 161 162 163 164 165 166 |
# File 'lib/whop_sdk/resources/accounts.rb', line 157 def update(account_id, params = {}) parsed, = WhopSDK::AccountUpdateParams.dump_request(params) @client.request( method: :patch, path: ["accounts/%1$s", account_id], body: parsed, model: WhopSDK::Account, options: ) end |