Class: XTwitterScraper::Resources::Draws
- Inherits:
-
Object
- Object
- XTwitterScraper::Resources::Draws
- Defined in:
- lib/x_twitter_scraper/resources/draws.rb
Overview
Giveaway draws from tweet replies
Instance Method Summary collapse
-
#export(id, format_: nil, type: nil, request_options: {}) ⇒ StringIO
Export draw data.
-
#initialize(client:) ⇒ Draws
constructor
private
A new instance of Draws.
-
#list(after: nil, limit: nil, request_options: {}) ⇒ XTwitterScraper::Models::DrawListResponse
List draws.
-
#retrieve(id, request_options: {}) ⇒ XTwitterScraper::Models::DrawRetrieveResponse
Get draw details.
-
#run(tweet_url:, backup_count: nil, filter_account_age_days: nil, filter_language: nil, filter_min_followers: nil, must_follow_username: nil, must_retweet: nil, required_hashtags: nil, required_keywords: nil, required_mentions: nil, unique_authors_only: nil, winner_count: nil, request_options: {}) ⇒ XTwitterScraper::Models::DrawRunResponse
Run giveaway draw.
Constructor Details
#initialize(client:) ⇒ Draws
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 Draws.
115 116 117 |
# File 'lib/x_twitter_scraper/resources/draws.rb', line 115 def initialize(client:) @client = client end |
Instance Method Details
#export(id, format_: nil, type: nil, request_options: {}) ⇒ StringIO
Export draw data
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/x_twitter_scraper/resources/draws.rb', line 67 def export(id, params = {}) parsed, = XTwitterScraper::DrawExportParams.dump_request(params) query = XTwitterScraper::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["draws/%1$s/export", id], query: query.transform_keys(format_: "format"), headers: {"accept" => "application/octet-stream"}, model: StringIO, options: ) end |
#list(after: nil, limit: nil, request_options: {}) ⇒ XTwitterScraper::Models::DrawListResponse
List draws
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/x_twitter_scraper/resources/draws.rb', line 40 def list(params = {}) parsed, = XTwitterScraper::DrawListParams.dump_request(params) query = XTwitterScraper::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "draws", query: query, model: XTwitterScraper::Models::DrawListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ XTwitterScraper::Models::DrawRetrieveResponse
Get draw details
18 19 20 21 22 23 24 25 |
# File 'lib/x_twitter_scraper/resources/draws.rb', line 18 def retrieve(id, params = {}) @client.request( method: :get, path: ["draws/%1$s", id], model: XTwitterScraper::Models::DrawRetrieveResponse, options: params[:request_options] ) end |
#run(tweet_url:, backup_count: nil, filter_account_age_days: nil, filter_language: nil, filter_min_followers: nil, must_follow_username: nil, must_retweet: nil, required_hashtags: nil, required_keywords: nil, required_mentions: nil, unique_authors_only: nil, winner_count: nil, request_options: {}) ⇒ XTwitterScraper::Models::DrawRunResponse
Run giveaway draw
101 102 103 104 105 106 107 108 109 110 |
# File 'lib/x_twitter_scraper/resources/draws.rb', line 101 def run(params) parsed, = XTwitterScraper::DrawRunParams.dump_request(params) @client.request( method: :post, path: "draws", body: parsed, model: XTwitterScraper::Models::DrawRunResponse, options: ) end |