Class: Courier::Send::ElementalDividerNode
- Inherits:
-
Object
- Object
- Courier::Send::ElementalDividerNode
- Defined in:
- lib/trycourier/send/types/elemental_divider_node.rb
Overview
Renders a dividing line between elements.
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#if_ ⇒ Object
readonly
Returns the value of attribute if_.
-
#loop ⇒ Object
readonly
Returns the value of attribute loop.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Send::ElementalDividerNode
Deserialize a JSON object to an instance of ElementalDividerNode.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(color: nil, channels: nil, ref: nil, if_: nil, loop: nil, additional_properties: nil) ⇒ Send::ElementalDividerNode constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of ElementalDividerNode to a JSON object.
Constructor Details
#initialize(color: nil, channels: nil, ref: nil, if_: nil, loop: nil, additional_properties: nil) ⇒ Send::ElementalDividerNode
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/trycourier/send/types/elemental_divider_node.rb', line 18 def initialize(color: nil, channels: nil, ref: nil, if_: nil, loop: nil, additional_properties: nil) # @type [String] The CSS color to render the line with. For example, `#fff` @color = color # @type [Array<String>] @channels = channels # @type [String] @ref = ref # @type [String] @if_ = if_ # @type [String] @loop = loop # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
9 10 11 |
# File 'lib/trycourier/send/types/elemental_divider_node.rb', line 9 def additional_properties @additional_properties end |
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
9 10 11 |
# File 'lib/trycourier/send/types/elemental_divider_node.rb', line 9 def channels @channels end |
#color ⇒ Object (readonly)
Returns the value of attribute color.
9 10 11 |
# File 'lib/trycourier/send/types/elemental_divider_node.rb', line 9 def color @color end |
#if_ ⇒ Object (readonly)
Returns the value of attribute if_.
9 10 11 |
# File 'lib/trycourier/send/types/elemental_divider_node.rb', line 9 def if_ @if_ end |
#loop ⇒ Object (readonly)
Returns the value of attribute loop.
9 10 11 |
# File 'lib/trycourier/send/types/elemental_divider_node.rb', line 9 def loop @loop end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
9 10 11 |
# File 'lib/trycourier/send/types/elemental_divider_node.rb', line 9 def ref @ref end |
Class Method Details
.from_json(json_object:) ⇒ Send::ElementalDividerNode
Deserialize a JSON object to an instance of ElementalDividerNode
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/trycourier/send/types/elemental_divider_node.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) color = struct.color channels = struct.channels ref = struct.ref if_ = struct.if loop = struct.loop new(color: color, channels: channels, ref: ref, if_: if_, loop: loop, additional_properties: struct) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
59 60 61 62 63 64 65 |
# File 'lib/trycourier/send/types/elemental_divider_node.rb', line 59 def self.validate_raw(obj:) obj.color&.is_a?(String) != false || raise("Passed value for field obj.color is not the expected type, validation failed.") obj.channels&.is_a?(Array) != false || raise("Passed value for field obj.channels is not the expected type, validation failed.") obj.ref&.is_a?(String) != false || raise("Passed value for field obj.ref is not the expected type, validation failed.") obj.if_&.is_a?(String) != false || raise("Passed value for field obj.if_ is not the expected type, validation failed.") obj.loop&.is_a?(String) != false || raise("Passed value for field obj.loop is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of ElementalDividerNode to a JSON object
51 52 53 |
# File 'lib/trycourier/send/types/elemental_divider_node.rb', line 51 def to_json(*_args) { "color": @color, "channels": @channels, "ref": @ref, "if": @if_, "loop": @loop }.to_json end |