Class: Courier::Models::TopicDigestScheduleRequest

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/courier/models/topic_digest_schedule_request.rb,
sig/courier/models/topic_digest_schedule_request.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(frequency:, day_of_month: nil, day_of_week: nil, days_of_week: nil, disabled: nil, is_default: nil, schedule_id: nil, time: nil, timezone: nil) ⇒ TopicDigestScheduleRequest

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

One delivery cadence for a topic's digest. Supply schedule_id to update an existing schedule in place; omit it and one is assigned and returned. The schedules array is a full replacement, so a stored schedule absent from it is deleted along with its delivery rule.

Updating by schedule_id replaces that schedule rather than merging into it: any field you leave out is cleared. Two of those change delivery silently — an omitted timezone reverts the schedule to UTC, and an omitted is_default can leave the topic with no default schedule, which is what recipients who have not chosen one fall back to. Restate every field you want to keep.

Parameters:

  • frequency (Symbol, Courier::Models::DigestFrequency) —

    How often a digest is delivered. instant delivers immediately without batching

  • day_of_month (Integer) (defaults to: nil) —

    Required when frequency is monthly.

  • day_of_week (Symbol, Courier::Models::DigestDayOfWeek) (defaults to: nil) —

    Required when frequency is weekly.

  • days_of_week (Array<Symbol, Courier::Models::DigestDayOfWeek>) (defaults to: nil) —

    Required when frequency is custom_days.

  • disabled (Boolean) (defaults to: nil) —

    Whether the schedule is disabled.

  • is_default (Boolean) (defaults to: nil) —

    The schedule recipients are placed on when they have not chosen one. Set this ex

  • schedule_id (String) (defaults to: nil) —

    Identifier of an existing schedule to update. Omit when creating a new one.

  • time (String) (defaults to: nil) —

    24-hour local delivery time, HH:MM. Required for every frequency except `insta

  • timezone (String) (defaults to: nil) —

    IANA timezone the time and day fields are expressed in, e.g. `America/New_York

  • frequency: (Courier::Models::digest_frequency)
  • day_of_month: (Integer) (defaults to: nil)
  • day_of_week: (Courier::Models::digest_day_of_week) (defaults to: nil)
  • days_of_week: (::Array[Courier::Models::digest_day_of_week]) (defaults to: nil)
  • disabled: (Boolean) (defaults to: nil)
  • is_default: (Boolean) (defaults to: nil)
  • schedule_id: (String) (defaults to: nil)
  • time: (String) (defaults to: nil)
  • timezone: (String) (defaults to: nil)


# File 'lib/courier/models/topic_digest_schedule_request.rb', line 65

Instance Attribute Details

#day_of_month ⇒ Integer?

Required when frequency is monthly.

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


17
# File 'lib/courier/models/topic_digest_schedule_request.rb', line 17

optional :day_of_month, Integer

#day_of_week ⇒ Symbol, ...

Required when frequency is weekly.

Parameters:

  • (Courier::Models::digest_day_of_week)

Returns:



23
# File 'lib/courier/models/topic_digest_schedule_request.rb', line 23

optional :day_of_week, enum: -> { Courier::DigestDayOfWeek }

#days_of_week ⇒ Array<Symbol, Courier::Models::DigestDayOfWeek>?

Required when frequency is custom_days.

Parameters:

  • (::Array[Courier::Models::digest_day_of_week])

Returns:



29
# File 'lib/courier/models/topic_digest_schedule_request.rb', line 29

optional :days_of_week, -> { Courier::Internal::Type::ArrayOf[enum: Courier::DigestDayOfWeek] }

#disabled ⇒ Boolean?

Whether the schedule is disabled.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


35
# File 'lib/courier/models/topic_digest_schedule_request.rb', line 35

optional :disabled, Courier::Internal::Type::Boolean

#frequency ⇒ Symbol, Courier::Models::DigestFrequency

How often a digest is delivered. instant delivers immediately without batching, and is the one value that takes no time.

Parameters:

  • value (Courier::Models::digest_frequency)

Returns:



11
# File 'lib/courier/models/topic_digest_schedule_request.rb', line 11

required :frequency, enum: -> { Courier::DigestFrequency }

#is_default ⇒ Boolean?

The schedule recipients are placed on when they have not chosen one. Set this explicitly rather than relying on array position.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


42
# File 'lib/courier/models/topic_digest_schedule_request.rb', line 42

optional :is_default, Courier::Internal::Type::Boolean

#schedule_id ⇒ String?

Identifier of an existing schedule to update. Omit when creating a new one.

Parameters:

  • (String)

Returns:

  • (String, nil)


48
# File 'lib/courier/models/topic_digest_schedule_request.rb', line 48

optional :schedule_id, String

#time ⇒ String?

24-hour local delivery time, HH:MM. Required for every frequency except instant.

Parameters:

  • (String)

Returns:

  • (String, nil)


55
# File 'lib/courier/models/topic_digest_schedule_request.rb', line 55

optional :time, String

#timezone ⇒ String?

IANA timezone the time and day fields are expressed in, e.g. America/New_York. Absent means UTC. Delivery follows the same local wall-clock across daylight-saving changes.

Parameters:

  • (String)

Returns:

  • (String, nil)


63
# File 'lib/courier/models/topic_digest_schedule_request.rb', line 63

optional :timezone, String

Instance Method Details

#to_hash ⇒ { frequency: Courier::Models::digest_frequency, day_of_month: Integer, day_of_week: Courier::Models::digest_day_of_week, days_of_week: ::Array[Courier::Models::digest_day_of_week], disabled: bool, is_default: bool, schedule_id: String, time: String, timezone: String }

Returns:

  • ({ frequency: Courier::Models::digest_frequency, day_of_month: Integer, day_of_week: Courier::Models::digest_day_of_week, days_of_week: ::Array[Courier::Models::digest_day_of_week], disabled: bool, is_default: bool, schedule_id: String, time: String, timezone: String })


67
68
69
70
71
72
73
74
75
76
77
# File 'sig/courier/models/topic_digest_schedule_request.rbs', line 67

def to_hash: -> {
  frequency: Courier::Models::digest_frequency,
  day_of_month: Integer,
  day_of_week: Courier::Models::digest_day_of_week,
  days_of_week: ::Array[Courier::Models::digest_day_of_week],
  disabled: bool,
  is_default: bool,
  schedule_id: String,
  time: String,
  timezone: String
}