Class: XTwitterScraper::Resources::APIKeys
- Inherits:
-
Object
- Object
- XTwitterScraper::Resources::APIKeys
- Defined in:
- lib/x_twitter_scraper/resources/api_keys.rb
Overview
API key management (session auth only)
Instance Method Summary collapse
-
#create(name: nil, request_options: {}) ⇒ XTwitterScraper::Models::APIKeyCreateResponse
Create API key.
-
#initialize(client:) ⇒ APIKeys
constructor
private
A new instance of APIKeys.
-
#list(request_options: {}) ⇒ XTwitterScraper::Models::APIKeyListResponse
List API keys.
-
#revoke(id, request_options: {}) ⇒ XTwitterScraper::Models::APIKeyRevokeResponse
Revoke API key.
Constructor Details
#initialize(client:) ⇒ APIKeys
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 APIKeys.
72 73 74 |
# File 'lib/x_twitter_scraper/resources/api_keys.rb', line 72 def initialize(client:) @client = client end |
Instance Method Details
#create(name: nil, request_options: {}) ⇒ XTwitterScraper::Models::APIKeyCreateResponse
Create API key
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/x_twitter_scraper/resources/api_keys.rb', line 17 def create(params = {}) parsed, = XTwitterScraper::APIKeyCreateParams.dump_request(params) @client.request( method: :post, path: "api-keys", body: parsed, model: XTwitterScraper::Models::APIKeyCreateResponse, security: {auth_api_key: true}, options: ) end |
#list(request_options: {}) ⇒ XTwitterScraper::Models::APIKeyListResponse
List API keys
38 39 40 41 42 43 44 45 46 |
# File 'lib/x_twitter_scraper/resources/api_keys.rb', line 38 def list(params = {}) @client.request( method: :get, path: "api-keys", model: XTwitterScraper::Models::APIKeyListResponse, security: {auth_api_key: true}, options: params[:request_options] ) end |
#revoke(id, request_options: {}) ⇒ XTwitterScraper::Models::APIKeyRevokeResponse
Revoke API key
59 60 61 62 63 64 65 66 67 |
# File 'lib/x_twitter_scraper/resources/api_keys.rb', line 59 def revoke(id, params = {}) @client.request( method: :delete, path: ["api-keys/%1$s", id], model: XTwitterScraper::Models::APIKeyRevokeResponse, security: {auth_api_key: true}, options: params[:request_options] ) end |