Class: Courier::Send::BrandTemplate
- Inherits:
-
Object
- Object
- Courier::Send::BrandTemplate
- Defined in:
- lib/trycourier/send/types/brand_template.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#background_color ⇒ Object
readonly
Returns the value of attribute background_color.
-
#blocks_background_color ⇒ Object
readonly
Returns the value of attribute blocks_background_color.
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#footer ⇒ Object
readonly
Returns the value of attribute footer.
-
#head ⇒ Object
readonly
Returns the value of attribute head.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Send::BrandTemplate
Deserialize a JSON object to an instance of BrandTemplate.
-
.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(enabled:, background_color: nil, blocks_background_color: nil, footer: nil, head: nil, header: nil, width: nil, additional_properties: nil) ⇒ Send::BrandTemplate constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of BrandTemplate to a JSON object.
Constructor Details
#initialize(enabled:, background_color: nil, blocks_background_color: nil, footer: nil, head: nil, header: nil, width: nil, additional_properties: nil) ⇒ Send::BrandTemplate
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/trycourier/send/types/brand_template.rb', line 20 def initialize(enabled:, background_color: nil, blocks_background_color: nil, footer: nil, head: nil, header: nil, width: nil, additional_properties: nil) # @type [String] @background_color = background_color # @type [String] @blocks_background_color = blocks_background_color # @type [Boolean] @enabled = enabled # @type [String] @footer = # @type [String] @head = head # @type [String] @header = header # @type [String] @width = width # @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.
8 9 10 |
# File 'lib/trycourier/send/types/brand_template.rb', line 8 def additional_properties @additional_properties end |
#background_color ⇒ Object (readonly)
Returns the value of attribute background_color.
8 9 10 |
# File 'lib/trycourier/send/types/brand_template.rb', line 8 def background_color @background_color end |
#blocks_background_color ⇒ Object (readonly)
Returns the value of attribute blocks_background_color.
8 9 10 |
# File 'lib/trycourier/send/types/brand_template.rb', line 8 def blocks_background_color @blocks_background_color end |
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
8 9 10 |
# File 'lib/trycourier/send/types/brand_template.rb', line 8 def enabled @enabled end |
#footer ⇒ Object (readonly)
Returns the value of attribute footer.
8 9 10 |
# File 'lib/trycourier/send/types/brand_template.rb', line 8 def @footer end |
#head ⇒ Object (readonly)
Returns the value of attribute head.
8 9 10 |
# File 'lib/trycourier/send/types/brand_template.rb', line 8 def head @head end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
8 9 10 |
# File 'lib/trycourier/send/types/brand_template.rb', line 8 def header @header end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
8 9 10 |
# File 'lib/trycourier/send/types/brand_template.rb', line 8 def width @width end |
Class Method Details
.from_json(json_object:) ⇒ Send::BrandTemplate
Deserialize a JSON object to an instance of BrandTemplate
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/trycourier/send/types/brand_template.rb', line 44 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) background_color = struct.backgroundColor blocks_background_color = struct.blocksBackgroundColor enabled = struct.enabled = struct. head = struct.head header = struct.header width = struct.width new(background_color: background_color, blocks_background_color: blocks_background_color, enabled: enabled, footer: , head: head, header: header, width: width, 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.
77 78 79 80 81 82 83 84 85 |
# File 'lib/trycourier/send/types/brand_template.rb', line 77 def self.validate_raw(obj:) obj.background_color&.is_a?(String) != false || raise("Passed value for field obj.background_color is not the expected type, validation failed.") obj.blocks_background_color&.is_a?(String) != false || raise("Passed value for field obj.blocks_background_color is not the expected type, validation failed.") obj.enabled.is_a?(Boolean) != false || raise("Passed value for field obj.enabled is not the expected type, validation failed.") obj.&.is_a?(String) != false || raise("Passed value for field obj.footer is not the expected type, validation failed.") obj.head&.is_a?(String) != false || raise("Passed value for field obj.head is not the expected type, validation failed.") obj.header&.is_a?(String) != false || raise("Passed value for field obj.header is not the expected type, validation failed.") obj.width&.is_a?(String) != false || raise("Passed value for field obj.width is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of BrandTemplate to a JSON object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/trycourier/send/types/brand_template.rb', line 61 def to_json(*_args) { "backgroundColor": @background_color, "blocksBackgroundColor": @blocks_background_color, "enabled": @enabled, "footer": @footer, "head": @head, "header": @header, "width": @width }.to_json end |