Class: KlaviyoAPI::TableImageSubBlock
- Inherits:
-
Object
- Object
- KlaviyoAPI::TableImageSubBlock
- Defined in:
- lib/klaviyo-api-sdk/models/table_image_sub_block.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#alt_text ⇒ Object
Returns the value of attribute alt_text.
-
#asset_id ⇒ Object
Returns the value of attribute asset_id.
-
#cell_text_align ⇒ Object
Text Alignment.
-
#cropped_asset_id ⇒ Object
Returns the value of attribute cropped_asset_id.
-
#cropped_src ⇒ Object
Returns the value of attribute cropped_src.
-
#cropping_aspect_ratio ⇒ Object
Returns the value of attribute cropping_aspect_ratio.
-
#cropping_height ⇒ Object
Returns the value of attribute cropping_height.
-
#cropping_width ⇒ Object
Returns the value of attribute cropping_width.
-
#cropping_x ⇒ Object
Returns the value of attribute cropping_x.
-
#cropping_y ⇒ Object
Returns the value of attribute cropping_y.
-
#dynamic ⇒ Object
Returns the value of attribute dynamic.
-
#height ⇒ Object
Returns the value of attribute height.
-
#href ⇒ Object
Returns the value of attribute href.
-
#id ⇒ Object
Returns the value of attribute id.
-
#image_align ⇒ Object
Image Alignment.
-
#image_width ⇒ Object
Returns the value of attribute image_width.
-
#show_on ⇒ Object
Show on.
-
#src ⇒ Object
Returns the value of attribute src.
-
#table_column_width ⇒ Object
Returns the value of attribute table_column_width.
-
#type ⇒ Object
Returns the value of attribute type.
-
#width ⇒ Object
Returns the value of attribute width.
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 = {}) ⇒ TableImageSubBlock
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 = {}) ⇒ TableImageSubBlock
Initializes the object
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 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 171 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `KlaviyoAPI::TableImageSubBlock` 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::TableImageSubBlock`. 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?(:'dynamic') self.dynamic = attributes[:'dynamic'] end if attributes.key?(:'alt_text') self.alt_text = attributes[:'alt_text'] end if attributes.key?(:'asset_id') self.asset_id = attributes[:'asset_id'] end if attributes.key?(:'href') self.href = attributes[:'href'] end if attributes.key?(:'src') self.src = attributes[:'src'] end if attributes.key?(:'width') self.width = attributes[:'width'] end if attributes.key?(:'height') self.height = attributes[:'height'] end if attributes.key?(:'image_width') self.image_width = attributes[:'image_width'] end if attributes.key?(:'image_align') self.image_align = attributes[:'image_align'] end if attributes.key?(:'show_on') self.show_on = attributes[:'show_on'] end if attributes.key?(:'table_column_width') self.table_column_width = attributes[:'table_column_width'] end if attributes.key?(:'cell_text_align') self.cell_text_align = attributes[:'cell_text_align'] end if attributes.key?(:'cropped_asset_id') self.cropped_asset_id = attributes[:'cropped_asset_id'] end if attributes.key?(:'cropped_src') self.cropped_src = attributes[:'cropped_src'] end if attributes.key?(:'cropping_aspect_ratio') self.cropping_aspect_ratio = attributes[:'cropping_aspect_ratio'] end if attributes.key?(:'cropping_height') self.cropping_height = attributes[:'cropping_height'] end if attributes.key?(:'cropping_width') self.cropping_width = attributes[:'cropping_width'] end if attributes.key?(:'cropping_x') self.cropping_x = attributes[:'cropping_x'] end if attributes.key?(:'cropping_y') self.cropping_y = attributes[:'cropping_y'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'type') self.type = attributes[:'type'] end end |
Instance Attribute Details
#alt_text ⇒ Object
Returns the value of attribute alt_text.
19 20 21 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 19 def alt_text @alt_text end |
#asset_id ⇒ Object
Returns the value of attribute asset_id.
21 22 23 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 21 def asset_id @asset_id end |
#cell_text_align ⇒ Object
Text Alignment.
42 43 44 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 42 def cell_text_align @cell_text_align end |
#cropped_asset_id ⇒ Object
Returns the value of attribute cropped_asset_id.
44 45 46 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 44 def cropped_asset_id @cropped_asset_id end |
#cropped_src ⇒ Object
Returns the value of attribute cropped_src.
46 47 48 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 46 def cropped_src @cropped_src end |
#cropping_aspect_ratio ⇒ Object
Returns the value of attribute cropping_aspect_ratio.
48 49 50 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 48 def cropping_aspect_ratio @cropping_aspect_ratio end |
#cropping_height ⇒ Object
Returns the value of attribute cropping_height.
50 51 52 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 50 def cropping_height @cropping_height end |
#cropping_width ⇒ Object
Returns the value of attribute cropping_width.
52 53 54 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 52 def cropping_width @cropping_width end |
#cropping_x ⇒ Object
Returns the value of attribute cropping_x.
54 55 56 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 54 def cropping_x @cropping_x end |
#cropping_y ⇒ Object
Returns the value of attribute cropping_y.
56 57 58 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 56 def cropping_y @cropping_y end |
#dynamic ⇒ Object
Returns the value of attribute dynamic.
17 18 19 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 17 def dynamic @dynamic end |
#height ⇒ Object
Returns the value of attribute height.
29 30 31 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 29 def height @height end |
#href ⇒ Object
Returns the value of attribute href.
23 24 25 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 23 def href @href end |
#id ⇒ Object
Returns the value of attribute id.
58 59 60 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 58 def id @id end |
#image_align ⇒ Object
Image Alignment.
34 35 36 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 34 def image_align @image_align end |
#image_width ⇒ Object
Returns the value of attribute image_width.
31 32 33 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 31 def image_width @image_width end |
#show_on ⇒ Object
Show on.
37 38 39 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 37 def show_on @show_on end |
#src ⇒ Object
Returns the value of attribute src.
25 26 27 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 25 def src @src end |
#table_column_width ⇒ Object
Returns the value of attribute table_column_width.
39 40 41 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 39 def table_column_width @table_column_width end |
#type ⇒ Object
Returns the value of attribute type.
60 61 62 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 60 def type @type end |
#width ⇒ Object
Returns the value of attribute width.
27 28 29 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 27 def width @width end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
112 113 114 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 112 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 85 def self.attribute_map { :'dynamic' => :'dynamic', :'alt_text' => :'alt_text', :'asset_id' => :'asset_id', :'href' => :'href', :'src' => :'src', :'width' => :'width', :'height' => :'height', :'image_width' => :'image_width', :'image_align' => :'image_align', :'show_on' => :'show_on', :'table_column_width' => :'table_column_width', :'cell_text_align' => :'cell_text_align', :'cropped_asset_id' => :'cropped_asset_id', :'cropped_src' => :'cropped_src', :'cropping_aspect_ratio' => :'cropping_aspect_ratio', :'cropping_height' => :'cropping_height', :'cropping_width' => :'cropping_width', :'cropping_x' => :'cropping_x', :'cropping_y' => :'cropping_y', :'id' => :'id', :'type' => :'type' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
378 379 380 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 378 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 144 def self.openapi_nullable Set.new([ :'dynamic', :'alt_text', :'asset_id', :'href', :'src', :'width', :'height', :'image_width', :'image_align', :'show_on', :'table_column_width', :'cell_text_align', :'cropped_asset_id', :'cropped_src', :'cropping_aspect_ratio', :'cropping_height', :'cropping_width', :'cropping_x', :'cropping_y', :'id', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 117 def self.openapi_types { :'dynamic' => :'Boolean', :'alt_text' => :'String', :'asset_id' => :'String', :'href' => :'String', :'src' => :'String', :'width' => :'Integer', :'height' => :'Integer', :'image_width' => :'Integer', :'image_align' => :'String', :'show_on' => :'String', :'table_column_width' => :'String', :'cell_text_align' => :'String', :'cropped_asset_id' => :'String', :'cropped_src' => :'String', :'cropping_aspect_ratio' => :'String', :'cropping_height' => :'Integer', :'cropping_width' => :'Integer', :'cropping_x' => :'Integer', :'cropping_y' => :'Integer', :'id' => :'String', :'type' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 337 def ==(o) return true if self.equal?(o) self.class == o.class && dynamic == o.dynamic && alt_text == o.alt_text && asset_id == o.asset_id && href == o.href && src == o.src && width == o.width && height == o.height && image_width == o.image_width && image_align == o.image_align && show_on == o.show_on && table_column_width == o.table_column_width && cell_text_align == o.cell_text_align && cropped_asset_id == o.cropped_asset_id && cropped_src == o.cropped_src && cropping_aspect_ratio == o.cropping_aspect_ratio && cropping_height == o.cropping_height && cropping_width == o.cropping_width && cropping_x == o.cropping_x && cropping_y == o.cropping_y && id == o.id && type == o.type end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
409 410 411 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 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 409 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
480 481 482 483 484 485 486 487 488 489 490 491 492 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 480 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
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 385 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
365 366 367 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 365 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
371 372 373 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 371 def hash [dynamic, alt_text, asset_id, href, src, width, height, image_width, image_align, show_on, table_column_width, cell_text_align, cropped_asset_id, cropped_src, cropping_aspect_ratio, cropping_height, cropping_width, cropping_x, cropping_y, id, type].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
271 272 273 274 275 276 277 278 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 271 def list_invalid_properties invalid_properties = Array.new if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
456 457 458 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 456 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 462 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
450 451 452 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 450 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/klaviyo-api-sdk/models/table_image_sub_block.rb', line 282 def valid? image_align_validator = EnumAttributeValidator.new('String', ["center", "left", "right"]) return false unless image_align_validator.valid?(@image_align) show_on_validator = EnumAttributeValidator.new('String', ["all", "desktop", "mobile"]) return false unless show_on_validator.valid?(@show_on) cell_text_align_validator = EnumAttributeValidator.new('String', ["center", "left", "right"]) return false unless cell_text_align_validator.valid?(@cell_text_align) return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ["table_image"]) return false unless type_validator.valid?(@type) true end |