Class: Spatio::Sheet

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

Overview

A spreadsheet. Sheets belong to exactly one connected account (‘accountId` + `provider`). The native provider stores sheets in the Spatio database; external providers (Google Sheets, Excel Online, etc.) round-trip through Spatio. `data` is a free-form bag for provider-specific blobs (cell matrices, formulas, formatting). Clients that walk rows / cells should use the dedicated row + cell endpoints; `data` is only meaningful when round-tripping with an external provider that embeds its native format here.

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 = {}) ⇒ Sheet

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Spatio::Sheet` 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::Sheet`. 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?(:'provider')
    self.provider = attributes[:'provider']
  end

  if attributes.key?(:'account_id')
    self. = attributes[:'account_id']
  end

  if attributes.key?(:'owner_user_id')
    self.owner_user_id = attributes[:'owner_user_id']
  end

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

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

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

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

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

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

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

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

  if attributes.key?(:'file_size')
    self.file_size = attributes[:'file_size']
  end

  if attributes.key?(:'last_accessed_at')
    self.last_accessed_at = attributes[:'last_accessed_at']
  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

#account_idObject

Connected-account row this sheet belongs to.



25
26
27
# File 'lib/spatio-sdk/models/sheet.rb', line 25

def 
  @account_id
end

#column_countObject

Returns the value of attribute column_count.



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

def column_count
  @column_count
end

#created_atObject

Returns the value of attribute created_at.



52
53
54
# File 'lib/spatio-sdk/models/sheet.rb', line 52

def created_at
  @created_at
end

#dataObject

Free-form provider blob. Treat as opaque.



35
36
37
# File 'lib/spatio-sdk/models/sheet.rb', line 35

def data
  @data
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#file_sizeObject

Returns the value of attribute file_size.



48
49
50
# File 'lib/spatio-sdk/models/sheet.rb', line 48

def file_size
  @file_size
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#is_publicObject

Returns the value of attribute is_public.



44
45
46
# File 'lib/spatio-sdk/models/sheet.rb', line 44

def is_public
  @is_public
end

#is_read_onlyObject

Returns the value of attribute is_read_only.



46
47
48
# File 'lib/spatio-sdk/models/sheet.rb', line 46

def is_read_only
  @is_read_only
end

#last_accessed_atObject

Returns the value of attribute last_accessed_at.



50
51
52
# File 'lib/spatio-sdk/models/sheet.rb', line 50

def last_accessed_at
  @last_accessed_at
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#owner_user_idObject

User id of the sheet owner; non-native providers leave empty.



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

def owner_user_id
  @owner_user_id
end

#providerObject

Registered provider id (e.g. ‘native-sheets`).



22
23
24
# File 'lib/spatio-sdk/models/sheet.rb', line 22

def provider
  @provider
end

#row_countObject

Returns the value of attribute row_count.



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

def row_count
  @row_count
end

#sheet_countObject

Tab count when the file contains multiple sheets.



42
43
44
# File 'lib/spatio-sdk/models/sheet.rb', line 42

def sheet_count
  @sheet_count
end

#updated_atObject

Returns the value of attribute updated_at.



54
55
56
# File 'lib/spatio-sdk/models/sheet.rb', line 54

def updated_at
  @updated_at
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



79
80
81
# File 'lib/spatio-sdk/models/sheet.rb', line 79

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



84
85
86
# File 'lib/spatio-sdk/models/sheet.rb', line 84

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/spatio-sdk/models/sheet.rb', line 57

def self.attribute_map
  {
    :'id' => :'id',
    :'provider' => :'provider',
    :'account_id' => :'accountId',
    :'owner_user_id' => :'ownerUserId',
    :'name' => :'name',
    :'description' => :'description',
    :'data' => :'data',
    :'row_count' => :'rowCount',
    :'column_count' => :'columnCount',
    :'sheet_count' => :'sheetCount',
    :'is_public' => :'isPublic',
    :'is_read_only' => :'isReadOnly',
    :'file_size' => :'fileSize',
    :'last_accessed_at' => :'lastAccessedAt',
    :'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



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/spatio-sdk/models/sheet.rb', line 408

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



111
112
113
114
115
116
117
# File 'lib/spatio-sdk/models/sheet.rb', line 111

def self.openapi_nullable
  Set.new([
    :'description',
    :'file_size',
    :'last_accessed_at',
  ])
end

.openapi_typesObject

Attribute type mapping.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/spatio-sdk/models/sheet.rb', line 89

def self.openapi_types
  {
    :'id' => :'String',
    :'provider' => :'String',
    :'account_id' => :'String',
    :'owner_user_id' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'data' => :'Hash<String, Object>',
    :'row_count' => :'Integer',
    :'column_count' => :'Integer',
    :'sheet_count' => :'Integer',
    :'is_public' => :'Boolean',
    :'is_read_only' => :'Boolean',
    :'file_size' => :'Integer',
    :'last_accessed_at' => :'Time',
    :'created_at' => :'Time',
    :'updated_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/spatio-sdk/models/sheet.rb', line 372

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      provider == o.provider &&
       == o. &&
      owner_user_id == o.owner_user_id &&
      name == o.name &&
      description == o.description &&
      data == o.data &&
      row_count == o.row_count &&
      column_count == o.column_count &&
      sheet_count == o.sheet_count &&
      is_public == o.is_public &&
      is_read_only == o.is_read_only &&
      file_size == o.file_size &&
      last_accessed_at == o.last_accessed_at &&
      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


395
396
397
# File 'lib/spatio-sdk/models/sheet.rb', line 395

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



401
402
403
# File 'lib/spatio-sdk/models/sheet.rb', line 401

def hash
  [id, provider, , owner_user_id, name, description, data, row_count, column_count, sheet_count, is_public, is_read_only, file_size, last_accessed_at, 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



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

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 @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

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

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

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

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

  if @is_read_only.nil?
    invalid_properties.push('invalid value for "is_read_only", is_read_only 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



430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/spatio-sdk/models/sheet.rb', line 430

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



266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/spatio-sdk/models/sheet.rb', line 266

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @name.nil?
  return false if @row_count.nil?
  return false if @column_count.nil?
  return false if @sheet_count.nil?
  return false if @is_public.nil?
  return false if @is_read_only.nil?
  return false if @created_at.nil?
  return false if @updated_at.nil?
  true
end