Class: KlaviyoAPI::SocialBlockStyles
- Inherits:
-
Object
- Object
- KlaviyoAPI::SocialBlockStyles
- Defined in:
- lib/klaviyo-api-sdk/models/social_block_styles.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#block_background_color ⇒ Object
Returns the value of attribute block_background_color.
-
#block_padding_bottom ⇒ Object
Returns the value of attribute block_padding_bottom.
-
#block_padding_left ⇒ Object
Returns the value of attribute block_padding_left.
-
#block_padding_right ⇒ Object
Returns the value of attribute block_padding_right.
-
#block_padding_top ⇒ Object
Returns the value of attribute block_padding_top.
-
#icon_align ⇒ Object
Text Alignment.
-
#icon_color ⇒ Object
Social block icon color.
-
#icon_size ⇒ Object
Social block icon size.
-
#icon_spacing ⇒ Object
Returns the value of attribute icon_spacing.
-
#label_color ⇒ Object
Returns the value of attribute label_color.
-
#label_font_family ⇒ Object
Returns the value of attribute label_font_family.
-
#label_font_size ⇒ Object
Returns the value of attribute label_font_size.
-
#label_font_style ⇒ Object
Font style.
-
#label_font_weight ⇒ Object
Returns the value of attribute label_font_weight.
-
#label_text_decoration ⇒ Object
Returns the value of attribute label_text_decoration.
-
#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 = {}) ⇒ SocialBlockStyles
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 = {}) ⇒ SocialBlockStyles
Initializes the object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 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 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 148 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `KlaviyoAPI::SocialBlockStyles` 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::SocialBlockStyles`. 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?(:'block_background_color') self.block_background_color = attributes[:'block_background_color'] end if attributes.key?(:'block_padding_bottom') self.block_padding_bottom = attributes[:'block_padding_bottom'] end if attributes.key?(:'block_padding_left') self.block_padding_left = attributes[:'block_padding_left'] end if attributes.key?(:'block_padding_right') self.block_padding_right = attributes[:'block_padding_right'] end if attributes.key?(:'block_padding_top') self.block_padding_top = attributes[:'block_padding_top'] end if attributes.key?(:'icon_align') self.icon_align = attributes[:'icon_align'] end if attributes.key?(:'icon_color') self.icon_color = attributes[:'icon_color'] end if attributes.key?(:'icon_size') self.icon_size = attributes[:'icon_size'] end if attributes.key?(:'icon_spacing') self.icon_spacing = attributes[:'icon_spacing'] end if attributes.key?(:'label_color') self.label_color = attributes[:'label_color'] end if attributes.key?(:'label_font_family') self.label_font_family = attributes[:'label_font_family'] end if attributes.key?(:'label_font_size') self.label_font_size = attributes[:'label_font_size'] end if attributes.key?(:'label_font_style') self.label_font_style = attributes[:'label_font_style'] end if attributes.key?(:'label_text_decoration') self.label_text_decoration = attributes[:'label_text_decoration'] end if attributes.key?(:'label_font_weight') self.label_font_weight = attributes[:'label_font_weight'] end if attributes.key?(:'stack_on_mobile') self.stack_on_mobile = attributes[:'stack_on_mobile'] end end |
Instance Attribute Details
#block_background_color ⇒ Object
Returns the value of attribute block_background_color.
17 18 19 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 17 def block_background_color @block_background_color end |
#block_padding_bottom ⇒ Object
Returns the value of attribute block_padding_bottom.
19 20 21 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 19 def block_padding_bottom @block_padding_bottom end |
#block_padding_left ⇒ Object
Returns the value of attribute block_padding_left.
21 22 23 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 21 def block_padding_left @block_padding_left end |
#block_padding_right ⇒ Object
Returns the value of attribute block_padding_right.
23 24 25 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 23 def block_padding_right @block_padding_right end |
#block_padding_top ⇒ Object
Returns the value of attribute block_padding_top.
25 26 27 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 25 def block_padding_top @block_padding_top end |
#icon_align ⇒ Object
Text Alignment.
28 29 30 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 28 def icon_align @icon_align end |
#icon_color ⇒ Object
Social block icon color.
31 32 33 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 31 def icon_color @icon_color end |
#icon_size ⇒ Object
Social block icon size.
34 35 36 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 34 def icon_size @icon_size end |
#icon_spacing ⇒ Object
Returns the value of attribute icon_spacing.
36 37 38 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 36 def icon_spacing @icon_spacing end |
#label_color ⇒ Object
Returns the value of attribute label_color.
38 39 40 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 38 def label_color @label_color end |
#label_font_family ⇒ Object
Returns the value of attribute label_font_family.
40 41 42 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 40 def label_font_family @label_font_family end |
#label_font_size ⇒ Object
Returns the value of attribute label_font_size.
42 43 44 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 42 def label_font_size @label_font_size end |
#label_font_style ⇒ Object
Font style.
45 46 47 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 45 def label_font_style @label_font_style end |
#label_font_weight ⇒ Object
Returns the value of attribute label_font_weight.
49 50 51 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 49 def label_font_weight @label_font_weight end |
#label_text_decoration ⇒ Object
Returns the value of attribute label_text_decoration.
47 48 49 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 47 def label_text_decoration @label_text_decoration end |
#stack_on_mobile ⇒ Object
Returns the value of attribute stack_on_mobile.
51 52 53 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 51 def stack_on_mobile @stack_on_mobile end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
98 99 100 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 98 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 76 def self.attribute_map { :'block_background_color' => :'block_background_color', :'block_padding_bottom' => :'block_padding_bottom', :'block_padding_left' => :'block_padding_left', :'block_padding_right' => :'block_padding_right', :'block_padding_top' => :'block_padding_top', :'icon_align' => :'icon_align', :'icon_color' => :'icon_color', :'icon_size' => :'icon_size', :'icon_spacing' => :'icon_spacing', :'label_color' => :'label_color', :'label_font_family' => :'label_font_family', :'label_font_size' => :'label_font_size', :'label_font_style' => :'label_font_style', :'label_text_decoration' => :'label_text_decoration', :'label_font_weight' => :'label_font_weight', :'stack_on_mobile' => :'stack_on_mobile' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
325 326 327 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 325 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 125 def self.openapi_nullable Set.new([ :'block_background_color', :'block_padding_bottom', :'block_padding_left', :'block_padding_right', :'block_padding_top', :'icon_align', :'icon_color', :'icon_size', :'icon_spacing', :'label_color', :'label_font_family', :'label_font_size', :'label_font_style', :'label_text_decoration', :'label_font_weight', :'stack_on_mobile' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 103 def self.openapi_types { :'block_background_color' => :'String', :'block_padding_bottom' => :'Integer', :'block_padding_left' => :'Integer', :'block_padding_right' => :'Integer', :'block_padding_top' => :'Integer', :'icon_align' => :'String', :'icon_color' => :'String', :'icon_size' => :'String', :'icon_spacing' => :'Integer', :'label_color' => :'String', :'label_font_family' => :'String', :'label_font_size' => :'Integer', :'label_font_style' => :'String', :'label_text_decoration' => :'String', :'label_font_weight' => :'String', :'stack_on_mobile' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 289 def ==(o) return true if self.equal?(o) self.class == o.class && block_background_color == o.block_background_color && block_padding_bottom == o.block_padding_bottom && block_padding_left == o.block_padding_left && block_padding_right == o.block_padding_right && block_padding_top == o.block_padding_top && icon_align == o.icon_align && icon_color == o.icon_color && icon_size == o.icon_size && icon_spacing == o.icon_spacing && label_color == o.label_color && label_font_family == o.label_font_family && label_font_size == o.label_font_size && label_font_style == o.label_font_style && label_text_decoration == o.label_text_decoration && label_font_weight == o.label_font_weight && stack_on_mobile == o.stack_on_mobile end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 356 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
427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 427 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
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 332 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
312 313 314 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 312 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
318 319 320 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 318 def hash [block_background_color, block_padding_bottom, block_padding_left, block_padding_right, block_padding_top, icon_align, icon_color, icon_size, icon_spacing, label_color, label_font_family, label_font_size, label_font_style, label_text_decoration, label_font_weight, stack_on_mobile].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
228 229 230 231 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 228 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
403 404 405 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 403 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 409 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
397 398 399 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 397 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/klaviyo-api-sdk/models/social_block_styles.rb', line 235 def valid? icon_align_validator = EnumAttributeValidator.new('String', ["center", "left", "right"]) return false unless icon_align_validator.valid?(@icon_align) icon_color_validator = EnumAttributeValidator.new('String', ["black", "default", "grey", "white"]) return false unless icon_color_validator.valid?(@icon_color) icon_size_validator = EnumAttributeValidator.new('String', ["large", "medium", "small"]) return false unless icon_size_validator.valid?(@icon_size) label_font_style_validator = EnumAttributeValidator.new('String', ["italic", "normal"]) return false unless label_font_style_validator.valid?(@label_font_style) true end |