Class: FlatApi::ClassDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/flat_api/models/class_details.rb

Overview

A classroom

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ClassDetails

Initializes the object



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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/flat_api/models/class_details.rb', line 175

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#assignments_countObject

The number of assignments created in the class



49
50
51
# File 'lib/flat_api/models/class_details.rb', line 49

def assignments_count
  @assignments_count
end

#canvasObject

Returns the value of attribute canvas.



65
66
67
# File 'lib/flat_api/models/class_details.rb', line 65

def canvas
  @canvas
end

#cleverObject

Returns the value of attribute clever.



69
70
71
# File 'lib/flat_api/models/class_details.rb', line 69

def clever
  @clever
end

#creation_dateObject

The date when the class was create



40
41
42
# File 'lib/flat_api/models/class_details.rb', line 40

def creation_date
  @creation_date
end

#descriptionObject

An optionnal description for this class



31
32
33
# File 'lib/flat_api/models/class_details.rb', line 31

def description
  @description
end

#enrollment_codeObject

Teachers only

The enrollment code that can be used by the students to join the class



43
44
45
# File 'lib/flat_api/models/class_details.rb', line 43

def enrollment_code
  @enrollment_code
end

#google_classroomObject

Returns the value of attribute google_classroom.



57
58
59
# File 'lib/flat_api/models/class_details.rb', line 57

def google_classroom
  @google_classroom
end

#google_driveObject

Returns the value of attribute google_drive.



59
60
61
# File 'lib/flat_api/models/class_details.rb', line 59

def google_drive
  @google_drive
end

#idObject

The unique identifier of the class



20
21
22
# File 'lib/flat_api/models/class_details.rb', line 20

def id
  @id
end

#issuesObject

Returns the value of attribute issues.



55
56
57
# File 'lib/flat_api/models/class_details.rb', line 55

def issues
  @issues
end

#levelObject

Returns the value of attribute level.



71
72
73
# File 'lib/flat_api/models/class_details.rb', line 71

def level
  @level
end

#ltiObject

Returns the value of attribute lti.



63
64
65
# File 'lib/flat_api/models/class_details.rb', line 63

def lti
  @lti
end

#mfcObject

Returns the value of attribute mfc.



67
68
69
# File 'lib/flat_api/models/class_details.rb', line 67

def mfc
  @mfc
end

#microsoft_graphObject

Returns the value of attribute microsoft_graph.



61
62
63
# File 'lib/flat_api/models/class_details.rb', line 61

def microsoft_graph
  @microsoft_graph
end

#nameObject

The name of the class



25
26
27
# File 'lib/flat_api/models/class_details.rb', line 25

def name
  @name
end

#organizationObject

The unique identifier of the Organization owning this class



34
35
36
# File 'lib/flat_api/models/class_details.rb', line 34

def organization
  @organization
end

#ownerObject

The unique identifier of the User owning this class



37
38
39
# File 'lib/flat_api/models/class_details.rb', line 37

def owner
  @owner
end

#sectionObject

The section of the class



28
29
30
# File 'lib/flat_api/models/class_details.rb', line 28

def section
  @section
end

#sizeObject

Number of students in the classroom



77
78
79
# File 'lib/flat_api/models/class_details.rb', line 77

def size
  @size
end

#skills_focusedObject

Specific skills that will be focused in classroom



74
75
76
# File 'lib/flat_api/models/class_details.rb', line 74

def skills_focused
  @skills_focused
end

#stateObject

Returns the value of attribute state.



22
23
24
# File 'lib/flat_api/models/class_details.rb', line 22

def state
  @state
end

#students_groupObject

Returns the value of attribute students_group.



51
52
53
# File 'lib/flat_api/models/class_details.rb', line 51

def students_group
  @students_group
end

#teachers_groupObject

Returns the value of attribute teachers_group.



53
54
55
# File 'lib/flat_api/models/class_details.rb', line 53

def teachers_group
  @teachers_group
end

#themeObject

The theme identifier using in Flat User Interface



46
47
48
# File 'lib/flat_api/models/class_details.rb', line 46

def theme
  @theme
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/flat_api/models/class_details.rb', line 379

def self._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 = FlatApi.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



132
133
134
# File 'lib/flat_api/models/class_details.rb', line 132

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/flat_api/models/class_details.rb', line 102

def self.attribute_map
  {
    :'id' => :'id',
    :'state' => :'state',
    :'name' => :'name',
    :'section' => :'section',
    :'description' => :'description',
    :'organization' => :'organization',
    :'owner' => :'owner',
    :'creation_date' => :'creationDate',
    :'enrollment_code' => :'enrollmentCode',
    :'theme' => :'theme',
    :'assignments_count' => :'assignmentsCount',
    :'students_group' => :'studentsGroup',
    :'teachers_group' => :'teachersGroup',
    :'issues' => :'issues',
    :'google_classroom' => :'googleClassroom',
    :'google_drive' => :'googleDrive',
    :'microsoft_graph' => :'microsoftGraph',
    :'lti' => :'lti',
    :'canvas' => :'canvas',
    :'mfc' => :'mfc',
    :'clever' => :'clever',
    :'level' => :'level',
    :'skills_focused' => :'skillsFocused',
    :'size' => :'size'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/flat_api/models/class_details.rb', line 355

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



167
168
169
170
171
# File 'lib/flat_api/models/class_details.rb', line 167

def self.openapi_nullable
  Set.new([
    :'size'
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/flat_api/models/class_details.rb', line 137

def self.openapi_types
  {
    :'id' => :'String',
    :'state' => :'ClassState',
    :'name' => :'String',
    :'section' => :'String',
    :'description' => :'String',
    :'organization' => :'String',
    :'owner' => :'String',
    :'creation_date' => :'Time',
    :'enrollment_code' => :'String',
    :'theme' => :'String',
    :'assignments_count' => :'Float',
    :'students_group' => :'GroupDetails',
    :'teachers_group' => :'GroupDetails',
    :'issues' => :'ClassDetailsIssues',
    :'google_classroom' => :'ClassDetailsGoogleClassroom',
    :'google_drive' => :'ClassDetailsGoogleDrive',
    :'microsoft_graph' => :'ClassDetailsMicrosoftGraph',
    :'lti' => :'ClassDetailsLti',
    :'canvas' => :'ClassDetailsCanvas',
    :'mfc' => :'ClassDetailsMfc',
    :'clever' => :'ClassDetailsClever',
    :'level' => :'ClassGradeLevel',
    :'skills_focused' => :'Array<String>',
    :'size' => :'Float'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/flat_api/models/class_details.rb', line 311

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      state == o.state &&
      name == o.name &&
      section == o.section &&
      description == o.description &&
      organization == o.organization &&
      owner == o.owner &&
      creation_date == o.creation_date &&
      enrollment_code == o.enrollment_code &&
      theme == o.theme &&
      assignments_count == o.assignments_count &&
      students_group == o.students_group &&
      teachers_group == o.teachers_group &&
      issues == o.issues &&
      google_classroom == o.google_classroom &&
      google_drive == o.google_drive &&
      microsoft_graph == o.microsoft_graph &&
      lti == o.lti &&
      canvas == o.canvas &&
      mfc == o.mfc &&
      clever == o.clever &&
      level == o.level &&
      skills_focused == o.skills_focused &&
      size == o.size
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value



450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/flat_api/models/class_details.rb', line 450

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

#eql?(o) ⇒ Boolean

See Also:

  • `==` method


342
343
344
# File 'lib/flat_api/models/class_details.rb', line 342

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.



348
349
350
# File 'lib/flat_api/models/class_details.rb', line 348

def hash
  [id, state, name, section, description, organization, owner, creation_date, enrollment_code, theme, assignments_count, students_group, teachers_group, issues, google_classroom, google_drive, microsoft_graph, lti, canvas, mfc, clever, level, skills_focused, size].hash
end

#list_invalid_propertiesObject

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



291
292
293
294
295
296
297
298
299
# File 'lib/flat_api/models/class_details.rb', line 291

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

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)



426
427
428
# File 'lib/flat_api/models/class_details.rb', line 426

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash



432
433
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/flat_api/models/class_details.rb', line 432

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



420
421
422
# File 'lib/flat_api/models/class_details.rb', line 420

def to_s
  to_hash.to_s
end

#valid?Boolean

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



303
304
305
306
307
# File 'lib/flat_api/models/class_details.rb', line 303

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  true
end