Class: Cerca::Resources::Webhooks
- Inherits:
-
Object
- Object
- Cerca::Resources::Webhooks
- Defined in:
- lib/cerca/resources/webhooks.rb
Instance Method Summary collapse
-
#create(fleet_id, url:, events: nil, request_options: {}) ⇒ Cerca::Models::WebhookSubscriptionCreated
Create webhook.
-
#delete(fleet_id, webhook_id, request_options: {}) ⇒ nil
Delete webhook.
-
#initialize(client:) ⇒ Webhooks
constructor
private
A new instance of Webhooks.
-
#list(fleet_id, cursor: nil, limit: nil, request_options: {}) ⇒ Cerca::Internal::SubscriptionsCursorPage<Cerca::Models::WebhookSubscription>
Some parameter documentations has been truncated, see Models::WebhookListParams for more details.
-
#retrieve(fleet_id, webhook_id, request_options: {}) ⇒ Cerca::Models::WebhookSubscription
Retrieve webhook.
-
#rotate(fleet_id, webhook_id, request_options: {}) ⇒ Cerca::Models::WebhookSubscriptionCreated
Rotate webhook secret.
-
#test_(fleet_id, webhook_id, request_options: {}) ⇒ Cerca::Models::WebhookTestResponse
Send test webhook.
-
#update(fleet_id, webhook_id, enabled: nil, events: nil, url: nil, request_options: {}) ⇒ Cerca::Models::WebhookSubscription
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.
176 177 178 |
# File 'lib/cerca/resources/webhooks.rb', line 176 def initialize(client:) @client = client end |
Instance Method Details
#create(fleet_id, url:, events: nil, request_options: {}) ⇒ Cerca::Models::WebhookSubscriptionCreated
Create webhook
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cerca/resources/webhooks.rb', line 21 def create(fleet_id, params) parsed, = Cerca::WebhookCreateParams.dump_request(params) @client.request( method: :post, path: ["fleets/%1$s/webhooks", fleet_id], body: parsed, model: Cerca::WebhookSubscriptionCreated, options: ) end |
#delete(fleet_id, webhook_id, request_options: {}) ⇒ nil
Delete webhook
124 125 126 127 128 129 130 131 |
# File 'lib/cerca/resources/webhooks.rb', line 124 def delete(fleet_id, webhook_id, params = {}) @client.request( method: :delete, path: ["fleets/%1$s/webhooks/%2$s", fleet_id, webhook_id], model: NilClass, options: params[:request_options] ) end |
#list(fleet_id, cursor: nil, limit: nil, request_options: {}) ⇒ Cerca::Internal::SubscriptionsCursorPage<Cerca::Models::WebhookSubscription>
Some parameter documentations has been truncated, see Models::WebhookListParams for more details.
List webhooks
100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/cerca/resources/webhooks.rb', line 100 def list(fleet_id, params = {}) parsed, = Cerca::WebhookListParams.dump_request(params) query = Cerca::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["fleets/%1$s/webhooks", fleet_id], query: query, page: Cerca::Internal::SubscriptionsCursorPage, model: Cerca::WebhookSubscription, options: ) end |
#retrieve(fleet_id, webhook_id, request_options: {}) ⇒ Cerca::Models::WebhookSubscription
Retrieve webhook
43 44 45 46 47 48 49 50 |
# File 'lib/cerca/resources/webhooks.rb', line 43 def retrieve(fleet_id, webhook_id, params = {}) @client.request( method: :get, path: ["fleets/%1$s/webhooks/%2$s", fleet_id, webhook_id], model: Cerca::WebhookSubscription, options: params[:request_options] ) end |
#rotate(fleet_id, webhook_id, request_options: {}) ⇒ Cerca::Models::WebhookSubscriptionCreated
Rotate webhook secret
144 145 146 147 148 149 150 151 |
# File 'lib/cerca/resources/webhooks.rb', line 144 def rotate(fleet_id, webhook_id, params = {}) @client.request( method: :post, path: ["fleets/%1$s/webhooks/%2$s/rotate", fleet_id, webhook_id], model: Cerca::WebhookSubscriptionCreated, options: params[:request_options] ) end |
#test_(fleet_id, webhook_id, request_options: {}) ⇒ Cerca::Models::WebhookTestResponse
Send test webhook
164 165 166 167 168 169 170 171 |
# File 'lib/cerca/resources/webhooks.rb', line 164 def test_(fleet_id, webhook_id, params = {}) @client.request( method: :post, path: ["fleets/%1$s/webhooks/%2$s/test", fleet_id, webhook_id], model: Cerca::Models::WebhookTestResponse, options: params[:request_options] ) end |
#update(fleet_id, webhook_id, enabled: nil, events: nil, url: nil, request_options: {}) ⇒ Cerca::Models::WebhookSubscription
Update webhook
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/cerca/resources/webhooks.rb', line 71 def update(fleet_id, webhook_id, params = {}) parsed, = Cerca::WebhookUpdateParams.dump_request(params) @client.request( method: :put, path: ["fleets/%1$s/webhooks/%2$s", fleet_id, webhook_id], body: parsed, model: Cerca::WebhookSubscription, options: ) end |