Class: KlaviyoAPI::SectionStyles
- Inherits:
-
Object
- Object
- KlaviyoAPI::SectionStyles
- Defined in:
- lib/klaviyo-api-sdk/models/section_styles.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#background_asset_id ⇒ Object
Returns the value of attribute background_asset_id.
-
#background_color ⇒ Object
Returns the value of attribute background_color.
-
#background_format ⇒ Object
Background format.
-
#background_image_full_width ⇒ Object
Returns the value of attribute background_image_full_width.
-
#background_position ⇒ Object
Background position.
-
#background_repeat ⇒ Object
Returns the value of attribute background_repeat.
-
#background_url ⇒ Object
Returns the value of attribute background_url.
-
#border_color ⇒ Object
Returns the value of attribute border_color.
-
#border_style ⇒ Object
Border style.
-
#border_width ⇒ Object
Returns the value of attribute border_width.
-
#column_align ⇒ Object
Vertical alignment.
-
#column_direction ⇒ Object
Stacking direction.
-
#content_color ⇒ Object
Returns the value of attribute content_color.
-
#content_color_type ⇒ Object
Content color type.
-
#inner_padding_bottom ⇒ Object
Returns the value of attribute inner_padding_bottom.
-
#inner_padding_left ⇒ Object
Returns the value of attribute inner_padding_left.
-
#inner_padding_right ⇒ Object
Returns the value of attribute inner_padding_right.
-
#inner_padding_top ⇒ Object
Returns the value of attribute inner_padding_top.
-
#stack_on_mobile ⇒ Object
Returns the value of attribute stack_on_mobile.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ SectionStyles
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ SectionStyles
Initializes the object
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 165 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `KlaviyoAPI::SectionStyles` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `KlaviyoAPI::SectionStyles`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'background_asset_id') self.background_asset_id = attributes[:'background_asset_id'] end if attributes.key?(:'background_color') self.background_color = attributes[:'background_color'] end if attributes.key?(:'background_format') self.background_format = attributes[:'background_format'] end if attributes.key?(:'background_image_full_width') self.background_image_full_width = attributes[:'background_image_full_width'] end if attributes.key?(:'background_position') self.background_position = attributes[:'background_position'] end if attributes.key?(:'background_repeat') self.background_repeat = attributes[:'background_repeat'] end if attributes.key?(:'background_url') self.background_url = attributes[:'background_url'] end if attributes.key?(:'border_color') self.border_color = attributes[:'border_color'] end if attributes.key?(:'border_style') self.border_style = attributes[:'border_style'] end if attributes.key?(:'border_width') self.border_width = attributes[:'border_width'] end if attributes.key?(:'column_align') self.column_align = attributes[:'column_align'] end if attributes.key?(:'column_direction') self.column_direction = attributes[:'column_direction'] end if attributes.key?(:'content_color') self.content_color = attributes[:'content_color'] end if attributes.key?(:'content_color_type') self.content_color_type = attributes[:'content_color_type'] end if attributes.key?(:'inner_padding_bottom') self.inner_padding_bottom = attributes[:'inner_padding_bottom'] end if attributes.key?(:'inner_padding_left') self.inner_padding_left = attributes[:'inner_padding_left'] end if attributes.key?(:'inner_padding_right') self.inner_padding_right = attributes[:'inner_padding_right'] end if attributes.key?(:'inner_padding_top') self.inner_padding_top = attributes[:'inner_padding_top'] end if attributes.key?(:'stack_on_mobile') self.stack_on_mobile = attributes[:'stack_on_mobile'] end end |
Instance Attribute Details
#background_asset_id ⇒ Object
Returns the value of attribute background_asset_id.
17 18 19 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 17 def background_asset_id @background_asset_id end |
#background_color ⇒ Object
Returns the value of attribute background_color.
19 20 21 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 19 def background_color @background_color end |
#background_format ⇒ Object
Background format.
22 23 24 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 22 def background_format @background_format end |
#background_image_full_width ⇒ Object
Returns the value of attribute background_image_full_width.
24 25 26 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 24 def background_image_full_width @background_image_full_width end |
#background_position ⇒ Object
Background position.
27 28 29 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 27 def background_position @background_position end |
#background_repeat ⇒ Object
Returns the value of attribute background_repeat.
29 30 31 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 29 def background_repeat @background_repeat end |
#background_url ⇒ Object
Returns the value of attribute background_url.
31 32 33 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 31 def background_url @background_url end |
#border_color ⇒ Object
Returns the value of attribute border_color.
33 34 35 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 33 def border_color @border_color end |
#border_style ⇒ Object
Border style.
36 37 38 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 36 def border_style @border_style end |
#border_width ⇒ Object
Returns the value of attribute border_width.
38 39 40 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 38 def border_width @border_width end |
#column_align ⇒ Object
Vertical alignment.
41 42 43 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 41 def column_align @column_align end |
#column_direction ⇒ Object
Stacking direction.
44 45 46 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 44 def column_direction @column_direction end |
#content_color ⇒ Object
Returns the value of attribute content_color.
46 47 48 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 46 def content_color @content_color end |
#content_color_type ⇒ Object
Content color type.
49 50 51 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 49 def content_color_type @content_color_type end |
#inner_padding_bottom ⇒ Object
Returns the value of attribute inner_padding_bottom.
51 52 53 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 51 def inner_padding_bottom @inner_padding_bottom end |
#inner_padding_left ⇒ Object
Returns the value of attribute inner_padding_left.
53 54 55 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 53 def inner_padding_left @inner_padding_left end |
#inner_padding_right ⇒ Object
Returns the value of attribute inner_padding_right.
55 56 57 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 55 def inner_padding_right @inner_padding_right end |
#inner_padding_top ⇒ Object
Returns the value of attribute inner_padding_top.
57 58 59 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 57 def inner_padding_top @inner_padding_top end |
#stack_on_mobile ⇒ Object
Returns the value of attribute stack_on_mobile.
59 60 61 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 59 def stack_on_mobile @stack_on_mobile end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
109 110 111 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 109 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 84 def self.attribute_map { :'background_asset_id' => :'background_asset_id', :'background_color' => :'background_color', :'background_format' => :'background_format', :'background_image_full_width' => :'background_image_full_width', :'background_position' => :'background_position', :'background_repeat' => :'background_repeat', :'background_url' => :'background_url', :'border_color' => :'border_color', :'border_style' => :'border_style', :'border_width' => :'border_width', :'column_align' => :'column_align', :'column_direction' => :'column_direction', :'content_color' => :'content_color', :'content_color_type' => :'content_color_type', :'inner_padding_bottom' => :'inner_padding_bottom', :'inner_padding_left' => :'inner_padding_left', :'inner_padding_right' => :'inner_padding_right', :'inner_padding_top' => :'inner_padding_top', :'stack_on_mobile' => :'stack_on_mobile' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
381 382 383 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 381 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 139 def self.openapi_nullable Set.new([ :'background_asset_id', :'background_color', :'background_format', :'background_image_full_width', :'background_position', :'background_repeat', :'background_url', :'border_color', :'border_style', :'border_width', :'column_align', :'column_direction', :'content_color', :'content_color_type', :'inner_padding_bottom', :'inner_padding_left', :'inner_padding_right', :'inner_padding_top', :'stack_on_mobile' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 114 def self.openapi_types { :'background_asset_id' => :'String', :'background_color' => :'String', :'background_format' => :'String', :'background_image_full_width' => :'Boolean', :'background_position' => :'String', :'background_repeat' => :'Boolean', :'background_url' => :'String', :'border_color' => :'String', :'border_style' => :'String', :'border_width' => :'Integer', :'column_align' => :'String', :'column_direction' => :'String', :'content_color' => :'String', :'content_color_type' => :'String', :'inner_padding_bottom' => :'Integer', :'inner_padding_left' => :'Integer', :'inner_padding_right' => :'Integer', :'inner_padding_top' => :'Integer', :'stack_on_mobile' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 342 def ==(o) return true if self.equal?(o) self.class == o.class && background_asset_id == o.background_asset_id && background_color == o.background_color && background_format == o.background_format && background_image_full_width == o.background_image_full_width && background_position == o.background_position && background_repeat == o.background_repeat && background_url == o.background_url && border_color == o.border_color && border_style == o.border_style && border_width == o.border_width && column_align == o.column_align && column_direction == o.column_direction && content_color == o.content_color && content_color_type == o.content_color_type && inner_padding_bottom == o.inner_padding_bottom && inner_padding_left == o.inner_padding_left && inner_padding_right == o.inner_padding_right && inner_padding_top == o.inner_padding_top && stack_on_mobile == o.stack_on_mobile end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 412 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = KlaviyoAPI.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
483 484 485 486 487 488 489 490 491 492 493 494 495 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 483 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 388 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(o) ⇒ Boolean
368 369 370 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 368 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
374 375 376 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 374 def hash [background_asset_id, background_color, background_format, background_image_full_width, background_position, background_repeat, background_url, border_color, border_style, border_width, column_align, column_direction, content_color, content_color_type, inner_padding_bottom, inner_padding_left, inner_padding_right, inner_padding_top, stack_on_mobile].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
257 258 259 260 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 257 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
459 460 461 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 459 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
465 466 467 468 469 470 471 472 473 474 475 476 477 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 465 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
453 454 455 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 453 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/klaviyo-api-sdk/models/section_styles.rb', line 264 def valid? background_format_validator = EnumAttributeValidator.new('String', ["auto", "contain", "cover", "initial", "repeat"]) return false unless background_format_validator.valid?(@background_format) background_position_validator = EnumAttributeValidator.new('String', ["center-bottom", "center-center", "center-top", "left-bottom", "left-center", "left-top", "right-bottom", "right-center", "right-top"]) return false unless background_position_validator.valid?(@background_position) border_style_validator = EnumAttributeValidator.new('String', ["dashed", "dotted", "groove", "inset", "none", "outset", "ridge", "solid"]) return false unless border_style_validator.valid?(@border_style) column_align_validator = EnumAttributeValidator.new('String', ["baseline", "bottom", "middle", "top"]) return false unless column_align_validator.valid?(@column_align) column_direction_validator = EnumAttributeValidator.new('String', ["ltr", "no-stack", "rtl"]) return false unless column_direction_validator.valid?(@column_direction) content_color_type_validator = EnumAttributeValidator.new('String', ["none", "section", "template"]) return false unless content_color_type_validator.valid?(@content_color_type) true end |