Class: KlaviyoAPI::TableFallbackImageSubBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ TableFallbackImageSubBlock

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
268
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 172

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `KlaviyoAPI::TableFallbackImageSubBlock` 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::TableFallbackImageSubBlock`. 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_textObject

Returns the value of attribute alt_text.



19
20
21
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 19

def alt_text
  @alt_text
end

#asset_idObject

Returns the value of attribute asset_id.



21
22
23
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 21

def asset_id
  @asset_id
end

#cell_text_alignObject

Text Alignment.



42
43
44
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 42

def cell_text_align
  @cell_text_align
end

#cropped_asset_idObject

Returns the value of attribute cropped_asset_id.



44
45
46
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 44

def cropped_asset_id
  @cropped_asset_id
end

#cropped_srcObject

Returns the value of attribute cropped_src.



46
47
48
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 46

def cropped_src
  @cropped_src
end

#cropping_aspect_ratioObject

Aspect ratio options.



49
50
51
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 49

def cropping_aspect_ratio
  @cropping_aspect_ratio
end

#cropping_heightObject

Returns the value of attribute cropping_height.



51
52
53
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 51

def cropping_height
  @cropping_height
end

#cropping_widthObject

Returns the value of attribute cropping_width.



53
54
55
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 53

def cropping_width
  @cropping_width
end

#cropping_xObject

Returns the value of attribute cropping_x.



55
56
57
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 55

def cropping_x
  @cropping_x
end

#cropping_yObject

Returns the value of attribute cropping_y.



57
58
59
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 57

def cropping_y
  @cropping_y
end

#dynamicObject

Returns the value of attribute dynamic.



17
18
19
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 17

def dynamic
  @dynamic
end

#heightObject

Returns the value of attribute height.



29
30
31
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 29

def height
  @height
end

#hrefObject

Returns the value of attribute href.



23
24
25
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 23

def href
  @href
end

#idObject

Returns the value of attribute id.



59
60
61
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 59

def id
  @id
end

#image_alignObject

Image Alignment.



34
35
36
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 34

def image_align
  @image_align
end

#image_widthObject

Returns the value of attribute image_width.



31
32
33
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 31

def image_width
  @image_width
end

#show_onObject

Show on.



37
38
39
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 37

def show_on
  @show_on
end

#srcObject

Returns the value of attribute src.



25
26
27
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 25

def src
  @src
end

#table_column_widthObject

Returns the value of attribute table_column_width.



39
40
41
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 39

def table_column_width
  @table_column_width
end

#typeObject

Returns the value of attribute type.



61
62
63
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 61

def type
  @type
end

#widthObject

Returns the value of attribute width.



27
28
29
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 27

def width
  @width
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



113
114
115
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 113

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 86

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



391
392
393
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 391

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 145

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_typesObject

Attribute type mapping.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 118

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.

Parameters:

  • Object (Object)

    to be compared



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 350

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

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



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
450
451
452
453
454
455
456
457
458
459
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 422

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



493
494
495
496
497
498
499
500
501
502
503
504
505
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 493

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 398

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


378
379
380
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 378

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



384
385
386
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 384

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_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



272
273
274
275
276
277
278
279
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 272

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_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



469
470
471
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 469

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



475
476
477
478
479
480
481
482
483
484
485
486
487
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 475

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



463
464
465
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 463

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/klaviyo-api-sdk/models/table_fallback_image_sub_block.rb', line 283

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)
  cropping_aspect_ratio_validator = EnumAttributeValidator.new('String', ["16:9", "1:1", "2:3", "3:4", "4:3", "circle", "custom", "original"])
  return false unless cropping_aspect_ratio_validator.valid?(@cropping_aspect_ratio)
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["table_fallback_image"])
  return false unless type_validator.valid?(@type)
  true
end