Class: XTwitterScraper::Resources::Styles
- Inherits:
-
Object
- Object
- XTwitterScraper::Resources::Styles
- Defined in:
- lib/x_twitter_scraper/resources/styles.rb
Overview
Tweet composition, drafts, writing styles & radar
Instance Method Summary collapse
-
#analyze(username:, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Analyze writing style from recent tweets.
-
#compare(username1:, username2:, request_options: {}) ⇒ XTwitterScraper::Models::StyleCompareResponse
Compare two style profiles.
-
#delete(id, request_options: {}) ⇒ nil
Delete a style profile.
-
#get_performance(id, request_options: {}) ⇒ XTwitterScraper::Models::StyleGetPerformanceResponse
Get engagement metrics for style tweets.
-
#initialize(client:) ⇒ Styles
constructor
private
A new instance of Styles.
-
#list(request_options: {}) ⇒ XTwitterScraper::Models::StyleListResponse
List cached style profiles.
-
#retrieve(id, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Get cached style profile.
-
#update(id, label:, tweets:, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Save style profile with custom tweets.
Constructor Details
#initialize(client:) ⇒ Styles
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 Styles.
161 162 163 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 161 def initialize(client:) @client = client end |
Instance Method Details
#analyze(username:, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Analyze writing style from recent tweets
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 102 def analyze(params) parsed, = XTwitterScraper::StyleAnalyzeParams.dump_request(params) @client.request( method: :post, path: "styles", body: parsed, model: XTwitterScraper::StyleProfile, options: ) end |
#compare(username1:, username2:, request_options: {}) ⇒ XTwitterScraper::Models::StyleCompareResponse
Compare two style profiles
126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 126 def compare(params) parsed, = XTwitterScraper::StyleCompareParams.dump_request(params) query = XTwitterScraper::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "styles/compare", query: query, model: XTwitterScraper::Models::StyleCompareResponse, options: ) end |
#delete(id, request_options: {}) ⇒ nil
Delete a style profile
82 83 84 85 86 87 88 89 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 82 def delete(id, params = {}) @client.request( method: :delete, path: ["styles/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#get_performance(id, request_options: {}) ⇒ XTwitterScraper::Models::StyleGetPerformanceResponse
Get engagement metrics for style tweets
149 150 151 152 153 154 155 156 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 149 def get_performance(id, params = {}) @client.request( method: :get, path: ["styles/%1$s/performance", id], model: XTwitterScraper::Models::StyleGetPerformanceResponse, options: params[:request_options] ) end |
#list(request_options: {}) ⇒ XTwitterScraper::Models::StyleListResponse
List cached style profiles
62 63 64 65 66 67 68 69 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 62 def list(params = {}) @client.request( method: :get, path: "styles", model: XTwitterScraper::Models::StyleListResponse, options: params[:request_options] ) end |
#retrieve(id, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Get cached style profile
18 19 20 21 22 23 24 25 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 18 def retrieve(id, params = {}) @client.request( method: :get, path: ["styles/%1$s", id], model: XTwitterScraper::StyleProfile, options: params[:request_options] ) end |
#update(id, label:, tweets:, request_options: {}) ⇒ XTwitterScraper::Models::StyleProfile
Save style profile with custom tweets
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/x_twitter_scraper/resources/styles.rb', line 42 def update(id, params) parsed, = XTwitterScraper::StyleUpdateParams.dump_request(params) @client.request( method: :put, path: ["styles/%1$s", id], body: parsed, model: XTwitterScraper::StyleProfile, options: ) end |