Class: Spatio::SlideElement

Inherits:
ApiModelBase show all
Defined in:
lib/spatio-sdk/models/slide_element.rb

Overview

One canvas object on a slide — text box, shape, image, etc. ‘content` is renderer-specific JSON (e.g. fabric.js properties: text, fill, fontSize, src). Identified by a stable `id` so MCP / agent operations stay idempotent across retries.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ SlideElement

Initializes the object

Parameters:

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

    Model attributes in the form of hash



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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
142
143
144
145
146
147
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
# File 'lib/spatio-sdk/models/slide_element.rb', line 99

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Spatio::SlideElement` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Spatio::SlideElement`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  else
    self.id = nil
  end

  if attributes.key?(:'slide_id')
    self.slide_id = attributes[:'slide_id']
  else
    self.slide_id = nil
  end

  if attributes.key?(:'element_type')
    self.element_type = attributes[:'element_type']
  else
    self.element_type = nil
  end

  if attributes.key?(:'content')
    if (value = attributes[:'content']).is_a?(Hash)
      self.content = value
    end
  else
    self.content = nil
  end

  if attributes.key?(:'x')
    self.x = attributes[:'x']
  else
    self.x = nil
  end

  if attributes.key?(:'y')
    self.y = attributes[:'y']
  else
    self.y = nil
  end

  if attributes.key?(:'width')
    self.width = attributes[:'width']
  else
    self.width = nil
  end

  if attributes.key?(:'height')
    self.height = attributes[:'height']
  else
    self.height = nil
  end

  if attributes.key?(:'rotation')
    self.rotation = attributes[:'rotation']
  else
    self.rotation = nil
  end

  if attributes.key?(:'z_index')
    self.z_index = attributes[:'z_index']
  else
    self.z_index = nil
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  else
    self.created_at = nil
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  else
    self.updated_at = nil
  end
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



26
27
28
# File 'lib/spatio-sdk/models/slide_element.rb', line 26

def content
  @content
end

#created_atObject

Returns the value of attribute created_at.



41
42
43
# File 'lib/spatio-sdk/models/slide_element.rb', line 41

def created_at
  @created_at
end

#element_typeObject

Free-form type id (‘text`, `image`, `shape`, etc.).



24
25
26
# File 'lib/spatio-sdk/models/slide_element.rb', line 24

def element_type
  @element_type
end

#heightObject

Returns the value of attribute height.



34
35
36
# File 'lib/spatio-sdk/models/slide_element.rb', line 34

def height
  @height
end

#idObject

Returns the value of attribute id.



19
20
21
# File 'lib/spatio-sdk/models/slide_element.rb', line 19

def id
  @id
end

#rotationObject

Degrees.



37
38
39
# File 'lib/spatio-sdk/models/slide_element.rb', line 37

def rotation
  @rotation
end

#slide_idObject

Returns the value of attribute slide_id.



21
22
23
# File 'lib/spatio-sdk/models/slide_element.rb', line 21

def slide_id
  @slide_id
end

#updated_atObject

Returns the value of attribute updated_at.



43
44
45
# File 'lib/spatio-sdk/models/slide_element.rb', line 43

def updated_at
  @updated_at
end

#widthObject

Returns the value of attribute width.



32
33
34
# File 'lib/spatio-sdk/models/slide_element.rb', line 32

def width
  @width
end

#xObject

Returns the value of attribute x.



28
29
30
# File 'lib/spatio-sdk/models/slide_element.rb', line 28

def x
  @x
end

#yObject

Returns the value of attribute y.



30
31
32
# File 'lib/spatio-sdk/models/slide_element.rb', line 30

def y
  @y
end

#z_indexObject

Returns the value of attribute z_index.



39
40
41
# File 'lib/spatio-sdk/models/slide_element.rb', line 39

def z_index
  @z_index
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



64
65
66
# File 'lib/spatio-sdk/models/slide_element.rb', line 64

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



69
70
71
# File 'lib/spatio-sdk/models/slide_element.rb', line 69

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/spatio-sdk/models/slide_element.rb', line 46

def self.attribute_map
  {
    :'id' => :'id',
    :'slide_id' => :'slideId',
    :'element_type' => :'elementType',
    :'content' => :'content',
    :'x' => :'x',
    :'y' => :'y',
    :'width' => :'width',
    :'height' => :'height',
    :'rotation' => :'rotation',
    :'z_index' => :'zIndex',
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt'
  }
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



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/spatio-sdk/models/slide_element.rb', line 417

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{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[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



92
93
94
95
# File 'lib/spatio-sdk/models/slide_element.rb', line 92

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/spatio-sdk/models/slide_element.rb', line 74

def self.openapi_types
  {
    :'id' => :'String',
    :'slide_id' => :'String',
    :'element_type' => :'String',
    :'content' => :'Hash<String, Object>',
    :'x' => :'Float',
    :'y' => :'Float',
    :'width' => :'Float',
    :'height' => :'Float',
    :'rotation' => :'Float',
    :'z_index' => :'Integer',
    :'created_at' => :'Time',
    :'updated_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/spatio-sdk/models/slide_element.rb', line 385

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      slide_id == o.slide_id &&
      element_type == o.element_type &&
      content == o.content &&
      x == o.x &&
      y == o.y &&
      width == o.width &&
      height == o.height &&
      rotation == o.rotation &&
      z_index == o.z_index &&
      created_at == o.created_at &&
      updated_at == o.updated_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


404
405
406
# File 'lib/spatio-sdk/models/slide_element.rb', line 404

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



410
411
412
# File 'lib/spatio-sdk/models/slide_element.rb', line 410

def hash
  [id, slide_id, element_type, content, x, y, width, height, rotation, z_index, created_at, updated_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/spatio-sdk/models/slide_element.rb', line 190

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @slide_id.nil?
    invalid_properties.push('invalid value for "slide_id", slide_id cannot be nil.')
  end

  if @element_type.nil?
    invalid_properties.push('invalid value for "element_type", element_type cannot be nil.')
  end

  if @content.nil?
    invalid_properties.push('invalid value for "content", content cannot be nil.')
  end

  if @x.nil?
    invalid_properties.push('invalid value for "x", x cannot be nil.')
  end

  if @y.nil?
    invalid_properties.push('invalid value for "y", y cannot be nil.')
  end

  if @width.nil?
    invalid_properties.push('invalid value for "width", width cannot be nil.')
  end

  if @height.nil?
    invalid_properties.push('invalid value for "height", height cannot be nil.')
  end

  if @rotation.nil?
    invalid_properties.push('invalid value for "rotation", rotation cannot be nil.')
  end

  if @z_index.nil?
    invalid_properties.push('invalid value for "z_index", z_index cannot be nil.')
  end

  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @updated_at.nil?
    invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/spatio-sdk/models/slide_element.rb', line 439

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/spatio-sdk/models/slide_element.rb', line 246

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @slide_id.nil?
  return false if @element_type.nil?
  return false if @content.nil?
  return false if @x.nil?
  return false if @y.nil?
  return false if @width.nil?
  return false if @height.nil?
  return false if @rotation.nil?
  return false if @z_index.nil?
  return false if @created_at.nil?
  return false if @updated_at.nil?
  true
end