Class: Courier::Send::BrandSettingsInApp
- Inherits:
-
Object
- Object
- Courier::Send::BrandSettingsInApp
- Defined in:
- lib/trycourier/send/types/brand_settings_in_app.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#border_radius ⇒ Object
readonly
Returns the value of attribute border_radius.
-
#colors ⇒ Object
readonly
Returns the value of attribute colors.
-
#disable_message_icon ⇒ Object
readonly
Returns the value of attribute disable_message_icon.
-
#font_family ⇒ Object
readonly
Returns the value of attribute font_family.
-
#icons ⇒ Object
readonly
Returns the value of attribute icons.
-
#placement ⇒ Object
readonly
Returns the value of attribute placement.
-
#preferences ⇒ Object
readonly
Returns the value of attribute preferences.
-
#widget_background ⇒ Object
readonly
Returns the value of attribute widget_background.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Send::BrandSettingsInApp
Deserialize a JSON object to an instance of BrandSettingsInApp.
-
.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(widget_background:, colors:, icons:, preferences:, border_radius: nil, disable_message_icon: nil, font_family: nil, placement: nil, additional_properties: nil) ⇒ Send::BrandSettingsInApp constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of BrandSettingsInApp to a JSON object.
Constructor Details
#initialize(widget_background:, colors:, icons:, preferences:, border_radius: nil, disable_message_icon: nil, font_family: nil, placement: nil, additional_properties: nil) ⇒ Send::BrandSettingsInApp
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 26 def initialize(widget_background:, colors:, icons:, preferences:, border_radius: nil, disable_message_icon: nil, font_family: nil, placement: nil, additional_properties: nil) # @type [String] @border_radius = border_radius # @type [Boolean] @disable_message_icon = # @type [String] @font_family = font_family # @type [Send::InAppPlacement] @placement = placement # @type [Send::WidgetBackground] @widget_background = # @type [Brands::BrandColors] @colors = colors # @type [Send::Icons] @icons = icons # @type [Send::Preferences] @preferences = preferences # @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.
13 14 15 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 13 def additional_properties @additional_properties end |
#border_radius ⇒ Object (readonly)
Returns the value of attribute border_radius.
13 14 15 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 13 def border_radius @border_radius end |
#colors ⇒ Object (readonly)
Returns the value of attribute colors.
13 14 15 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 13 def colors @colors end |
#disable_message_icon ⇒ Object (readonly)
Returns the value of attribute disable_message_icon.
13 14 15 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 13 def @disable_message_icon end |
#font_family ⇒ Object (readonly)
Returns the value of attribute font_family.
13 14 15 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 13 def font_family @font_family end |
#icons ⇒ Object (readonly)
Returns the value of attribute icons.
13 14 15 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 13 def icons @icons end |
#placement ⇒ Object (readonly)
Returns the value of attribute placement.
13 14 15 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 13 def placement @placement end |
#preferences ⇒ Object (readonly)
Returns the value of attribute preferences.
13 14 15 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 13 def preferences @preferences end |
#widget_background ⇒ Object (readonly)
Returns the value of attribute widget_background.
13 14 15 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 13 def @widget_background end |
Class Method Details
.from_json(json_object:) ⇒ Send::BrandSettingsInApp
Deserialize a JSON object to an instance of BrandSettingsInApp
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 52 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) border_radius = struct.borderRadius = struct.disableMessageIcon font_family = struct.fontFamily placement = struct.placement if parsed_json["widgetBackground"].nil? = nil else = parsed_json["widgetBackground"].to_json = Send::WidgetBackground.from_json(json_object: ) end if parsed_json["colors"].nil? colors = nil else colors = parsed_json["colors"].to_json colors = Brands::BrandColors.from_json(json_object: colors) end if parsed_json["icons"].nil? icons = nil else icons = parsed_json["icons"].to_json icons = Send::Icons.from_json(json_object: icons) end if parsed_json["preferences"].nil? preferences = nil else preferences = parsed_json["preferences"].to_json preferences = Send::Preferences.from_json(json_object: preferences) end new(border_radius: border_radius, disable_message_icon: , font_family: font_family, placement: placement, widget_background: , colors: colors, icons: icons, preferences: preferences, 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.
107 108 109 110 111 112 113 114 115 116 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 107 def self.validate_raw(obj:) obj.border_radius&.is_a?(String) != false || raise("Passed value for field obj.border_radius is not the expected type, validation failed.") obj.&.is_a?(Boolean) != false || raise("Passed value for field obj.disable_message_icon is not the expected type, validation failed.") obj.font_family&.is_a?(String) != false || raise("Passed value for field obj.font_family is not the expected type, validation failed.") obj.placement&.is_a?(Send::InAppPlacement) != false || raise("Passed value for field obj.placement is not the expected type, validation failed.") Send::WidgetBackground.validate_raw(obj: obj.) Brands::BrandColors.validate_raw(obj: obj.colors) Send::Icons.validate_raw(obj: obj.icons) Send::Preferences.validate_raw(obj: obj.preferences) end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of BrandSettingsInApp to a JSON object
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/trycourier/send/types/brand_settings_in_app.rb', line 90 def to_json(*_args) { "borderRadius": @border_radius, "disableMessageIcon": @disable_message_icon, "fontFamily": @font_family, "placement": @placement, "widgetBackground": @widget_background, "colors": @colors, "icons": @icons, "preferences": @preferences }.to_json end |