Class: WhopSDK::Resources::Accounts::Preferences

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/accounts/preferences.rb,
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.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Preferences

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 Preferences.

Parameters:



72
73
74
# File 'lib/whop_sdk/resources/accounts/preferences.rb', line 72

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(account_id, request_options: {}) ⇒ WhopSDK::Models::Accounts::PreferenceRetrieveResponse

Retrieves the account's preferences: a singleton settings document keyed by preference name.

Parameters:

  • account_id (String)

    Account ID, prefixed biz_.

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

Returns:

See Also:



26
27
28
29
30
31
32
33
# File 'lib/whop_sdk/resources/accounts/preferences.rb', line 26

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

#update(account_id, ads_payment_methods: nil, request_options: {}) ⇒ WhopSDK::Models::Accounts::PreferenceUpdateResponse

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

Updates the account's preferences. Each top-level key present in the body is replaced as a whole; omitted keys are left untouched. ads_payment_methods always requires a primary entry. backup is optional when the primary is platform_balance — omitting it removes any configured card — while a card primary requires a platform_balance backup. A platform_balance entry may omit id to use the account's default Whop balance. Changing which funding sources are configured requires a user token, while account API keys may only swap primary and backup.

Parameters:

Returns:

See Also:



58
59
60
61
62
63
64
65
66
67
# File 'lib/whop_sdk/resources/accounts/preferences.rb', line 58

def update(, params = {})
  parsed, options = WhopSDK::Accounts::PreferenceUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["accounts/%1$s/preferences", ],
    body: parsed,
    model: WhopSDK::Models::Accounts::PreferenceUpdateResponse,
    options: options
  )
end