Module: Twitter::REST::AccountActivity
Overview
Methods for interacting with the Account Activity API
Constant Summary
Constants included from Utils
Instance Method Summary collapse
-
#check_subscription(env_name) ⇒ nil
Checks if the user is subscribed to the webhook.
-
#create_subscription(env_name) ⇒ nil
Subscribes the application to all events for the environment.
-
#create_webhook(env_name, url) ⇒ Hash
Registers a webhook URL for all event types.
-
#deactivate_subscription(env_name) ⇒ nil
Deactivates subscription for the user and application.
-
#delete_webhook(env_name, webhook_id) ⇒ nil
Removes the webhook from the application’s configuration.
-
#list_webhooks(env_name) ⇒ Hash
Returns all environments and webhook URLs for the app.
-
#trigger_crc_check(env_name, webhook_id) ⇒ nil
Triggers the challenge response check (CRC) for a webhook.
Methods included from Utils
Instance Method Details
#check_subscription(env_name) ⇒ nil
Check if the user is subscribed to the given app
Checks if the user is subscribed to the webhook
107 108 109 |
# File 'lib/twitter/rest/account_activity.rb', line 107 def check_subscription(env_name) perform_request(:get, "/1.1/account_activity/all/#{env_name}/subscriptions.json") end |
#create_subscription(env_name) ⇒ nil
Subscribe the user to receive webhook events
Subscribes the application to all events for the environment
91 92 93 |
# File 'lib/twitter/rest/account_activity.rb', line 91 def create_subscription(env_name) perform_request(:json_post, "/1.1/account_activity/all/#{env_name}/subscriptions.json") end |
#create_webhook(env_name, url) ⇒ Hash
Create a webhook
Registers a webhook URL for all event types
26 27 28 |
# File 'lib/twitter/rest/account_activity.rb', line 26 def create_webhook(env_name, url) perform_request(:json_post, "/1.1/account_activity/all/#{env_name}/webhooks.json?url=#{url}") end |
#deactivate_subscription(env_name) ⇒ nil
Deactivate a subscription
Deactivates subscription for the user and application
123 124 125 |
# File 'lib/twitter/rest/account_activity.rb', line 123 def deactivate_subscription(env_name) perform_request(:delete, "/1.1/account_activity/all/#{env_name}/subscriptions.json") end |
#delete_webhook(env_name, webhook_id) ⇒ nil
Delete a webhook
Removes the webhook from the application’s configuration
58 59 60 |
# File 'lib/twitter/rest/account_activity.rb', line 58 def delete_webhook(env_name, webhook_id) perform_request(:delete, "/1.1/account_activity/all/#{env_name}/webhooks/#{webhook_id}.json") end |
#list_webhooks(env_name) ⇒ Hash
List webhooks
Returns all environments and webhook URLs for the app
42 43 44 |
# File 'lib/twitter/rest/account_activity.rb', line 42 def list_webhooks(env_name) perform_request(:get, "/1.1/account_activity/all/#{env_name}/webhooks.json") end |
#trigger_crc_check(env_name, webhook_id) ⇒ nil
Trigger CRC check to a webhook
Triggers the challenge response check (CRC) for a webhook
75 76 77 |
# File 'lib/twitter/rest/account_activity.rb', line 75 def trigger_crc_check(env_name, webhook_id) perform_request(:json_put, "/1.1/account_activity/all/#{env_name}/webhooks/#{webhook_id}.json") end |