Class: XTwitterScraper::Resources::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/x_twitter_scraper/resources/account.rb,
sig/x_twitter_scraper/resources/account.rbs

Overview

Account info and settings

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Account

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 Account.

Parameters:



75
76
77
# File 'lib/x_twitter_scraper/resources/account.rb', line 75

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(request_options: {}) ⇒ XTwitterScraper::Models::AccountRetrieveResponse

Get account info

Parameters:

Returns:

See Also:



20
21
22
23
24
25
26
27
# File 'lib/x_twitter_scraper/resources/account.rb', line 20

def retrieve(params = {})
  @client.request(
    method: :get,
    path: "account",
    model: XTwitterScraper::Models::AccountRetrieveResponse,
    options: params[:request_options]
  )
end

#set_x_username(username:, request_options: {}) ⇒ XTwitterScraper::Models::AccountSetXUsernameResponse

Set linked X username

Parameters:

Returns:

See Also:



40
41
42
43
44
45
46
47
48
49
# File 'lib/x_twitter_scraper/resources/account.rb', line 40

def set_x_username(params)
  parsed, options = XTwitterScraper::AccountSetXUsernameParams.dump_request(params)
  @client.request(
    method: :put,
    path: "account/x-identity",
    body: parsed,
    model: XTwitterScraper::Models::AccountSetXUsernameResponse,
    options: options
  )
end

#update_locale(locale:, request_options: {}) ⇒ XTwitterScraper::Models::AccountUpdateLocaleResponse

Update account locale



61
62
63
64
65
66
67
68
69
70
# File 'lib/x_twitter_scraper/resources/account.rb', line 61

def update_locale(params)
  parsed, options = XTwitterScraper::AccountUpdateLocaleParams.dump_request(params)
  @client.request(
    method: :patch,
    path: "account",
    body: parsed,
    model: XTwitterScraper::Models::AccountUpdateLocaleResponse,
    options: options
  )
end