Class: Courier::Resources::Journeys

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Journeys

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

Parameters:



68
69
70
# File 'lib/courier/resources/journeys.rb', line 68

def initialize(client:)
  @client = client
end

Instance Method Details

#invoke(template_id, data: nil, profile: nil, user_id: nil, request_options: {}) ⇒ Courier::Models::JourneysInvokeResponse

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

Invoke a journey run from a journey template.

Parameters:

  • template_id (String)

    A unique identifier representing the journey template to be invoked. This could

  • data (Hash{Symbol=>Object})

    Data payload passed to the journey. The expected shape can be predefined using t

  • profile (Hash{Symbol=>Object})

    Profile data for the user. Can contain contact information (email, phone_number)

  • user_id (String)

    A unique identifier for the user. If not provided, the system will attempt to re

  • request_options (Courier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



54
55
56
57
58
59
60
61
62
63
# File 'lib/courier/resources/journeys.rb', line 54

def invoke(template_id, params = {})
  parsed, options = Courier::JourneyInvokeParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["journeys/%1$s/invoke", template_id],
    body: parsed,
    model: Courier::JourneysInvokeResponse,
    options: options
  )
end

#list(cursor: nil, version: nil, request_options: {}) ⇒ Courier::Models::JourneysListResponse

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

Get the list of journeys.

Parameters:

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/courier/resources/journeys.rb', line 22

def list(params = {})
  parsed, options = Courier::JourneyListParams.dump_request(params)
  query = Courier::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "journeys",
    query: query,
    model: Courier::JourneysListResponse,
    options: options
  )
end