Class: XTwitterScraper::Resources::Webhooks
- Inherits:
-
Object
- Object
- XTwitterScraper::Resources::Webhooks
- Defined in:
- lib/x_twitter_scraper/resources/webhooks.rb
Overview
Webhook endpoint management & delivery
Instance Method Summary collapse
-
#create(event_types:, url:, request_options: {}) ⇒ XTwitterScraper::Models::WebhookCreateResponse
Create webhook.
-
#deactivate(id, request_options: {}) ⇒ XTwitterScraper::Models::WebhookDeactivateResponse
Deactivate webhook.
-
#initialize(client:) ⇒ Webhooks
constructor
private
A new instance of Webhooks.
-
#list(request_options: {}) ⇒ XTwitterScraper::Models::WebhookListResponse
List webhooks.
-
#list_deliveries(id, request_options: {}) ⇒ XTwitterScraper::Models::WebhookListDeliveriesResponse
List webhook deliveries.
-
#test_(id, request_options: {}) ⇒ XTwitterScraper::Models::WebhookTestResponse
Test webhook endpoint.
-
#update(id, event_types: nil, is_active: nil, url: nil, request_options: {}) ⇒ XTwitterScraper::Models::Webhook
Update webhook.
Constructor Details
#initialize(client:) ⇒ Webhooks
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 Webhooks.
140 141 142 |
# File 'lib/x_twitter_scraper/resources/webhooks.rb', line 140 def initialize(client:) @client = client end |
Instance Method Details
#create(event_types:, url:, request_options: {}) ⇒ XTwitterScraper::Models::WebhookCreateResponse
Create webhook
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/x_twitter_scraper/resources/webhooks.rb', line 20 def create(params) parsed, = XTwitterScraper::WebhookCreateParams.dump_request(params) @client.request( method: :post, path: "webhooks", body: parsed, model: XTwitterScraper::Models::WebhookCreateResponse, options: ) end |
#deactivate(id, request_options: {}) ⇒ XTwitterScraper::Models::WebhookDeactivateResponse
Deactivate webhook
88 89 90 91 92 93 94 95 |
# File 'lib/x_twitter_scraper/resources/webhooks.rb', line 88 def deactivate(id, params = {}) @client.request( method: :delete, path: ["webhooks/%1$s", id], model: XTwitterScraper::Models::WebhookDeactivateResponse, options: params[:request_options] ) end |
#list(request_options: {}) ⇒ XTwitterScraper::Models::WebhookListResponse
List webhooks
68 69 70 71 72 73 74 75 |
# File 'lib/x_twitter_scraper/resources/webhooks.rb', line 68 def list(params = {}) @client.request( method: :get, path: "webhooks", model: XTwitterScraper::Models::WebhookListResponse, options: params[:request_options] ) end |
#list_deliveries(id, request_options: {}) ⇒ XTwitterScraper::Models::WebhookListDeliveriesResponse
List webhook deliveries
108 109 110 111 112 113 114 115 |
# File 'lib/x_twitter_scraper/resources/webhooks.rb', line 108 def list_deliveries(id, params = {}) @client.request( method: :get, path: ["webhooks/%1$s/deliveries", id], model: XTwitterScraper::Models::WebhookListDeliveriesResponse, options: params[:request_options] ) end |
#test_(id, request_options: {}) ⇒ XTwitterScraper::Models::WebhookTestResponse
Test webhook endpoint
128 129 130 131 132 133 134 135 |
# File 'lib/x_twitter_scraper/resources/webhooks.rb', line 128 def test_(id, params = {}) @client.request( method: :post, path: ["webhooks/%1$s/test", id], model: XTwitterScraper::Models::WebhookTestResponse, options: params[:request_options] ) end |
#update(id, event_types: nil, is_active: nil, url: nil, request_options: {}) ⇒ XTwitterScraper::Models::Webhook
Update webhook
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/x_twitter_scraper/resources/webhooks.rb', line 48 def update(id, params = {}) parsed, = XTwitterScraper::WebhookUpdateParams.dump_request(params) @client.request( method: :patch, path: ["webhooks/%1$s", id], body: parsed, model: XTwitterScraper::Webhook, options: ) end |