Class: WhopSDK::Client
- Inherits:
-
Internal::Transport::BaseClient
- Object
- Internal::Transport::BaseClient
- WhopSDK::Client
- Defined in:
- lib/whop_sdk/client.rb
Constant Summary collapse
- DEFAULT_MAX_RETRIES =
Default max number of retries to attempt after a failed retryable request.
2- DEFAULT_TIMEOUT_IN_SECONDS =
Default per-request timeout.
60.0- DEFAULT_INITIAL_RETRY_DELAY =
Default initial retry delay in seconds. Overall delay is calculated using exponential backoff + jitter.
0.5- DEFAULT_MAX_RETRY_DELAY =
Default max retry delay in seconds.
8.0
Constants inherited from Internal::Transport::BaseClient
Internal::Transport::BaseClient::MAX_REDIRECTS, Internal::Transport::BaseClient::PLATFORM_HEADERS
Instance Attribute Summary collapse
-
#access_tokens ⇒ WhopSDK::Resources::AccessTokens
readonly
Access tokens.
-
#account_links ⇒ WhopSDK::Resources::AccountLinks
readonly
Account links.
- #accounts ⇒ WhopSDK::Resources::Accounts readonly
-
#ad_campaigns ⇒ WhopSDK::Resources::AdCampaigns
readonly
Ad campaigns.
-
#ad_groups ⇒ WhopSDK::Resources::AdGroups
readonly
Ad groups.
-
#ad_reports ⇒ WhopSDK::Resources::AdReports
readonly
Ad reports.
-
#ads ⇒ WhopSDK::Resources::Ads
readonly
Ads.
-
#affiliates ⇒ WhopSDK::Resources::Affiliates
readonly
Affiliates.
-
#ai_chats ⇒ WhopSDK::Resources::AIChats
readonly
Ai chats.
-
#api_key ⇒ String
readonly
A company API key, company scoped JWT, app API key, or user OAuth token.
-
#app_builds ⇒ WhopSDK::Resources::AppBuilds
readonly
App builds.
-
#app_id ⇒ String?
readonly
When using the SDK in app mode pass this parameter to allow verifying user tokens.
-
#apps ⇒ WhopSDK::Resources::Apps
readonly
Apps.
-
#authorized_users ⇒ WhopSDK::Resources::AuthorizedUsers
readonly
Authorized users.
-
#bounties ⇒ WhopSDK::Resources::Bounties
readonly
Bounties.
-
#chat_channels ⇒ WhopSDK::Resources::ChatChannels
readonly
Chat channels.
-
#checkout_configurations ⇒ WhopSDK::Resources::CheckoutConfigurations
readonly
Checkout configurations.
-
#companies ⇒ WhopSDK::Resources::Companies
readonly
Companies.
-
#company_token_transactions ⇒ WhopSDK::Resources::CompanyTokenTransactions
readonly
Company token transactions.
-
#conversions ⇒ WhopSDK::Resources::Conversions
readonly
Conversions.
-
#course_chapters ⇒ WhopSDK::Resources::CourseChapters
readonly
Course chapters.
-
#course_lesson_interactions ⇒ WhopSDK::Resources::CourseLessonInteractions
readonly
Course lesson interactions.
-
#course_lessons ⇒ WhopSDK::Resources::CourseLessons
readonly
Course lessons.
-
#course_students ⇒ WhopSDK::Resources::CourseStudents
readonly
Course students.
-
#courses ⇒ WhopSDK::Resources::Courses
readonly
Courses.
- #deposits ⇒ WhopSDK::Resources::Deposits readonly
-
#dispute_alerts ⇒ WhopSDK::Resources::DisputeAlerts
readonly
Dispute alerts.
-
#disputes ⇒ WhopSDK::Resources::Disputes
readonly
Disputes.
-
#dm_channels ⇒ WhopSDK::Resources::DmChannels
readonly
Dm channels.
-
#dm_members ⇒ WhopSDK::Resources::DmMembers
readonly
Dm members.
-
#entries ⇒ WhopSDK::Resources::Entries
readonly
Entries.
-
#experiences ⇒ WhopSDK::Resources::Experiences
readonly
Experiences.
-
#fee_markups ⇒ WhopSDK::Resources::FeeMarkups
readonly
Fee markups.
-
#files ⇒ WhopSDK::Resources::Files
readonly
Files.
-
#forum_posts ⇒ WhopSDK::Resources::ForumPosts
readonly
Forum posts.
-
#forums ⇒ WhopSDK::Resources::Forums
readonly
Forums.
-
#invoices ⇒ WhopSDK::Resources::Invoices
readonly
Invoices.
-
#leads ⇒ WhopSDK::Resources::Leads
readonly
Leads.
-
#ledger_accounts ⇒ WhopSDK::Resources::LedgerAccounts
readonly
Ledger accounts.
-
#members ⇒ WhopSDK::Resources::Members
readonly
Members.
-
#memberships ⇒ WhopSDK::Resources::Memberships
readonly
Memberships.
-
#messages ⇒ WhopSDK::Resources::Messages
readonly
Messages.
-
#notifications ⇒ WhopSDK::Resources::Notifications
readonly
Notifications.
-
#payment_methods ⇒ WhopSDK::Resources::PaymentMethods
readonly
Payment methods.
-
#payments ⇒ WhopSDK::Resources::Payments
readonly
Payments.
-
#payout_accounts ⇒ WhopSDK::Resources::PayoutAccounts
readonly
Payout accounts.
-
#payout_methods ⇒ WhopSDK::Resources::PayoutMethods
readonly
Payout methods.
-
#plans ⇒ WhopSDK::Resources::Plans
readonly
Plans.
-
#products ⇒ WhopSDK::Resources::Products
readonly
Products.
-
#promo_codes ⇒ WhopSDK::Resources::PromoCodes
readonly
Promo codes.
-
#reactions ⇒ WhopSDK::Resources::Reactions
readonly
Reactions.
-
#refunds ⇒ WhopSDK::Resources::Refunds
readonly
Refunds.
-
#resolution_center_cases ⇒ WhopSDK::Resources::ResolutionCenterCases
readonly
Resolution center cases.
-
#reviews ⇒ WhopSDK::Resources::Reviews
readonly
Reviews.
-
#setup_intents ⇒ WhopSDK::Resources::SetupIntents
readonly
Setup intents.
-
#shipments ⇒ WhopSDK::Resources::Shipments
readonly
Shipments.
-
#support_channels ⇒ WhopSDK::Resources::SupportChannels
readonly
Support channels.
- #swaps ⇒ WhopSDK::Resources::Swaps readonly
-
#topups ⇒ WhopSDK::Resources::Topups
readonly
Topups.
-
#transfers ⇒ WhopSDK::Resources::Transfers
readonly
Transfers.
-
#user_token_jwks_url ⇒ String?
readonly
Override for the JWKS endpoint used by #verify_user_token.
-
#user_token_public_key ⇒ String?
readonly
Static public key (PEM or JWK JSON) used by #verify_user_token to verify user tokens.
-
#users ⇒ WhopSDK::Resources::Users
readonly
Users.
-
#verifications ⇒ WhopSDK::Resources::Verifications
readonly
Verifications.
- #wallets ⇒ WhopSDK::Resources::Wallets readonly
- #webhook_key ⇒ String? readonly
-
#webhooks ⇒ WhopSDK::Resources::Webhooks
readonly
Webhooks.
-
#withdrawals ⇒ WhopSDK::Resources::Withdrawals
readonly
Withdrawals.
Attributes inherited from Internal::Transport::BaseClient
#base_url, #headers, #idempotency_header, #initial_retry_delay, #max_retries, #max_retry_delay, #requester, #timeout
Instance Method Summary collapse
-
#initialize(api_key: ENV["WHOP_API_KEY"], webhook_key: ENV["WHOP_WEBHOOK_SECRET"], app_id: ENV["WHOP_APP_ID"], user_token_public_key: ENV["WHOP_USER_TOKEN_PUBLIC_KEY"], user_token_jwks_url: ENV["WHOP_USER_TOKEN_JWKS_URL"], base_url: ENV["WHOP_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY) ⇒ Client
constructor
Creates and returns a new client for interacting with the API.
-
#verify_user_token(token_or_headers, **opts) ⇒ Helpers::VerifyUserToken::UserTokenPayload?
Verifies a Whop user token.
-
#verify_user_token!(token_or_headers, **opts) ⇒ Helpers::VerifyUserToken::UserTokenPayload
Verifies a Whop user token.
Methods inherited from Internal::Transport::BaseClient
follow_redirect, #inspect, reap_connection!, #request, #send_request, should_retry?, validate!
Methods included from Internal::Util::SorbetRuntimeSupport
#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type
Constructor Details
#initialize(api_key: ENV["WHOP_API_KEY"], webhook_key: ENV["WHOP_WEBHOOK_SECRET"], app_id: ENV["WHOP_APP_ID"], user_token_public_key: ENV["WHOP_USER_TOKEN_PUBLIC_KEY"], user_token_jwks_url: ENV["WHOP_USER_TOKEN_JWKS_URL"], base_url: ENV["WHOP_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY) ⇒ Client
Creates and returns a new client for interacting with the API.
must prepend your key/token with the word ‘Bearer`, which will look like `Bearer ***************************` Defaults to `ENV`
tokens Defaults to ‘ENV`
user tokens. When set, #verify_user_token skips remote JWKS fetching. Defaults to ‘ENV`
Defaults to ‘ENV`, then to the canonical Whop endpoint.
‘“api.example.com/v2/”`. Defaults to `ENV`
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/whop_sdk/client.rb', line 329 def initialize( api_key: ENV["WHOP_API_KEY"], webhook_key: ENV["WHOP_WEBHOOK_SECRET"], app_id: ENV["WHOP_APP_ID"], user_token_public_key: ENV["WHOP_USER_TOKEN_PUBLIC_KEY"], user_token_jwks_url: ENV["WHOP_USER_TOKEN_JWKS_URL"], base_url: ENV["WHOP_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY ) base_url ||= "https://api.whop.com/api/v1" if api_key.nil? raise ArgumentError.new("api_key is required, and can be set via environ: \"WHOP_API_KEY\"") end headers = { "x-whop-app-id" => (@app_id = app_id&.to_s) } custom_headers_env = ENV["WHOP_CUSTOM_HEADERS"] unless custom_headers_env.nil? parsed = {} custom_headers_env.split("\n").each do |line| colon = line.index(":") unless colon.nil? parsed[line[0...colon].strip] = line[(colon + 1)..].strip end end headers = parsed.merge(headers) end @api_key = api_key.to_s @webhook_key = webhook_key&.to_s @user_token_public_key = user_token_public_key&.to_s @user_token_jwks_url = user_token_jwks_url&.to_s super( base_url: base_url, timeout: timeout, max_retries: max_retries, initial_retry_delay: initial_retry_delay, max_retry_delay: max_retry_delay, headers: headers ) @apps = WhopSDK::Resources::Apps.new(client: self) @invoices = WhopSDK::Resources::Invoices.new(client: self) @course_lesson_interactions = WhopSDK::Resources::CourseLessonInteractions.new(client: self) @products = WhopSDK::Resources::Products.new(client: self) @companies = WhopSDK::Resources::Companies.new(client: self) @webhooks = WhopSDK::Resources::Webhooks.new(client: self) @plans = WhopSDK::Resources::Plans.new(client: self) @entries = WhopSDK::Resources::Entries.new(client: self) @forum_posts = WhopSDK::Resources::ForumPosts.new(client: self) @transfers = WhopSDK::Resources::Transfers.new(client: self) @ledger_accounts = WhopSDK::Resources::LedgerAccounts.new(client: self) @memberships = WhopSDK::Resources::Memberships.new(client: self) @authorized_users = WhopSDK::Resources::AuthorizedUsers.new(client: self) @app_builds = WhopSDK::Resources::AppBuilds.new(client: self) @shipments = WhopSDK::Resources::Shipments.new(client: self) @checkout_configurations = WhopSDK::Resources::CheckoutConfigurations.new(client: self) @messages = WhopSDK::Resources::Messages.new(client: self) @chat_channels = WhopSDK::Resources::ChatChannels.new(client: self) @users = WhopSDK::Resources::Users.new(client: self) @payments = WhopSDK::Resources::Payments.new(client: self) @support_channels = WhopSDK::Resources::SupportChannels.new(client: self) @experiences = WhopSDK::Resources::Experiences.new(client: self) @reactions = WhopSDK::Resources::Reactions.new(client: self) @members = WhopSDK::Resources::Members.new(client: self) @forums = WhopSDK::Resources::Forums.new(client: self) @promo_codes = WhopSDK::Resources::PromoCodes.new(client: self) @courses = WhopSDK::Resources::Courses.new(client: self) @course_chapters = WhopSDK::Resources::CourseChapters.new(client: self) @course_lessons = WhopSDK::Resources::CourseLessons.new(client: self) @reviews = WhopSDK::Resources::Reviews.new(client: self) @course_students = WhopSDK::Resources::CourseStudents.new(client: self) @access_tokens = WhopSDK::Resources::AccessTokens.new(client: self) @notifications = WhopSDK::Resources::Notifications.new(client: self) @disputes = WhopSDK::Resources::Disputes.new(client: self) @refunds = WhopSDK::Resources::Refunds.new(client: self) @withdrawals = WhopSDK::Resources::Withdrawals.new(client: self) @account_links = WhopSDK::Resources::AccountLinks.new(client: self) @accounts = WhopSDK::Resources::Accounts.new(client: self) @wallets = WhopSDK::Resources::Wallets.new(client: self) @swaps = WhopSDK::Resources::Swaps.new(client: self) @deposits = WhopSDK::Resources::Deposits.new(client: self) @setup_intents = WhopSDK::Resources::SetupIntents.new(client: self) @payment_methods = WhopSDK::Resources::PaymentMethods.new(client: self) @fee_markups = WhopSDK::Resources::FeeMarkups.new(client: self) @payout_methods = WhopSDK::Resources::PayoutMethods.new(client: self) @verifications = WhopSDK::Resources::Verifications.new(client: self) @leads = WhopSDK::Resources::Leads.new(client: self) @topups = WhopSDK::Resources::Topups.new(client: self) @files = WhopSDK::Resources::Files.new(client: self) @company_token_transactions = WhopSDK::Resources::CompanyTokenTransactions.new(client: self) @dm_members = WhopSDK::Resources::DmMembers.new(client: self) @ai_chats = WhopSDK::Resources::AIChats.new(client: self) @dm_channels = WhopSDK::Resources::DmChannels.new(client: self) @dispute_alerts = WhopSDK::Resources::DisputeAlerts.new(client: self) @resolution_center_cases = WhopSDK::Resources::ResolutionCenterCases.new(client: self) @payout_accounts = WhopSDK::Resources::PayoutAccounts.new(client: self) @affiliates = WhopSDK::Resources::Affiliates.new(client: self) @bounties = WhopSDK::Resources::Bounties.new(client: self) @ad_campaigns = WhopSDK::Resources::AdCampaigns.new(client: self) @ad_groups = WhopSDK::Resources::AdGroups.new(client: self) @ads = WhopSDK::Resources::Ads.new(client: self) @conversions = WhopSDK::Resources::Conversions.new(client: self) @ad_reports = WhopSDK::Resources::AdReports.new(client: self) end |
Instance Attribute Details
#access_tokens ⇒ WhopSDK::Resources::AccessTokens (readonly)
Access tokens
170 171 172 |
# File 'lib/whop_sdk/client.rb', line 170 def access_tokens @access_tokens end |
#account_links ⇒ WhopSDK::Resources::AccountLinks (readonly)
Account links
190 191 192 |
# File 'lib/whop_sdk/client.rb', line 190 def account_links @account_links end |
#accounts ⇒ WhopSDK::Resources::Accounts (readonly)
193 194 195 |
# File 'lib/whop_sdk/client.rb', line 193 def accounts @accounts end |
#ad_campaigns ⇒ WhopSDK::Resources::AdCampaigns (readonly)
Ad campaigns
274 275 276 |
# File 'lib/whop_sdk/client.rb', line 274 def ad_campaigns @ad_campaigns end |
#ad_groups ⇒ WhopSDK::Resources::AdGroups (readonly)
Ad groups
278 279 280 |
# File 'lib/whop_sdk/client.rb', line 278 def ad_groups @ad_groups end |
#ad_reports ⇒ WhopSDK::Resources::AdReports (readonly)
Ad reports
290 291 292 |
# File 'lib/whop_sdk/client.rb', line 290 def ad_reports @ad_reports end |
#ads ⇒ WhopSDK::Resources::Ads (readonly)
Ads
282 283 284 |
# File 'lib/whop_sdk/client.rb', line 282 def ads @ads end |
#affiliates ⇒ WhopSDK::Resources::Affiliates (readonly)
Affiliates
266 267 268 |
# File 'lib/whop_sdk/client.rb', line 266 def affiliates @affiliates end |
#ai_chats ⇒ WhopSDK::Resources::AIChats (readonly)
Ai chats
246 247 248 |
# File 'lib/whop_sdk/client.rb', line 246 def ai_chats @ai_chats end |
#api_key ⇒ String (readonly)
A company API key, company scoped JWT, app API key, or user OAuth token. You must prepend your key/token with the word ‘Bearer`, which will look like `Bearer ***************************`
22 23 24 |
# File 'lib/whop_sdk/client.rb', line 22 def api_key @api_key end |
#app_builds ⇒ WhopSDK::Resources::AppBuilds (readonly)
App builds
98 99 100 |
# File 'lib/whop_sdk/client.rb', line 98 def app_builds @app_builds end |
#app_id ⇒ String? (readonly)
When using the SDK in app mode pass this parameter to allow verifying user tokens
30 31 32 |
# File 'lib/whop_sdk/client.rb', line 30 def app_id @app_id end |
#apps ⇒ WhopSDK::Resources::Apps (readonly)
Apps
46 47 48 |
# File 'lib/whop_sdk/client.rb', line 46 def apps @apps end |
#authorized_users ⇒ WhopSDK::Resources::AuthorizedUsers (readonly)
Authorized users
94 95 96 |
# File 'lib/whop_sdk/client.rb', line 94 def @authorized_users end |
#bounties ⇒ WhopSDK::Resources::Bounties (readonly)
Bounties
270 271 272 |
# File 'lib/whop_sdk/client.rb', line 270 def bounties @bounties end |
#chat_channels ⇒ WhopSDK::Resources::ChatChannels (readonly)
Chat channels
114 115 116 |
# File 'lib/whop_sdk/client.rb', line 114 def chat_channels @chat_channels end |
#checkout_configurations ⇒ WhopSDK::Resources::CheckoutConfigurations (readonly)
Checkout configurations
106 107 108 |
# File 'lib/whop_sdk/client.rb', line 106 def checkout_configurations @checkout_configurations end |
#companies ⇒ WhopSDK::Resources::Companies (readonly)
Companies
62 63 64 |
# File 'lib/whop_sdk/client.rb', line 62 def companies @companies end |
#company_token_transactions ⇒ WhopSDK::Resources::CompanyTokenTransactions (readonly)
Company token transactions
238 239 240 |
# File 'lib/whop_sdk/client.rb', line 238 def company_token_transactions @company_token_transactions end |
#conversions ⇒ WhopSDK::Resources::Conversions (readonly)
Conversions
286 287 288 |
# File 'lib/whop_sdk/client.rb', line 286 def conversions @conversions end |
#course_chapters ⇒ WhopSDK::Resources::CourseChapters (readonly)
Course chapters
154 155 156 |
# File 'lib/whop_sdk/client.rb', line 154 def course_chapters @course_chapters end |
#course_lesson_interactions ⇒ WhopSDK::Resources::CourseLessonInteractions (readonly)
Course lesson interactions
54 55 56 |
# File 'lib/whop_sdk/client.rb', line 54 def course_lesson_interactions @course_lesson_interactions end |
#course_lessons ⇒ WhopSDK::Resources::CourseLessons (readonly)
Course lessons
158 159 160 |
# File 'lib/whop_sdk/client.rb', line 158 def course_lessons @course_lessons end |
#course_students ⇒ WhopSDK::Resources::CourseStudents (readonly)
Course students
166 167 168 |
# File 'lib/whop_sdk/client.rb', line 166 def course_students @course_students end |
#courses ⇒ WhopSDK::Resources::Courses (readonly)
Courses
150 151 152 |
# File 'lib/whop_sdk/client.rb', line 150 def courses @courses end |
#deposits ⇒ WhopSDK::Resources::Deposits (readonly)
202 203 204 |
# File 'lib/whop_sdk/client.rb', line 202 def deposits @deposits end |
#dispute_alerts ⇒ WhopSDK::Resources::DisputeAlerts (readonly)
Dispute alerts
254 255 256 |
# File 'lib/whop_sdk/client.rb', line 254 def dispute_alerts @dispute_alerts end |
#disputes ⇒ WhopSDK::Resources::Disputes (readonly)
Disputes
178 179 180 |
# File 'lib/whop_sdk/client.rb', line 178 def disputes @disputes end |
#dm_channels ⇒ WhopSDK::Resources::DmChannels (readonly)
Dm channels
250 251 252 |
# File 'lib/whop_sdk/client.rb', line 250 def dm_channels @dm_channels end |
#dm_members ⇒ WhopSDK::Resources::DmMembers (readonly)
Dm members
242 243 244 |
# File 'lib/whop_sdk/client.rb', line 242 def dm_members @dm_members end |
#entries ⇒ WhopSDK::Resources::Entries (readonly)
Entries
74 75 76 |
# File 'lib/whop_sdk/client.rb', line 74 def entries @entries end |
#experiences ⇒ WhopSDK::Resources::Experiences (readonly)
Experiences
130 131 132 |
# File 'lib/whop_sdk/client.rb', line 130 def experiences @experiences end |
#fee_markups ⇒ WhopSDK::Resources::FeeMarkups (readonly)
Fee markups
214 215 216 |
# File 'lib/whop_sdk/client.rb', line 214 def fee_markups @fee_markups end |
#files ⇒ WhopSDK::Resources::Files (readonly)
Files
234 235 236 |
# File 'lib/whop_sdk/client.rb', line 234 def files @files end |
#forum_posts ⇒ WhopSDK::Resources::ForumPosts (readonly)
Forum posts
78 79 80 |
# File 'lib/whop_sdk/client.rb', line 78 def forum_posts @forum_posts end |
#forums ⇒ WhopSDK::Resources::Forums (readonly)
Forums
142 143 144 |
# File 'lib/whop_sdk/client.rb', line 142 def forums @forums end |
#invoices ⇒ WhopSDK::Resources::Invoices (readonly)
Invoices
50 51 52 |
# File 'lib/whop_sdk/client.rb', line 50 def invoices @invoices end |
#leads ⇒ WhopSDK::Resources::Leads (readonly)
Leads
226 227 228 |
# File 'lib/whop_sdk/client.rb', line 226 def leads @leads end |
#ledger_accounts ⇒ WhopSDK::Resources::LedgerAccounts (readonly)
Ledger accounts
86 87 88 |
# File 'lib/whop_sdk/client.rb', line 86 def ledger_accounts @ledger_accounts end |
#members ⇒ WhopSDK::Resources::Members (readonly)
Members
138 139 140 |
# File 'lib/whop_sdk/client.rb', line 138 def members @members end |
#memberships ⇒ WhopSDK::Resources::Memberships (readonly)
Memberships
90 91 92 |
# File 'lib/whop_sdk/client.rb', line 90 def memberships @memberships end |
#messages ⇒ WhopSDK::Resources::Messages (readonly)
Messages
110 111 112 |
# File 'lib/whop_sdk/client.rb', line 110 def @messages end |
#notifications ⇒ WhopSDK::Resources::Notifications (readonly)
Notifications
174 175 176 |
# File 'lib/whop_sdk/client.rb', line 174 def notifications @notifications end |
#payment_methods ⇒ WhopSDK::Resources::PaymentMethods (readonly)
Payment methods
210 211 212 |
# File 'lib/whop_sdk/client.rb', line 210 def payment_methods @payment_methods end |
#payments ⇒ WhopSDK::Resources::Payments (readonly)
Payments
122 123 124 |
# File 'lib/whop_sdk/client.rb', line 122 def payments @payments end |
#payout_accounts ⇒ WhopSDK::Resources::PayoutAccounts (readonly)
Payout accounts
262 263 264 |
# File 'lib/whop_sdk/client.rb', line 262 def payout_accounts @payout_accounts end |
#payout_methods ⇒ WhopSDK::Resources::PayoutMethods (readonly)
Payout methods
218 219 220 |
# File 'lib/whop_sdk/client.rb', line 218 def payout_methods @payout_methods end |
#plans ⇒ WhopSDK::Resources::Plans (readonly)
Plans
70 71 72 |
# File 'lib/whop_sdk/client.rb', line 70 def plans @plans end |
#products ⇒ WhopSDK::Resources::Products (readonly)
Products
58 59 60 |
# File 'lib/whop_sdk/client.rb', line 58 def products @products end |
#promo_codes ⇒ WhopSDK::Resources::PromoCodes (readonly)
Promo codes
146 147 148 |
# File 'lib/whop_sdk/client.rb', line 146 def promo_codes @promo_codes end |
#reactions ⇒ WhopSDK::Resources::Reactions (readonly)
Reactions
134 135 136 |
# File 'lib/whop_sdk/client.rb', line 134 def reactions @reactions end |
#refunds ⇒ WhopSDK::Resources::Refunds (readonly)
Refunds
182 183 184 |
# File 'lib/whop_sdk/client.rb', line 182 def refunds @refunds end |
#resolution_center_cases ⇒ WhopSDK::Resources::ResolutionCenterCases (readonly)
Resolution center cases
258 259 260 |
# File 'lib/whop_sdk/client.rb', line 258 def resolution_center_cases @resolution_center_cases end |
#reviews ⇒ WhopSDK::Resources::Reviews (readonly)
Reviews
162 163 164 |
# File 'lib/whop_sdk/client.rb', line 162 def reviews @reviews end |
#setup_intents ⇒ WhopSDK::Resources::SetupIntents (readonly)
Setup intents
206 207 208 |
# File 'lib/whop_sdk/client.rb', line 206 def setup_intents @setup_intents end |
#shipments ⇒ WhopSDK::Resources::Shipments (readonly)
Shipments
102 103 104 |
# File 'lib/whop_sdk/client.rb', line 102 def shipments @shipments end |
#support_channels ⇒ WhopSDK::Resources::SupportChannels (readonly)
Support channels
126 127 128 |
# File 'lib/whop_sdk/client.rb', line 126 def support_channels @support_channels end |
#swaps ⇒ WhopSDK::Resources::Swaps (readonly)
199 200 201 |
# File 'lib/whop_sdk/client.rb', line 199 def swaps @swaps end |
#topups ⇒ WhopSDK::Resources::Topups (readonly)
Topups
230 231 232 |
# File 'lib/whop_sdk/client.rb', line 230 def topups @topups end |
#transfers ⇒ WhopSDK::Resources::Transfers (readonly)
Transfers
82 83 84 |
# File 'lib/whop_sdk/client.rb', line 82 def transfers @transfers end |
#user_token_jwks_url ⇒ String? (readonly)
Override for the JWKS endpoint used by #verify_user_token. Defaults to the canonical Whop endpoint when unset.
42 43 44 |
# File 'lib/whop_sdk/client.rb', line 42 def user_token_jwks_url @user_token_jwks_url end |
#user_token_public_key ⇒ String? (readonly)
Static public key (PEM or JWK JSON) used by #verify_user_token to verify user tokens. When set, the SDK skips remote JWKS fetching. Prefer #user_token_jwks_url (or the default) so key rotation is handled automatically.
37 38 39 |
# File 'lib/whop_sdk/client.rb', line 37 def user_token_public_key @user_token_public_key end |
#users ⇒ WhopSDK::Resources::Users (readonly)
Users
118 119 120 |
# File 'lib/whop_sdk/client.rb', line 118 def users @users end |
#verifications ⇒ WhopSDK::Resources::Verifications (readonly)
Verifications
222 223 224 |
# File 'lib/whop_sdk/client.rb', line 222 def verifications @verifications end |
#wallets ⇒ WhopSDK::Resources::Wallets (readonly)
196 197 198 |
# File 'lib/whop_sdk/client.rb', line 196 def wallets @wallets end |
#webhook_key ⇒ String? (readonly)
25 26 27 |
# File 'lib/whop_sdk/client.rb', line 25 def webhook_key @webhook_key end |
#webhooks ⇒ WhopSDK::Resources::Webhooks (readonly)
Webhooks
66 67 68 |
# File 'lib/whop_sdk/client.rb', line 66 def webhooks @webhooks end |
#withdrawals ⇒ WhopSDK::Resources::Withdrawals (readonly)
Withdrawals
186 187 188 |
# File 'lib/whop_sdk/client.rb', line 186 def withdrawals @withdrawals end |
Instance Method Details
#verify_user_token(token_or_headers, **opts) ⇒ Helpers::VerifyUserToken::UserTokenPayload?
Verifies a Whop user token. Same signature as #verify_user_token! but returns ‘nil` on any validation failure instead of raising.
466 467 468 469 470 |
# File 'lib/whop_sdk/client.rb', line 466 def verify_user_token(token_or_headers, **opts) verify_user_token!(token_or_headers, **opts) rescue StandardError nil end |
#verify_user_token!(token_or_headers, **opts) ⇒ Helpers::VerifyUserToken::UserTokenPayload
Verifies a Whop user token.
452 453 454 455 456 457 458 459 460 |
# File 'lib/whop_sdk/client.rb', line 452 def verify_user_token!(token_or_headers, **opts) opts[:app_id] ||= app_id opts[:public_key] = user_token_public_key if opts[:public_key].nil? && user_token_public_key && !user_token_public_key.empty? opts[:jwks_url] = user_token_jwks_url if opts[:jwks_url].nil? && user_token_jwks_url && !user_token_jwks_url.empty? unless opts[:app_id] raise StandardError, "You must set app_id in the Whop client if you want to verify user tokens" end Helpers::VerifyUserToken.verify_user_token!(token_or_headers, **opts) end |