Class: Courier::Send::BrandTemplateOverride
- Inherits:
-
Object
- Object
- Courier::Send::BrandTemplateOverride
- Defined in:
- lib/trycourier/send/types/brand_template_override.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.
-
#footer_background_color ⇒ Object
readonly
Returns the value of attribute footer_background_color.
-
#footer_full_width ⇒ Object
readonly
Returns the value of attribute footer_full_width.
-
#head ⇒ Object
readonly
Returns the value of attribute head.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#mjml ⇒ Object
readonly
Returns the value of attribute mjml.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Send::BrandTemplateOverride
Deserialize a JSON object to an instance of BrandTemplateOverride.
-
.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(mjml:, enabled:, footer_background_color: nil, footer_full_width: nil, background_color: nil, blocks_background_color: nil, footer: nil, head: nil, header: nil, width: nil, additional_properties: nil) ⇒ Send::BrandTemplateOverride constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of BrandTemplateOverride to a JSON object.
Constructor Details
#initialize(mjml:, enabled:, footer_background_color: nil, footer_full_width: nil, background_color: nil, blocks_background_color: nil, footer: nil, head: nil, header: nil, width: nil, additional_properties: nil) ⇒ Send::BrandTemplateOverride
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 24 def initialize(mjml:, enabled:, footer_background_color: nil, footer_full_width: nil, background_color: nil, blocks_background_color: nil, footer: nil, head: nil, header: nil, width: nil, additional_properties: nil) # @type [Send::BrandTemplate] @mjml = mjml # @type [String] @footer_background_color = # @type [Boolean] @footer_full_width = # @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.
9 10 11 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 9 def additional_properties @additional_properties end |
#background_color ⇒ Object (readonly)
Returns the value of attribute background_color.
9 10 11 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 9 def background_color @background_color end |
#blocks_background_color ⇒ Object (readonly)
Returns the value of attribute blocks_background_color.
9 10 11 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 9 def blocks_background_color @blocks_background_color end |
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
9 10 11 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 9 def enabled @enabled end |
#footer ⇒ Object (readonly)
Returns the value of attribute footer.
9 10 11 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 9 def @footer end |
#footer_background_color ⇒ Object (readonly)
Returns the value of attribute footer_background_color.
9 10 11 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 9 def @footer_background_color end |
#footer_full_width ⇒ Object (readonly)
Returns the value of attribute footer_full_width.
9 10 11 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 9 def @footer_full_width end |
#head ⇒ Object (readonly)
Returns the value of attribute head.
9 10 11 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 9 def head @head end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
9 10 11 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 9 def header @header end |
#mjml ⇒ Object (readonly)
Returns the value of attribute mjml.
9 10 11 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 9 def mjml @mjml end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
9 10 11 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 9 def width @width end |
Class Method Details
.from_json(json_object:) ⇒ Send::BrandTemplateOverride
Deserialize a JSON object to an instance of BrandTemplateOverride
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 54 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["mjml"].nil? mjml = nil else mjml = parsed_json["mjml"].to_json mjml = Send::BrandTemplate.from_json(json_object: mjml) end = struct. = struct. background_color = struct.backgroundColor blocks_background_color = struct.blocksBackgroundColor enabled = struct.enabled = struct. head = struct.head header = struct.header width = struct.width new(mjml: mjml, footer_background_color: , footer_full_width: , 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.
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 98 def self.validate_raw(obj:) Send::BrandTemplate.validate_raw(obj: obj.mjml) obj.&.is_a?(String) != false || raise("Passed value for field obj.footer_background_color is not the expected type, validation failed.") obj.&.is_a?(Boolean) != false || raise("Passed value for field obj.footer_full_width is not the expected type, validation failed.") 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 BrandTemplateOverride to a JSON object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/trycourier/send/types/brand_template_override.rb', line 79 def to_json(*_args) { "mjml": @mjml, "footerBackgroundColor": @footer_background_color, "footerFullWidth": @footer_full_width, "backgroundColor": @background_color, "blocksBackgroundColor": @blocks_background_color, "enabled": @enabled, "footer": @footer, "head": @head, "header": @header, "width": @width }.to_json end |