Module: Knock::Workflows
Overview
Methods for interacting with workflows in Knock
Instance Attribute Summary
Attributes included from Base
Class Method Summary collapse
-
.cancel(key:, cancellation_key:, recipients: nil) ⇒ Hash
Cancels the workflow with the given key and cancellation key.
-
.trigger(key:, actor:, recipients:, data: {}, cancellation_key: nil, tenant: nil) ⇒ Hash
Triggers the workflow with the given key.
Methods included from Client
client, delete_request, execute_request, get_request, handle_error_response, post_request, put_request, user_agent
Class Method Details
.cancel(key:, cancellation_key:, recipients: nil) ⇒ Hash
Cancels the workflow with the given key and cancellation key
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/knock/workflows.rb', line 47 def cancel(key:, cancellation_key:, recipients: nil) attrs = { cancellation_key: cancellation_key, recipients: recipients } request = post_request( auth: true, path: "/v1/workflows/#{key}/cancel", body: attrs ) execute_request(request: request) end |
.trigger(key:, actor:, recipients:, data: {}, cancellation_key: nil, tenant: nil) ⇒ Hash
Triggers the workflow with the given key
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/knock/workflows.rb', line 22 def trigger(key:, actor:, recipients:, data: {}, cancellation_key: nil, tenant: nil) attrs = { actor: actor, recipients: recipients, data: data, cancellation_key: cancellation_key, tenant: tenant } request = post_request( auth: true, path: "/v1/workflows/#{key}/trigger", body: attrs ) execute_request(request: request) end |