Class: XTwitterScraper::Resources::Account

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

Overview

Account info & 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:



73
74
75
# File 'lib/x_twitter_scraper/resources/account.rb', line 73

def initialize(client:)
  @client = client
end

Instance Method Details

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

Get account info

Parameters:

Returns:

See Also:



16
17
18
19
20
21
22
23
24
# File 'lib/x_twitter_scraper/resources/account.rb', line 16

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

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

Set linked X username

Parameters:

Returns:

See Also:



37
38
39
40
41
42
43
44
45
46
# File 'lib/x_twitter_scraper/resources/account.rb', line 37

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



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

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