Class: XTwitterScraper::Resources::X::Accounts
- Inherits:
-
Object
- Object
- XTwitterScraper::Resources::X::Accounts
- Defined in:
- lib/x_twitter_scraper/resources/x/accounts.rb
Overview
Connected X account management
Instance Method Summary collapse
-
#bulk_retry(request_options: {}) ⇒ XTwitterScraper::Models::X::AccountBulkRetryResponse
Clears loginFailedAt and loginFailureReason for all accounts with transient or automated failure reasons, making them eligible for retry on next use.
-
#create(email:, password:, username:, proxy_country: nil, totp_secret: nil, request_options: {}) ⇒ XTwitterScraper::Models::X::AccountCreateResponse
Connect X account.
-
#delete(id, request_options: {}) ⇒ XTwitterScraper::Models::X::AccountDeleteResponse
Disconnect X account.
-
#initialize(client:) ⇒ Accounts
constructor
private
A new instance of Accounts.
-
#list(request_options: {}) ⇒ XTwitterScraper::Models::X::AccountListResponse
List connected X accounts.
-
#reauth(id, password:, totp_secret: nil, request_options: {}) ⇒ XTwitterScraper::Models::X::AccountReauthResponse
Re-authenticate X account.
-
#retrieve(id, request_options: {}) ⇒ XTwitterScraper::Models::X::XAccountDetail
Get X account details.
Constructor Details
#initialize(client:) ⇒ Accounts
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 Accounts.
150 151 152 |
# File 'lib/x_twitter_scraper/resources/x/accounts.rb', line 150 def initialize(client:) @client = client end |
Instance Method Details
#bulk_retry(request_options: {}) ⇒ XTwitterScraper::Models::X::AccountBulkRetryResponse
Clears loginFailedAt and loginFailureReason for all accounts with transient or automated failure reasons, making them eligible for retry on next use.
110 111 112 113 114 115 116 117 118 |
# File 'lib/x_twitter_scraper/resources/x/accounts.rb', line 110 def bulk_retry(params = {}) @client.request( method: :post, path: "x/accounts/bulk-retry", model: XTwitterScraper::Models::X::AccountBulkRetryResponse, security: {auth_api_key: true}, options: params[:request_options] ) end |
#create(email:, password:, username:, proxy_country: nil, totp_secret: nil, request_options: {}) ⇒ XTwitterScraper::Models::X::AccountCreateResponse
Connect X account
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/x_twitter_scraper/resources/x/accounts.rb', line 27 def create(params) parsed, = XTwitterScraper::X::AccountCreateParams.dump_request(params) @client.request( method: :post, path: "x/accounts", body: parsed, model: XTwitterScraper::Models::X::AccountCreateResponse, security: {auth_api_key: true}, options: ) end |
#delete(id, request_options: {}) ⇒ XTwitterScraper::Models::X::AccountDeleteResponse
Disconnect X account
90 91 92 93 94 95 96 97 98 |
# File 'lib/x_twitter_scraper/resources/x/accounts.rb', line 90 def delete(id, params = {}) @client.request( method: :delete, path: ["x/accounts/%1$s", id], model: XTwitterScraper::Models::X::AccountDeleteResponse, security: {auth_api_key: true}, options: params[:request_options] ) end |
#list(request_options: {}) ⇒ XTwitterScraper::Models::X::AccountListResponse
List connected X accounts
69 70 71 72 73 74 75 76 77 |
# File 'lib/x_twitter_scraper/resources/x/accounts.rb', line 69 def list(params = {}) @client.request( method: :get, path: "x/accounts", model: XTwitterScraper::Models::X::AccountListResponse, security: {auth_api_key: true}, options: params[:request_options] ) end |
#reauth(id, password:, totp_secret: nil, request_options: {}) ⇒ XTwitterScraper::Models::X::AccountReauthResponse
Re-authenticate X account
135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/x_twitter_scraper/resources/x/accounts.rb', line 135 def reauth(id, params) parsed, = XTwitterScraper::X::AccountReauthParams.dump_request(params) @client.request( method: :post, path: ["x/accounts/%1$s/reauth", id], body: parsed, model: XTwitterScraper::Models::X::AccountReauthResponse, security: {auth_api_key: true}, options: ) end |
#retrieve(id, request_options: {}) ⇒ XTwitterScraper::Models::X::XAccountDetail
Get X account details
50 51 52 53 54 55 56 57 58 |
# File 'lib/x_twitter_scraper/resources/x/accounts.rb', line 50 def retrieve(id, params = {}) @client.request( method: :get, path: ["x/accounts/%1$s", id], model: XTwitterScraper::X::XAccountDetail, security: {auth_api_key: true}, options: params[:request_options] ) end |