Class: Courier::Models::Users::TopicPreference

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/courier/models/users/topic_preference.rb,
sig/courier/models/users/topic_preference.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(default_status:, status:, topic_id:, topic_name:, custom_routing: nil, digest_schedule_id: nil, has_custom_routing: nil, section_id: nil, section_name: nil) ⇒ Object

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

Parameters:

  • default_status (Symbol, Courier::Models::PreferenceStatus) —

    The topic's default status, returned on reads. It applies whenever the user has

  • status (Symbol, Courier::Models::PreferenceStatus) —

    The user's subscription status for this topic. OPTED_IN or OPTED_OUT reflect the

  • topic_id (String) —

    The unique identifier of the subscription topic this preference applies to.

  • topic_name (String) —

    The display name of the subscription topic, returned on reads.

  • custom_routing (Array<Symbol, Courier::Models::ChannelClassification>, nil) (defaults to: nil) —

    The channels the user has chosen to receive this topic on, present only when has

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

    The digest schedule this recipient is on for the topic. Omitted rather than null

  • has_custom_routing (Boolean, nil) (defaults to: nil) —

    Whether the user has chosen specific delivery channels for this topic (listed in

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

    The unique identifier of the section this topic belongs to. Always present when

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

    The display name of the section this topic belongs to. Always present when listi



# File 'lib/courier/models/users/topic_preference.rb', line 81

Instance Attribute Details

#custom_routing ⇒ Array<Symbol, Courier::Models::ChannelClassification>?

The channels the user has chosen to receive this topic on, present only when has_custom_routing is true. One or more of: direct_message, email, push, sms, webhook, inbox.

Parameters:

  • value (::Array[Courier::Models::channel_classification], nil)

Returns:



40
41
42
# File 'lib/courier/models/users/topic_preference.rb', line 40

optional :custom_routing,
-> { Courier::Internal::Type::ArrayOf[enum: Courier::ChannelClassification] },
nil?: true

#default_status ⇒ Symbol, Courier::Models::PreferenceStatus

The topic's default status, returned on reads. It applies whenever the user has no override of their own (status equals this value).

Parameters:

  • value (Courier::Models::preference_status)

Returns:



12
# File 'lib/courier/models/users/topic_preference.rb', line 12

required :default_status, enum: -> { Courier::PreferenceStatus }

#digest_schedule_id ⇒ String?

The digest schedule this recipient is on for the topic. Omitted rather than null when they have not chosen one, in which case the topic's default schedule applies. Ids come from the topic's digest configuration, returned on any read of the topic.

Also omitted when the schedule they chose has since been deleted or disabled: the recipient is on the topic's default from that point on, which is how a send already resolves it, so the field reports what would actually be used rather than a dead id.

Parameters:

  • (String)

Returns:

  • (String, nil)


56
# File 'lib/courier/models/users/topic_preference.rb', line 56

optional :digest_schedule_id, String

#has_custom_routing ⇒ Boolean?

Whether the user has chosen specific delivery channels for this topic (listed in custom_routing) rather than the topic's default routing.

Parameters:

  • value (Boolean, nil)

Returns:

  • (Boolean, nil)


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

optional :has_custom_routing, Courier::Internal::Type::Boolean, nil?: true

#section_id ⇒ String?

The unique identifier of the section this topic belongs to. Always present when listing a user's preferences; omitted by the single-topic read when the topic has no resolvable section.

Parameters:

  • (String)

Returns:

  • (String, nil)


71
# File 'lib/courier/models/users/topic_preference.rb', line 71

optional :section_id, String

#section_name ⇒ String?

The display name of the section this topic belongs to. Always present when listing a user's preferences; omitted by the single-topic read when the topic has no resolvable section.

Parameters:

  • (String)

Returns:

  • (String, nil)


79
# File 'lib/courier/models/users/topic_preference.rb', line 79

optional :section_name, String

#status ⇒ Symbol, Courier::Models::PreferenceStatus

The user's subscription status for this topic. OPTED_IN or OPTED_OUT reflect the user's own choice; REQUIRED is a topic-level default set in the preferences editor, not a user choice.

Parameters:

  • value (Courier::Models::preference_status)

Returns:



20
# File 'lib/courier/models/users/topic_preference.rb', line 20

required :status, enum: -> { Courier::PreferenceStatus }

#topic_id ⇒ String

The unique identifier of the subscription topic this preference applies to.

Parameters:

  • value (String)

Returns:

  • (String)


26
# File 'lib/courier/models/users/topic_preference.rb', line 26

required :topic_id, String

#topic_name ⇒ String

The display name of the subscription topic, returned on reads.

Parameters:

  • value (String)

Returns:

  • (String)


32
# File 'lib/courier/models/users/topic_preference.rb', line 32

required :topic_name, String

Instance Method Details

#to_hash ⇒ {

Returns:

  • ({)


54
# File 'sig/courier/models/users/topic_preference.rbs', line 54

def to_hash: -> {