Class: WhopSDK::Resources::Accounts::Preferences
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Accounts::Preferences
- 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
-
#initialize(client:) ⇒ Preferences
constructor
private
A new instance of Preferences.
-
#retrieve(account_id, request_options: {}) ⇒ WhopSDK::Models::Accounts::PreferenceRetrieveResponse
Retrieves the account's preferences: a singleton settings document keyed by preference name.
-
#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.
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.
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.
26 27 28 29 30 31 32 33 |
# File 'lib/whop_sdk/resources/accounts/preferences.rb', line 26 def retrieve(account_id, params = {}) @client.request( method: :get, path: ["accounts/%1$s/preferences", account_id], 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.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/whop_sdk/resources/accounts/preferences.rb', line 58 def update(account_id, params = {}) parsed, = WhopSDK::Accounts::PreferenceUpdateParams.dump_request(params) @client.request( method: :patch, path: ["accounts/%1$s/preferences", account_id], body: parsed, model: WhopSDK::Models::Accounts::PreferenceUpdateResponse, options: ) end |