Class: XTwitterScraper::Resources::Support::Attachments

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

Overview

Support ticket management

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Attachments

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

Parameters:



36
37
38
# File 'lib/x_twitter_scraper/resources/support/attachments.rb', line 36

def initialize(client:)
  @client = client
end

Instance Method Details

#download(id, range: nil, request_options: {}) ⇒ StringIO

Streams an authenticated user's support image or video. Video requests support one standard byte range for seeking and resumable playback.

Parameters:

  • id (String)

    Support attachment public ID

  • range (String)

    Optional single byte range

  • request_options (XTwitterScraper::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



22
23
24
25
26
27
28
29
30
31
# File 'lib/x_twitter_scraper/resources/support/attachments.rb', line 22

def download(id, params = {})
  parsed, options = XTwitterScraper::Support::AttachmentDownloadParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["support/attachments/%1$s", id],
    headers: {"accept" => "application/octet-stream", **parsed}.transform_keys(range: "range"),
    model: StringIO,
    options: options
  )
end