Class: Courier::Resources::Digests::Schedules

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Schedules

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

Parameters:



66
67
68
# File 'lib/courier/resources/digests/schedules.rb', line 66

def initialize(client:)
  @client = client
end

Instance Method Details

#list_instances(schedule_id, cursor: nil, limit: nil, request_options: {}) ⇒ Courier::Models::DigestInstanceListResponse

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

List the digest instances for a schedule. Each instance represents the events accumulated for a single user against the schedule, and can be used to monitor digest accumulation before the digest is released.

Parameters:

  • schedule_id (String)

    The ID of the digest schedule, in the form ‘sch/uuid`. The value must be URL-e

  • cursor (String)

    A cursor token from a previous response, used to fetch the next page of results.

  • limit (Integer)

    The maximum number of digest instances to return. Defaults to 20, with a maximum

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

Returns:

See Also:



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/courier/resources/digests/schedules.rb', line 27

def list_instances(schedule_id, params = {})
  parsed, options = Courier::Digests::ScheduleListInstancesParams.dump_request(params)
  query = Courier::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["digests/schedules/%1$s/instances", schedule_id],
    query: query,
    model: Courier::DigestInstanceListResponse,
    options: options
  )
end

#release(schedule_id, request_options: {}) ⇒ nil

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

Send a digest now instead of waiting for its scheduled time, so your users get what they have collected so far right away.

Parameters:

  • schedule_id (String)

    The ID of the digest schedule to release, in the form ‘sch/uuid`. The value mu

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

Returns:

  • (nil)

See Also:



54
55
56
57
58
59
60
61
# File 'lib/courier/resources/digests/schedules.rb', line 54

def release(schedule_id, params = {})
  @client.request(
    method: :post,
    path: ["digests/schedules/%1$s/trigger", schedule_id],
    model: NilClass,
    options: params[:request_options]
  )
end