Class: Amocrm::Resources::Webhooks
- Inherits:
-
Object
- Object
- Amocrm::Resources::Webhooks
- Defined in:
- lib/amocrm/resources/webhooks.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ Webhooks
constructor
private
A new instance of Webhooks.
-
#list(filter: nil, request_options: {}) ⇒ Amocrm::Models::WebhookListResponse::WebhookListResponse, Amocrm::Models::WebhookListResponse::Problem
Get webhooks list.
-
#subscribe(destination:, settings:, sort: nil, request_options: {}) ⇒ Amocrm::Models::WebhookSubscribeResponse::Webhook, Amocrm::Models::WebhookSubscribeResponse::Problem
Subscribe to webhook events.
-
#unsubscribe(destination:, request_options: {}) ⇒ Amocrm::Models::WebhookUnsubscribeResponse::EmptyResponse, Amocrm::Models::WebhookUnsubscribeResponse::Problem
Unsubscribe webhook by destination.
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.
75 76 77 |
# File 'lib/amocrm/resources/webhooks.rb', line 75 def initialize(client:) @client = client end |
Instance Method Details
#list(filter: nil, request_options: {}) ⇒ Amocrm::Models::WebhookListResponse::WebhookListResponse, Amocrm::Models::WebhookListResponse::Problem
Get webhooks list.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/amocrm/resources/webhooks.rb', line 16 def list(params = {}) parsed, = Amocrm::WebhookListParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v4/webhooks", query: query, model: Amocrm::Models::WebhookListResponse, options: ) end |
#subscribe(destination:, settings:, sort: nil, request_options: {}) ⇒ Amocrm::Models::WebhookSubscribeResponse::Webhook, Amocrm::Models::WebhookSubscribeResponse::Problem
Subscribe to webhook events.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/amocrm/resources/webhooks.rb', line 40 def subscribe(params) parsed, = Amocrm::WebhookSubscribeParams.dump_request(params) @client.request( method: :post, path: "api/v4/webhooks", body: parsed, model: Amocrm::Models::WebhookSubscribeResponse, options: ) end |
#unsubscribe(destination:, request_options: {}) ⇒ Amocrm::Models::WebhookUnsubscribeResponse::EmptyResponse, Amocrm::Models::WebhookUnsubscribeResponse::Problem
Unsubscribe webhook by destination.
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/amocrm/resources/webhooks.rb', line 61 def unsubscribe(params) parsed, = Amocrm::WebhookUnsubscribeParams.dump_request(params) @client.request( method: :delete, path: "api/v4/webhooks", body: parsed, model: Amocrm::Models::WebhookUnsubscribeResponse, options: ) end |