Class: EInvoiceAPI::Resources::Webhooks
- Inherits:
-
Object
- Object
- EInvoiceAPI::Resources::Webhooks
- Defined in:
- lib/e_invoice_api/resources/webhooks.rb
Instance Method Summary collapse
-
#create(events: , url: , enabled: nil, request_options: {}) ⇒ EInvoiceAPI::Models::WebhookResponse
Create a new webhook.
-
#delete(webhook_id, request_options: {}) ⇒ EInvoiceAPI::Models::WebhookDeleteResponse
Delete a webhook.
-
#initialize(client:) ⇒ Webhooks
constructor
private
A new instance of Webhooks.
-
#list(request_options: {}) ⇒ Array<EInvoiceAPI::Models::WebhookResponse>
Get all webhooks for the current tenant.
-
#retrieve(webhook_id, request_options: {}) ⇒ EInvoiceAPI::Models::WebhookResponse
Get a webhook by ID.
-
#update(webhook_id, enabled: nil, events: nil, url: nil, request_options: {}) ⇒ EInvoiceAPI::Models::WebhookResponse
Update a webhook by ID.
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.
112 113 114 |
# File 'lib/e_invoice_api/resources/webhooks.rb', line 112 def initialize(client:) @client = client end |
Instance Method Details
#create(events: , url: , enabled: nil, request_options: {}) ⇒ EInvoiceAPI::Models::WebhookResponse
Create a new webhook
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/e_invoice_api/resources/webhooks.rb', line 18 def create(params) parsed, = EInvoiceAPI::WebhookCreateParams.dump_request(params) @client.request( method: :post, path: "api/webhooks/", body: parsed, model: EInvoiceAPI::WebhookResponse, options: ) end |
#delete(webhook_id, request_options: {}) ⇒ EInvoiceAPI::Models::WebhookDeleteResponse
Delete a webhook
100 101 102 103 104 105 106 107 |
# File 'lib/e_invoice_api/resources/webhooks.rb', line 100 def delete(webhook_id, params = {}) @client.request( method: :delete, path: ["api/webhooks/%1$s", webhook_id], model: EInvoiceAPI::Models::WebhookDeleteResponse, options: params[:request_options] ) end |
#list(request_options: {}) ⇒ Array<EInvoiceAPI::Models::WebhookResponse>
Get all webhooks for the current tenant
81 82 83 84 85 86 87 88 |
# File 'lib/e_invoice_api/resources/webhooks.rb', line 81 def list(params = {}) @client.request( method: :get, path: "api/webhooks/", model: EInvoiceAPI::Internal::Type::ArrayOf[EInvoiceAPI::WebhookResponse], options: params[:request_options] ) end |
#retrieve(webhook_id, request_options: {}) ⇒ EInvoiceAPI::Models::WebhookResponse
Get a webhook by ID
39 40 41 42 43 44 45 46 |
# File 'lib/e_invoice_api/resources/webhooks.rb', line 39 def retrieve(webhook_id, params = {}) @client.request( method: :get, path: ["api/webhooks/%1$s", webhook_id], model: EInvoiceAPI::WebhookResponse, options: params[:request_options] ) end |
#update(webhook_id, enabled: nil, events: nil, url: nil, request_options: {}) ⇒ EInvoiceAPI::Models::WebhookResponse
Update a webhook by ID
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/e_invoice_api/resources/webhooks.rb', line 61 def update(webhook_id, params = {}) parsed, = EInvoiceAPI::WebhookUpdateParams.dump_request(params) @client.request( method: :put, path: ["api/webhooks/%1$s", webhook_id], body: parsed, model: EInvoiceAPI::WebhookResponse, options: ) end |