Class: Courier::Models::ElementalChannelNode

Inherits:
ElementalBaseNode show all
Defined in:
lib/courier/models/elemental_channel_node.rb,
sig/courier/models/elemental_channel_node.rbs

Direct Known Subclasses

ElementalChannelNodeWithType

Instance Attribute Summary collapse

Attributes inherited from ElementalBaseNode

#channels, #if_, #loop_, #ref

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(channel: nil, elements: nil, font_size: nil, line_height: nil, padding: nil, raw: nil) ⇒ Object

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

The channel element allows a notification to be customized based on which channel it is sent through. For example, you may want to display a detailed message when the notification is sent through email, and a more concise message in a push notification. Channel elements are only valid as top-level elements; you cannot nest channel elements. If there is a channel element specified at the top-level of the document, all sibling elements must be channel elements. Note: As an alternative, most elements support a channel property. Which allows you to selectively display an individual element on a per channel basis. See the control flow docs for more details.

Parameters:



# File 'lib/courier/models/elemental_channel_node.rb', line 52

Instance Attribute Details

#channel ⇒ String?

The channel the contents of this element should be applied to. Can be email, push, direct_message, sms or a provider such as slack

Parameters:

  • _ (String)

Returns:

  • (String, nil)


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

optional :channel, String

#elements ⇒ Array<Courier::Models::ElementalNodeNonChannel::UnionMember0, Courier::Models::ElementalNodeNonChannel::UnionMember1, Courier::Models::ElementalNodeNonChannel::UnionMember2, Courier::Models::ElementalNodeNonChannel::UnionMember3, Courier::Models::ElementalNodeNonChannel::UnionMember4, Courier::Models::ElementalNodeNonChannel::UnionMember5, Courier::Models::ElementalNodeNonChannel::UnionMember6>?

An array of elements to apply to the channel. If raw has not been specified, elements is required. Channel elements cannot nest, so these are any node except another channel block.



19
20
21
# File 'lib/courier/models/elemental_channel_node.rb', line 19

optional :elements,
-> { Courier::Internal::Type::ArrayOf[union: Courier::ElementalNodeNonChannel] },
nil?: true

#font_size ⇒ String?

Email only. Document-level base font size (CSS px, e.g. 16px) for body content — text, quote, list and action button labels. Heading styles (h1/h2/h3) and subtext keep their preset sizes.

Parameters:

  • _ (String, nil)

Returns:

  • (String, nil)


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

optional :font_size, String, nil?: true

#line_height ⇒ String?

Email only. Document-level line height (CSS px or unitless multiplier, e.g. 24px or 1.5) applied to all body content unless overridden per block.

Parameters:

  • _ (String, nil)

Returns:

  • (String, nil)


36
# File 'lib/courier/models/elemental_channel_node.rb', line 36

optional :line_height, String, nil?: true

#padding ⇒ String?

Email only. Document-level body padding applied once around the email body, as a CSS px shorthand (1–4 values), e.g. 48px 64px.

Parameters:

  • _ (String, nil)

Returns:

  • (String, nil)


43
# File 'lib/courier/models/elemental_channel_node.rb', line 43

optional :padding, String, nil?: true

#raw ⇒ Hash{Symbol=>Object}?

Raw data to apply to the channel. If elements has not been specified, raw is required.

Parameters:

  • _ (::Hash[Symbol, top], nil)

Returns:

  • (Hash{Symbol=>Object}, nil)


50
# File 'lib/courier/models/elemental_channel_node.rb', line 50

optional :raw, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown], nil?: true

Instance Method Details

#to_hash ⇒ {

Returns:

  • ({)


49
# File 'sig/courier/models/elemental_channel_node.rbs', line 49

def to_hash: -> {