Class: Courier::Resources::Automations::Invoke
- Inherits:
-
Object
- Object
- Courier::Resources::Automations::Invoke
- Defined in:
- lib/courier/resources/automations/invoke.rb,
sig/courier/resources/automations/invoke.rbs
Overview
Invoke a stored automation template or an ad hoc automation defined in the request.
Instance Method Summary collapse
-
#initialize(client:) ⇒ Invoke
constructor
private
A new instance of Invoke.
-
#invoke_ad_hoc(automation:, brand: nil, data: nil, profile: nil, recipient: nil, template: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {}) ⇒ Courier::Models::AutomationInvokeResponse
Some parameter documentations has been truncated, see Models::Automations::InvokeInvokeAdHocParams for more details.
-
#invoke_by_template(template_id, recipient:, brand: nil, data: nil, profile: nil, template: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {}) ⇒ Courier::Models::AutomationInvokeResponse
Some parameter documentations has been truncated, see Models::Automations::InvokeInvokeByTemplateParams for more details.
Constructor Details
#initialize(client:) ⇒ Invoke
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 Invoke.
98 99 100 |
# File 'lib/courier/resources/automations/invoke.rb', line 98 def initialize(client:) @client = client end |
Instance Method Details
#invoke_ad_hoc(automation:, brand: nil, data: nil, profile: nil, recipient: nil, template: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {}) ⇒ Courier::Models::AutomationInvokeResponse
Some parameter documentations has been truncated, see Models::Automations::InvokeInvokeAdHocParams for more details.
Runs a series of automation steps supplied inline, without a saved template, and returns a runId.
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/courier/resources/automations/invoke.rb', line 38 def invoke_ad_hoc(params) parsed, = Courier::Automations::InvokeInvokeAdHocParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"} @client.request( method: :post, path: "automations/invoke", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Courier::AutomationInvokeResponse, options: ) end |
#invoke_by_template(template_id, recipient:, brand: nil, data: nil, profile: nil, template: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {}) ⇒ Courier::Models::AutomationInvokeResponse
Some parameter documentations has been truncated, see Models::Automations::InvokeInvokeByTemplateParams for more details.
Starts an automation run from a saved template for one recipient, with optional data and profile, and returns a runId.
81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/courier/resources/automations/invoke.rb', line 81 def invoke_by_template(template_id, params) parsed, = Courier::Automations::InvokeInvokeByTemplateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"} @client.request( method: :post, path: ["automations/%1$s/invoke", template_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Courier::AutomationInvokeResponse, options: ) end |