Class: Courier::Resources::Automations::Invoke

Inherits:
Object
  • Object
show all
Defined in:
lib/courier/resources/automations/invoke.rb

Instance Method Summary collapse

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.

Parameters:



74
75
76
# File 'lib/courier/resources/automations/invoke.rb', line 74

def initialize(client:)
  @client = client
end

Instance Method Details

#invoke_ad_hoc(automation:, brand: nil, data: nil, profile: nil, recipient: nil, template: nil, request_options: {}) ⇒ Courier::Models::AutomationInvokeResponse

Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a series of automation steps. For information about what steps are available, checkout the ad hoc automation guide [here](www.courier.com/docs/automations/steps/).

Parameters:

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
# File 'lib/courier/resources/automations/invoke.rb', line 25

def invoke_ad_hoc(params)
  parsed, options = Courier::Automations::InvokeInvokeAdHocParams.dump_request(params)
  @client.request(
    method: :post,
    path: "automations/invoke",
    body: parsed,
    model: Courier::AutomationInvokeResponse,
    options: options
  )
end

#invoke_by_template(template_id, recipient:, brand: nil, data: nil, profile: nil, template: nil, request_options: {}) ⇒ Courier::Models::AutomationInvokeResponse

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

Invoke an automation run from an automation template.

Parameters:

  • template_id (String)

    A unique identifier representing the automation template to be invoked. This cou

  • recipient (String, nil)
  • brand (String, nil)
  • data (Hash{Symbol=>Object}, nil)
  • profile (Hash{Symbol=>Object}, nil)
  • template (String, nil)
  • request_options (Courier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



60
61
62
63
64
65
66
67
68
69
# File 'lib/courier/resources/automations/invoke.rb', line 60

def invoke_by_template(template_id, params)
  parsed, options = Courier::Automations::InvokeInvokeByTemplateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["automations/%1$s/invoke", template_id],
    body: parsed,
    model: Courier::AutomationInvokeResponse,
    options: options
  )
end