trycourier 6.4.0 → 6.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +1 -1
  4. data/lib/courier/models/elemental_action_node.rb +123 -0
  5. data/lib/courier/models/elemental_action_node_with_type.rb +3 -1
  6. data/lib/courier/models/elemental_channel_node.rb +1 -1
  7. data/lib/courier/models/elemental_divider_node.rb +18 -0
  8. data/lib/courier/models/elemental_divider_node_with_type.rb +3 -1
  9. data/lib/courier/models/elemental_html_node.rb +33 -0
  10. data/lib/courier/models/elemental_html_node_with_type.rb +5 -1
  11. data/lib/courier/models/elemental_image_node.rb +74 -0
  12. data/lib/courier/models/elemental_image_node_with_type.rb +3 -1
  13. data/lib/courier/models/elemental_meta_node.rb +23 -0
  14. data/lib/courier/models/elemental_meta_node_with_type.rb +5 -1
  15. data/lib/courier/models/elemental_node.rb +9 -18
  16. data/lib/courier/models/elemental_quote_node.rb +72 -0
  17. data/lib/courier/models/elemental_quote_node_with_type.rb +3 -1
  18. data/lib/courier/models/elemental_text_node.rb +134 -0
  19. data/lib/courier/models/elemental_text_node_with_type.rb +3 -1
  20. data/lib/courier/models/locales.rb +18 -0
  21. data/lib/courier/models.rb +19 -0
  22. data/lib/courier/version.rb +1 -1
  23. data/lib/courier.rb +8 -0
  24. data/rbi/courier/models/elemental_action_node.rbi +153 -0
  25. data/rbi/courier/models/elemental_action_node_with_type.rbi +2 -1
  26. data/rbi/courier/models/elemental_divider_node.rbi +28 -0
  27. data/rbi/courier/models/elemental_divider_node_with_type.rbi +2 -1
  28. data/rbi/courier/models/elemental_html_node.rbi +52 -0
  29. data/rbi/courier/models/elemental_html_node_with_type.rbi +4 -1
  30. data/rbi/courier/models/elemental_image_node.rbi +94 -0
  31. data/rbi/courier/models/elemental_image_node_with_type.rbi +2 -1
  32. data/rbi/courier/models/elemental_meta_node.rbi +30 -0
  33. data/rbi/courier/models/elemental_meta_node_with_type.rbi +4 -1
  34. data/rbi/courier/models/elemental_node.rbi +1 -10
  35. data/rbi/courier/models/elemental_quote_node.rbi +95 -0
  36. data/rbi/courier/models/elemental_quote_node_with_type.rbi +2 -1
  37. data/rbi/courier/models/elemental_text_node.rbi +177 -0
  38. data/rbi/courier/models/elemental_text_node_with_type.rbi +2 -1
  39. data/rbi/courier/models/locales.rbi +27 -0
  40. data/rbi/courier/models.rbi +18 -0
  41. data/sig/courier/models/elemental_action_node.rbs +112 -0
  42. data/sig/courier/models/elemental_action_node_with_type.rbs +1 -1
  43. data/sig/courier/models/elemental_divider_node.rbs +15 -0
  44. data/sig/courier/models/elemental_divider_node_with_type.rbs +1 -1
  45. data/sig/courier/models/elemental_html_node.rbs +23 -0
  46. data/sig/courier/models/elemental_html_node_with_type.rbs +1 -1
  47. data/sig/courier/models/elemental_image_node.rbs +71 -0
  48. data/sig/courier/models/elemental_image_node_with_type.rbs +1 -1
  49. data/sig/courier/models/elemental_meta_node.rbs +15 -0
  50. data/sig/courier/models/elemental_meta_node_with_type.rbs +1 -1
  51. data/sig/courier/models/elemental_quote_node.rbs +66 -0
  52. data/sig/courier/models/elemental_quote_node_with_type.rbs +1 -1
  53. data/sig/courier/models/elemental_text_node.rbs +127 -0
  54. data/sig/courier/models/elemental_text_node_with_type.rbs +1 -1
  55. data/sig/courier/models/locales.rbs +17 -0
  56. data/sig/courier/models.rbs +18 -0
  57. metadata +25 -1
@@ -0,0 +1,134 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class ElementalTextNode < Courier::Models::ElementalBaseNode
6
+ # @!attribute content
7
+ # The text content displayed in the notification. Either this field must be
8
+ # specified, or the elements field
9
+ #
10
+ # @return [String]
11
+ required :content, String
12
+
13
+ # @!attribute align
14
+ # Text alignment.
15
+ #
16
+ # @return [Symbol, Courier::Models::ElementalTextNode::Align, nil]
17
+ optional :align, enum: -> { Courier::ElementalTextNode::Align }
18
+
19
+ # @!attribute bold
20
+ # Apply bold to the text
21
+ #
22
+ # @return [String, nil]
23
+ optional :bold, String, nil?: true
24
+
25
+ # @!attribute color
26
+ # Specifies the color of text. Can be any valid css color value
27
+ #
28
+ # @return [String, nil]
29
+ optional :color, String, nil?: true
30
+
31
+ # @!attribute font_size
32
+ # CSS px font size for this text block, e.g. `16px`. Overrides the size of the
33
+ # `text_style` preset. Email only.
34
+ #
35
+ # @return [String, nil]
36
+ optional :font_size, String, nil?: true
37
+
38
+ # @!attribute format_
39
+ #
40
+ # @return [Symbol, Courier::Models::ElementalTextNode::Format, nil]
41
+ optional :format_, enum: -> { Courier::ElementalTextNode::Format }, api_name: :format, nil?: true
42
+
43
+ # @!attribute italic
44
+ # Apply italics to the text
45
+ #
46
+ # @return [String, nil]
47
+ optional :italic, String, nil?: true
48
+
49
+ # @!attribute line_height
50
+ # CSS line height for this text block, as a px value or a unitless multiplier,
51
+ # e.g. `24px` or `1.5`. Email only.
52
+ #
53
+ # @return [String, nil]
54
+ optional :line_height, String, nil?: true
55
+
56
+ # @!attribute locales
57
+ # Region specific content. See
58
+ # [locales docs](https://www.courier.com/docs/platform/content/elemental/locales/)
59
+ # for more details.
60
+ #
61
+ # @return [Hash{Symbol=>Courier::Models::LocaleItem}, nil]
62
+ optional :locales, -> { Courier::Internal::Type::HashOf[Courier::LocaleItem] }, nil?: true
63
+
64
+ # @!attribute strikethrough
65
+ # Apply a strike through the text
66
+ #
67
+ # @return [String, nil]
68
+ optional :strikethrough, String, nil?: true
69
+
70
+ # @!attribute text_style
71
+ # Allows the text to be rendered as a heading level.
72
+ #
73
+ # @return [Symbol, Courier::Models::TextStyle, nil]
74
+ optional :text_style, enum: -> { Courier::TextStyle }, nil?: true
75
+
76
+ # @!attribute underline
77
+ # Apply an underline to the text
78
+ #
79
+ # @return [String, nil]
80
+ optional :underline, String, nil?: true
81
+
82
+ # @!method initialize(content:, align: nil, bold: nil, color: nil, font_size: nil, format_: nil, italic: nil, line_height: nil, locales: nil, strikethrough: nil, text_style: nil, underline: nil)
83
+ # Some parameter documentations has been truncated, see
84
+ # {Courier::Models::ElementalTextNode} for more details.
85
+ #
86
+ # Represents a body of text to be rendered inside of the notification.
87
+ #
88
+ # @param content [String] The text content displayed in the notification. Either this
89
+ #
90
+ # @param align [Symbol, Courier::Models::ElementalTextNode::Align] Text alignment.
91
+ #
92
+ # @param bold [String, nil] Apply bold to the text
93
+ #
94
+ # @param color [String, nil] Specifies the color of text. Can be any valid css color value
95
+ #
96
+ # @param font_size [String, nil] CSS px font size for this text block, e.g. `16px`. Overrides the size of the `te
97
+ #
98
+ # @param format_ [Symbol, Courier::Models::ElementalTextNode::Format, nil]
99
+ #
100
+ # @param italic [String, nil] Apply italics to the text
101
+ #
102
+ # @param line_height [String, nil] CSS line height for this text block, as a px value or a unitless multiplier, e.g
103
+ #
104
+ # @param locales [Hash{Symbol=>Courier::Models::LocaleItem}, nil] Region specific content. See [locales docs](https://www.courier.com/docs/platfor
105
+ #
106
+ # @param strikethrough [String, nil] Apply a strike through the text
107
+ #
108
+ # @param text_style [Symbol, Courier::Models::TextStyle, nil] Allows the text to be rendered as a heading level.
109
+ #
110
+ # @param underline [String, nil] Apply an underline to the text
111
+
112
+ # Text alignment.
113
+ module Align
114
+ extend Courier::Internal::Type::Enum
115
+
116
+ LEFT = :left
117
+ CENTER = :center
118
+ RIGHT = :right
119
+
120
+ # @!method self.values
121
+ # @return [Array<Symbol>]
122
+ end
123
+
124
+ module Format
125
+ extend Courier::Internal::Type::Enum
126
+
127
+ MARKDOWN = :markdown
128
+
129
+ # @!method self.values
130
+ # @return [Array<Symbol>]
131
+ end
132
+ end
133
+ end
134
+ end
@@ -2,13 +2,15 @@
2
2
 
3
3
  module Courier
4
4
  module Models
5
- class ElementalTextNodeWithType < Courier::Models::ElementalBaseNode
5
+ class ElementalTextNodeWithType < Courier::Models::ElementalTextNode
6
6
  # @!attribute type
7
7
  #
8
8
  # @return [Symbol, Courier::Models::ElementalTextNodeWithType::Type, nil]
9
9
  optional :type, enum: -> { Courier::ElementalTextNodeWithType::Type }
10
10
 
11
11
  # @!method initialize(type: nil)
12
+ # Represents a body of text to be rendered inside of the notification.
13
+ #
12
14
  # @param type [Symbol, Courier::Models::ElementalTextNodeWithType::Type]
13
15
 
14
16
  module Type
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Models
5
+ class LocaleItem < Courier::Internal::Type::BaseModel
6
+ # @!attribute content
7
+ #
8
+ # @return [String]
9
+ required :content, String
10
+
11
+ # @!method initialize(content:)
12
+ # @param content [String]
13
+ end
14
+
15
+ # @type [Courier::Internal::Type::Converter]
16
+ Locales = Courier::Internal::Type::HashOf[-> { Courier::LocaleItem }]
17
+ end
18
+ end
@@ -195,6 +195,8 @@ module Courier
195
195
 
196
196
  Discord = Courier::Models::Discord
197
197
 
198
+ ElementalActionNode = Courier::Models::ElementalActionNode
199
+
198
200
  ElementalActionNodeWithType = Courier::Models::ElementalActionNodeWithType
199
201
 
200
202
  ElementalBaseNode = Courier::Models::ElementalBaseNode
@@ -207,18 +209,30 @@ module Courier
207
209
 
208
210
  ElementalContentSugar = Courier::Models::ElementalContentSugar
209
211
 
212
+ ElementalDividerNode = Courier::Models::ElementalDividerNode
213
+
210
214
  ElementalDividerNodeWithType = Courier::Models::ElementalDividerNodeWithType
211
215
 
216
+ ElementalHTMLNode = Courier::Models::ElementalHTMLNode
217
+
212
218
  ElementalHTMLNodeWithType = Courier::Models::ElementalHTMLNodeWithType
213
219
 
220
+ ElementalImageNode = Courier::Models::ElementalImageNode
221
+
214
222
  ElementalImageNodeWithType = Courier::Models::ElementalImageNodeWithType
215
223
 
224
+ ElementalMetaNode = Courier::Models::ElementalMetaNode
225
+
216
226
  ElementalMetaNodeWithType = Courier::Models::ElementalMetaNodeWithType
217
227
 
218
228
  ElementalNode = Courier::Models::ElementalNode
219
229
 
230
+ ElementalQuoteNode = Courier::Models::ElementalQuoteNode
231
+
220
232
  ElementalQuoteNodeWithType = Courier::Models::ElementalQuoteNodeWithType
221
233
 
234
+ ElementalTextNode = Courier::Models::ElementalTextNode
235
+
222
236
  ElementalTextNodeWithType = Courier::Models::ElementalTextNodeWithType
223
237
 
224
238
  ElementWithChecksums = Courier::Models::ElementWithChecksums
@@ -378,6 +392,11 @@ module Courier
378
392
 
379
393
  ListUpdateParams = Courier::Models::ListUpdateParams
380
394
 
395
+ LocaleItem = Courier::Models::LocaleItem
396
+
397
+ # @type [Courier::Internal::Type::Converter]
398
+ Locales = Courier::Models::Locales
399
+
381
400
  Logo = Courier::Models::Logo
382
401
 
383
402
  MessageCancelParams = Courier::Models::MessageCancelParams
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Courier
4
- VERSION = "6.4.0"
4
+ VERSION = "6.4.1"
5
5
  end
data/lib/courier.rb CHANGED
@@ -62,7 +62,14 @@ require_relative "courier/models/update_broadcast_request"
62
62
  require_relative "courier/models/inbound_bulk_message_user"
63
63
  require_relative "courier/models/base_check"
64
64
  require_relative "courier/models/subscription_topic_new"
65
+ require_relative "courier/models/elemental_action_node"
65
66
  require_relative "courier/models/elemental_channel_node"
67
+ require_relative "courier/models/elemental_divider_node"
68
+ require_relative "courier/models/elemental_html_node"
69
+ require_relative "courier/models/elemental_image_node"
70
+ require_relative "courier/models/elemental_meta_node"
71
+ require_relative "courier/models/elemental_quote_node"
72
+ require_relative "courier/models/elemental_text_node"
66
73
  require_relative "courier/models/cancel_journey_request"
67
74
  require_relative "courier/models/create_journey_request"
68
75
  require_relative "courier/models/journeys_invoke_request"
@@ -275,6 +282,7 @@ require_relative "courier/models/lists/subscription_subscribe_params"
275
282
  require_relative "courier/models/lists/subscription_subscribe_user_params"
276
283
  require_relative "courier/models/lists/subscription_unsubscribe_user_params"
277
284
  require_relative "courier/models/list_update_params"
285
+ require_relative "courier/models/locales"
278
286
  require_relative "courier/models/logo"
279
287
  require_relative "courier/models/message_cancel_params"
280
288
  require_relative "courier/models/message_channels"
@@ -0,0 +1,153 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class ElementalActionNode < Courier::Models::ElementalBaseNode
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::ElementalActionNode, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # The text content of the action shown to the user.
12
+ sig { returns(String) }
13
+ attr_accessor :content
14
+
15
+ # The target URL of the action.
16
+ sig { returns(String) }
17
+ attr_accessor :href
18
+
19
+ # A unique id used to identify the action when it is executed.
20
+ sig { returns(T.nilable(String)) }
21
+ attr_accessor :action_id
22
+
23
+ # The alignment of the action button. Defaults to "center".
24
+ sig { returns(T.nilable(Courier::Alignment::OrSymbol)) }
25
+ attr_accessor :align
26
+
27
+ # The background color of the action button.
28
+ sig { returns(T.nilable(String)) }
29
+ attr_accessor :background_color
30
+
31
+ # CSS border-radius applied to the action button. For example, `4px`
32
+ sig { returns(T.nilable(String)) }
33
+ attr_accessor :border_radius
34
+
35
+ # CSS border width applied to the action button. For example, `1px`
36
+ sig { returns(T.nilable(String)) }
37
+ attr_accessor :border_size
38
+
39
+ # When true, the action's href is not rewritten for click-through tracking, even
40
+ # when click-through tracking is enabled for the workspace.
41
+ sig { returns(T.nilable(T::Boolean)) }
42
+ attr_accessor :disable_tracking
43
+
44
+ # CSS font-size applied to the action button label. For example, `14px`
45
+ sig { returns(T.nilable(String)) }
46
+ attr_accessor :font_size
47
+
48
+ # Region specific content. See
49
+ # [locales docs](https://www.courier.com/docs/platform/content/elemental/locales/)
50
+ # for more details.
51
+ sig { returns(T.nilable(T::Hash[Symbol, Courier::LocaleItem])) }
52
+ attr_accessor :locales
53
+
54
+ # CSS padding applied to the action button. For example, `8px 16px`
55
+ sig { returns(T.nilable(String)) }
56
+ attr_accessor :padding
57
+
58
+ # Defaults to `button`.
59
+ sig { returns(T.nilable(Courier::ElementalActionNode::Style::OrSymbol)) }
60
+ attr_accessor :style
61
+
62
+ # Allows the user to execute an action. Can be a button or a link.
63
+ sig do
64
+ params(
65
+ content: String,
66
+ href: String,
67
+ action_id: T.nilable(String),
68
+ align: T.nilable(Courier::Alignment::OrSymbol),
69
+ background_color: T.nilable(String),
70
+ border_radius: T.nilable(String),
71
+ border_size: T.nilable(String),
72
+ disable_tracking: T.nilable(T::Boolean),
73
+ font_size: T.nilable(String),
74
+ locales: T.nilable(T::Hash[Symbol, Courier::LocaleItem::OrHash]),
75
+ padding: T.nilable(String),
76
+ style: T.nilable(Courier::ElementalActionNode::Style::OrSymbol)
77
+ ).returns(T.attached_class)
78
+ end
79
+ def self.new(
80
+ # The text content of the action shown to the user.
81
+ content:,
82
+ # The target URL of the action.
83
+ href:,
84
+ # A unique id used to identify the action when it is executed.
85
+ action_id: nil,
86
+ # The alignment of the action button. Defaults to "center".
87
+ align: nil,
88
+ # The background color of the action button.
89
+ background_color: nil,
90
+ # CSS border-radius applied to the action button. For example, `4px`
91
+ border_radius: nil,
92
+ # CSS border width applied to the action button. For example, `1px`
93
+ border_size: nil,
94
+ # When true, the action's href is not rewritten for click-through tracking, even
95
+ # when click-through tracking is enabled for the workspace.
96
+ disable_tracking: nil,
97
+ # CSS font-size applied to the action button label. For example, `14px`
98
+ font_size: nil,
99
+ # Region specific content. See
100
+ # [locales docs](https://www.courier.com/docs/platform/content/elemental/locales/)
101
+ # for more details.
102
+ locales: nil,
103
+ # CSS padding applied to the action button. For example, `8px 16px`
104
+ padding: nil,
105
+ # Defaults to `button`.
106
+ style: nil
107
+ )
108
+ end
109
+
110
+ sig do
111
+ override.returns(
112
+ {
113
+ content: String,
114
+ href: String,
115
+ action_id: T.nilable(String),
116
+ align: T.nilable(Courier::Alignment::OrSymbol),
117
+ background_color: T.nilable(String),
118
+ border_radius: T.nilable(String),
119
+ border_size: T.nilable(String),
120
+ disable_tracking: T.nilable(T::Boolean),
121
+ font_size: T.nilable(String),
122
+ locales: T.nilable(T::Hash[Symbol, Courier::LocaleItem]),
123
+ padding: T.nilable(String),
124
+ style: T.nilable(Courier::ElementalActionNode::Style::OrSymbol)
125
+ }
126
+ )
127
+ end
128
+ def to_hash
129
+ end
130
+
131
+ # Defaults to `button`.
132
+ module Style
133
+ extend Courier::Internal::Type::Enum
134
+
135
+ TaggedSymbol =
136
+ T.type_alias { T.all(Symbol, Courier::ElementalActionNode::Style) }
137
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
138
+
139
+ BUTTON =
140
+ T.let(:button, Courier::ElementalActionNode::Style::TaggedSymbol)
141
+ LINK = T.let(:link, Courier::ElementalActionNode::Style::TaggedSymbol)
142
+
143
+ sig do
144
+ override.returns(
145
+ T::Array[Courier::ElementalActionNode::Style::TaggedSymbol]
146
+ )
147
+ end
148
+ def self.values
149
+ end
150
+ end
151
+ end
152
+ end
153
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Courier
4
4
  module Models
5
- class ElementalActionNodeWithType < Courier::Models::ElementalBaseNode
5
+ class ElementalActionNodeWithType < Courier::Models::ElementalActionNode
6
6
  OrHash =
7
7
  T.type_alias do
8
8
  T.any(
@@ -21,6 +21,7 @@ module Courier
21
21
  end
22
22
  attr_writer :type
23
23
 
24
+ # Allows the user to execute an action. Can be a button or a link.
24
25
  sig do
25
26
  params(
26
27
  type: Courier::ElementalActionNodeWithType::Type::OrSymbol
@@ -0,0 +1,28 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class ElementalDividerNode < Courier::Models::ElementalBaseNode
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::ElementalDividerNode, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # The CSS color to render the line with. For example, `#fff`
12
+ sig { returns(T.nilable(String)) }
13
+ attr_accessor :color
14
+
15
+ # Renders a dividing line between elements.
16
+ sig { params(color: T.nilable(String)).returns(T.attached_class) }
17
+ def self.new(
18
+ # The CSS color to render the line with. For example, `#fff`
19
+ color: nil
20
+ )
21
+ end
22
+
23
+ sig { override.returns({ color: T.nilable(String) }) }
24
+ def to_hash
25
+ end
26
+ end
27
+ end
28
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Courier
4
4
  module Models
5
- class ElementalDividerNodeWithType < Courier::Models::ElementalBaseNode
5
+ class ElementalDividerNodeWithType < Courier::Models::ElementalDividerNode
6
6
  OrHash =
7
7
  T.type_alias do
8
8
  T.any(
@@ -23,6 +23,7 @@ module Courier
23
23
  end
24
24
  attr_writer :type
25
25
 
26
+ # Renders a dividing line between elements.
26
27
  sig do
27
28
  params(
28
29
  type: Courier::ElementalDividerNodeWithType::Type::OrSymbol
@@ -0,0 +1,52 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class ElementalHTMLNode < Courier::Models::ElementalBaseNode
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::ElementalHTMLNode, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # Raw HTML string to render inside the notification.
12
+ sig { returns(String) }
13
+ attr_accessor :content
14
+
15
+ # Region specific content. See
16
+ # [locales docs](https://www.courier.com/docs/platform/content/elemental/locales/)
17
+ # for more details.
18
+ sig { returns(T.nilable(T::Hash[Symbol, Courier::LocaleItem])) }
19
+ attr_accessor :locales
20
+
21
+ # Raw HTML string inside an Elemental document. When rendering a message, this
22
+ # node is turned into output only for the email channel; for other channels it
23
+ # produces no blocks.
24
+ sig do
25
+ params(
26
+ content: String,
27
+ locales: T.nilable(T::Hash[Symbol, Courier::LocaleItem::OrHash])
28
+ ).returns(T.attached_class)
29
+ end
30
+ def self.new(
31
+ # Raw HTML string to render inside the notification.
32
+ content:,
33
+ # Region specific content. See
34
+ # [locales docs](https://www.courier.com/docs/platform/content/elemental/locales/)
35
+ # for more details.
36
+ locales: nil
37
+ )
38
+ end
39
+
40
+ sig do
41
+ override.returns(
42
+ {
43
+ content: String,
44
+ locales: T.nilable(T::Hash[Symbol, Courier::LocaleItem])
45
+ }
46
+ )
47
+ end
48
+ def to_hash
49
+ end
50
+ end
51
+ end
52
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Courier
4
4
  module Models
5
- class ElementalHTMLNodeWithType < Courier::Models::ElementalBaseNode
5
+ class ElementalHTMLNodeWithType < Courier::Models::ElementalHTMLNode
6
6
  OrHash =
7
7
  T.type_alias do
8
8
  T.any(Courier::ElementalHTMLNodeWithType, Courier::Internal::AnyHash)
@@ -18,6 +18,9 @@ module Courier
18
18
  end
19
19
  attr_writer :type
20
20
 
21
+ # Raw HTML string inside an Elemental document. When rendering a message, this
22
+ # node is turned into output only for the email channel; for other channels it
23
+ # produces no blocks.
21
24
  sig do
22
25
  params(
23
26
  type: Courier::ElementalHTMLNodeWithType::Type::OrSymbol
@@ -0,0 +1,94 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class ElementalImageNode < Courier::Models::ElementalBaseNode
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::ElementalImageNode, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # The source of the image.
12
+ sig { returns(String) }
13
+ attr_accessor :src
14
+
15
+ # The alignment of the image.
16
+ sig { returns(T.nilable(Courier::Alignment::OrSymbol)) }
17
+ attr_accessor :align
18
+
19
+ # Alternate text for the image.
20
+ sig { returns(T.nilable(String)) }
21
+ attr_accessor :alt_text
22
+
23
+ # CSS border color applied to the image. For example, `#ccc`
24
+ sig { returns(T.nilable(String)) }
25
+ attr_accessor :border_color
26
+
27
+ # CSS border width applied to the image. For example, `1px`
28
+ sig { returns(T.nilable(String)) }
29
+ attr_accessor :border_size
30
+
31
+ # A URL to link to when the image is clicked.
32
+ sig { returns(T.nilable(String)) }
33
+ attr_accessor :href
34
+
35
+ # CSS padding applied around the image. For example, `10px`
36
+ sig { returns(T.nilable(String)) }
37
+ attr_accessor :padding
38
+
39
+ # CSS width properties to apply to the image. For example, 50px
40
+ sig { returns(T.nilable(String)) }
41
+ attr_accessor :width
42
+
43
+ # Used to embed an image into the notification.
44
+ sig do
45
+ params(
46
+ src: String,
47
+ align: T.nilable(Courier::Alignment::OrSymbol),
48
+ alt_text: T.nilable(String),
49
+ border_color: T.nilable(String),
50
+ border_size: T.nilable(String),
51
+ href: T.nilable(String),
52
+ padding: T.nilable(String),
53
+ width: T.nilable(String)
54
+ ).returns(T.attached_class)
55
+ end
56
+ def self.new(
57
+ # The source of the image.
58
+ src:,
59
+ # The alignment of the image.
60
+ align: nil,
61
+ # Alternate text for the image.
62
+ alt_text: nil,
63
+ # CSS border color applied to the image. For example, `#ccc`
64
+ border_color: nil,
65
+ # CSS border width applied to the image. For example, `1px`
66
+ border_size: nil,
67
+ # A URL to link to when the image is clicked.
68
+ href: nil,
69
+ # CSS padding applied around the image. For example, `10px`
70
+ padding: nil,
71
+ # CSS width properties to apply to the image. For example, 50px
72
+ width: nil
73
+ )
74
+ end
75
+
76
+ sig do
77
+ override.returns(
78
+ {
79
+ src: String,
80
+ align: T.nilable(Courier::Alignment::OrSymbol),
81
+ alt_text: T.nilable(String),
82
+ border_color: T.nilable(String),
83
+ border_size: T.nilable(String),
84
+ href: T.nilable(String),
85
+ padding: T.nilable(String),
86
+ width: T.nilable(String)
87
+ }
88
+ )
89
+ end
90
+ def to_hash
91
+ end
92
+ end
93
+ end
94
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Courier
4
4
  module Models
5
- class ElementalImageNodeWithType < Courier::Models::ElementalBaseNode
5
+ class ElementalImageNodeWithType < Courier::Models::ElementalImageNode
6
6
  OrHash =
7
7
  T.type_alias do
8
8
  T.any(Courier::ElementalImageNodeWithType, Courier::Internal::AnyHash)
@@ -18,6 +18,7 @@ module Courier
18
18
  end
19
19
  attr_writer :type
20
20
 
21
+ # Used to embed an image into the notification.
21
22
  sig do
22
23
  params(
23
24
  type: Courier::ElementalImageNodeWithType::Type::OrSymbol
@@ -0,0 +1,30 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class ElementalMetaNode < Courier::Models::ElementalBaseNode
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::ElementalMetaNode, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ # The title to be displayed by supported channels. For example, the email subject.
12
+ sig { returns(T.nilable(String)) }
13
+ attr_accessor :title
14
+
15
+ # The meta element contains information describing the notification that may be
16
+ # used by a particular channel or provider. One important field is the title field
17
+ # which will be used as the title for channels that support it.
18
+ sig { params(title: T.nilable(String)).returns(T.attached_class) }
19
+ def self.new(
20
+ # The title to be displayed by supported channels. For example, the email subject.
21
+ title: nil
22
+ )
23
+ end
24
+
25
+ sig { override.returns({ title: T.nilable(String) }) }
26
+ def to_hash
27
+ end
28
+ end
29
+ end
30
+ end