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.
-
#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.
-
#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.
-
#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.
-
#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.
-
#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.
- #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`
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 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 |
# File 'lib/whop_sdk/client.rb', line 293 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) } @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) @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) 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 |
#affiliates ⇒ WhopSDK::Resources::Affiliates (readonly)
Affiliates
254 255 256 |
# File 'lib/whop_sdk/client.rb', line 254 def affiliates @affiliates end |
#ai_chats ⇒ WhopSDK::Resources::AIChats (readonly)
Ai chats
234 235 236 |
# File 'lib/whop_sdk/client.rb', line 234 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 |
#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
226 227 228 |
# File 'lib/whop_sdk/client.rb', line 226 def company_token_transactions @company_token_transactions 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 |
#dispute_alerts ⇒ WhopSDK::Resources::DisputeAlerts (readonly)
Dispute alerts
242 243 244 |
# File 'lib/whop_sdk/client.rb', line 242 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
238 239 240 |
# File 'lib/whop_sdk/client.rb', line 238 def dm_channels @dm_channels end |
#dm_members ⇒ WhopSDK::Resources::DmMembers (readonly)
Dm members
230 231 232 |
# File 'lib/whop_sdk/client.rb', line 230 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
202 203 204 |
# File 'lib/whop_sdk/client.rb', line 202 def fee_markups @fee_markups end |
#files ⇒ WhopSDK::Resources::Files (readonly)
Files
222 223 224 |
# File 'lib/whop_sdk/client.rb', line 222 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
214 215 216 |
# File 'lib/whop_sdk/client.rb', line 214 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
198 199 200 |
# File 'lib/whop_sdk/client.rb', line 198 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
250 251 252 |
# File 'lib/whop_sdk/client.rb', line 250 def payout_accounts @payout_accounts end |
#payout_methods ⇒ WhopSDK::Resources::PayoutMethods (readonly)
Payout methods
206 207 208 |
# File 'lib/whop_sdk/client.rb', line 206 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
246 247 248 |
# File 'lib/whop_sdk/client.rb', line 246 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
194 195 196 |
# File 'lib/whop_sdk/client.rb', line 194 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 |
#topups ⇒ WhopSDK::Resources::Topups (readonly)
Topups
218 219 220 |
# File 'lib/whop_sdk/client.rb', line 218 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
210 211 212 |
# File 'lib/whop_sdk/client.rb', line 210 def verifications @verifications 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.
409 410 411 412 413 |
# File 'lib/whop_sdk/client.rb', line 409 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.
395 396 397 398 399 400 401 402 403 |
# File 'lib/whop_sdk/client.rb', line 395 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 |