Class: Knockapi::Resources::Workflows

Inherits:
Object
  • Object
show all
Defined in:
lib/knockapi/resources/workflows.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Workflows

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 Workflows.

Parameters:



79
80
81
# File 'lib/knockapi/resources/workflows.rb', line 79

def initialize(client:)
  @client = client
end

Instance Method Details

#cancel(key, cancellation_key:, recipients: nil, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::WorkflowCancelParams for more details.

When invoked for a workflow using a specific workflow key and cancellation key, will cancel any queued workflow runs associated with that key/cancellation key pair. Can optionally be provided one or more recipients to scope the request to.

Parameters:

Returns:

  • (nil)

See Also:



26
27
28
29
30
31
32
33
34
35
# File 'lib/knockapi/resources/workflows.rb', line 26

def cancel(key, params)
  parsed, options = Knockapi::WorkflowCancelParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/workflows/%1$s/cancel", key],
    body: parsed,
    model: NilClass,
    options: options
  )
end

#trigger(key, recipients:, actor: nil, cancellation_key: nil, data: nil, tenant: nil, request_options: {}) ⇒ Knockapi::Models::WorkflowTriggerResponse

Some parameter documentations has been truncated, see Models::WorkflowTriggerParams for more details.

Trigger a workflow (specified by the key) to run for the given recipients, using the parameters provided. Returns an identifier for the workflow run request. All workflow runs are executed asynchronously. This endpoint also handles [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients) for the ‘actor`, `recipient`, and `tenant` fields.

Parameters:

Returns:

See Also:



65
66
67
68
69
70
71
72
73
74
# File 'lib/knockapi/resources/workflows.rb', line 65

def trigger(key, params)
  parsed, options = Knockapi::WorkflowTriggerParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/workflows/%1$s/trigger", key],
    body: parsed,
    model: Knockapi::Models::WorkflowTriggerResponse,
    options: options
  )
end