Class: XTwitterScraper::Resources::GuestWallets
- Inherits:
-
Object
- Object
- XTwitterScraper::Resources::GuestWallets
- Defined in:
- lib/x_twitter_scraper/resources/guest_wallets.rb,
sig/x_twitter_scraper/resources/guest_wallets.rbs
Overview
Accountless prepaid access for paid read endpoints
Instance Method Summary collapse
-
#create(amount_minor:, idempotency_key:, currency: :usd, request_options: {}) ⇒ XTwitterScraper::Models::GuestWalletCreateResponse
Some parameter documentations has been truncated, see Models::GuestWalletCreateParams for more details.
-
#initialize(client:) ⇒ GuestWallets
constructor
private
A new instance of GuestWallets.
-
#retrieve_status(request_options: {}) ⇒ XTwitterScraper::Models::GuestWalletRetrieveStatusResponse
Poll after payment.
-
#topup(amount_minor:, idempotency_key:, currency: :usd, request_options: {}) ⇒ XTwitterScraper::Models::GuestWalletTopupResponse
Some parameter documentations has been truncated, see Models::GuestWalletTopupParams for more details.
Constructor Details
#initialize(client:) ⇒ GuestWallets
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 GuestWallets.
103 104 105 |
# File 'lib/x_twitter_scraper/resources/guest_wallets.rb', line 103 def initialize(client:) @client = client end |
Instance Method Details
#create(amount_minor:, idempotency_key:, currency: :usd, request_options: {}) ⇒ XTwitterScraper::Models::GuestWalletCreateResponse
Some parameter documentations has been truncated, see Models::GuestWalletCreateParams for more details.
Create a one-use hosted checkout after the user confirms $10-$250 USD. The request creates no charge. It returns a paid-read API key without an Xquik account. Idempotent replays return the same key.
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/x_twitter_scraper/resources/guest_wallets.rb', line 31 def create(params) parsed, = XTwitterScraper::GuestWalletCreateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key"} @client.request( method: :post, path: "guest-wallets", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: XTwitterScraper::Models::GuestWalletCreateResponse, security: {}, options: ) end |
#retrieve_status(request_options: {}) ⇒ XTwitterScraper::Models::GuestWalletRetrieveStatusResponse
Poll after payment. Use usable to decide whether paid reads can run. An active wallet can remain usable while a top-up is pending. A new wallet becomes usable only after payment is verified. Send the guest key as Authorization: Bearer.
56 57 58 59 60 61 62 63 64 |
# File 'lib/x_twitter_scraper/resources/guest_wallets.rb', line 56 def retrieve_status(params = {}) @client.request( method: :get, path: "guest-wallets/status", model: XTwitterScraper::Models::GuestWalletRetrieveStatusResponse, security: {auth_api_key: true}, options: params[:request_options] ) end |
#topup(amount_minor:, idempotency_key:, currency: :usd, request_options: {}) ⇒ XTwitterScraper::Models::GuestWalletTopupResponse
Some parameter documentations has been truncated, see Models::GuestWalletTopupParams for more details.
Create a one-use hosted checkout after the user confirms a $10-$250 USD amount for an existing paid-read guest key. The key remains the same. This request creates no charge and never redirects through Xquik.
86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/x_twitter_scraper/resources/guest_wallets.rb', line 86 def topup(params) parsed, = XTwitterScraper::GuestWalletTopupParams.dump_request(params) header_params = {idempotency_key: "idempotency-key"} @client.request( method: :post, path: "guest-wallets/topups", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: XTwitterScraper::Models::GuestWalletTopupResponse, security: {auth_api_key: true}, options: ) end |