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, 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:

  • channel (String) (defaults to: nil)

    The channel the contents of this element should be applied to. Can be email,

  • font_size (String, nil) (defaults to: nil)

    Email only. Document-level base font size (CSS px, e.g. 16px) for body content

  • line_height (String, nil) (defaults to: nil)

    Email only. Document-level line height (CSS px or unitless multiplier, e.g. `24p

  • padding (String, nil) (defaults to: nil)

    Email only. Document-level body padding applied once around the email body, as a

  • raw (Hash{Symbol=>Object}, nil) (defaults to: nil)

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



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

Instance Attribute Details

#channelString?

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

#font_sizeString?

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)


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

optional :font_size, String, nil?: true

#line_heightString?

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)


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

optional :line_height, String, nil?: true

#paddingString?

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)


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

optional :padding, String, nil?: true

#rawHash{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)


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

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

Instance Method Details

#to_hash{

Returns:

  • ({)


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

def to_hash: -> {