Class: Clever::Student

Inherits:
Object
  • Object
show all
Defined in:
lib/clever-ruby/models/student.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Student

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/clever-ruby/models/student.rb', line 157

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'created')
    self.created = attributes[:'created']
  end

  if attributes.has_key?(:'credentials')
    self.credentials = attributes[:'credentials']
  end

  if attributes.has_key?(:'district')
    self.district = attributes[:'district']
  end

  if attributes.has_key?(:'dob')
    self.dob = attributes[:'dob']
  end

  if attributes.has_key?(:'ell_status')
    self.ell_status = attributes[:'ell_status']
  end

  if attributes.has_key?(:'email')
    self.email = attributes[:'email']
  end

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

  if attributes.has_key?(:'ext')
    self.ext = attributes[:'ext']
  end

  if attributes.has_key?(:'gender')
    self.gender = attributes[:'gender']
  end

  if attributes.has_key?(:'grade')
    self.grade = attributes[:'grade']
  end

  if attributes.has_key?(:'graduation_year')
    self.graduation_year = attributes[:'graduation_year']
  end

  if attributes.has_key?(:'hispanic_ethnicity')
    self.hispanic_ethnicity = attributes[:'hispanic_ethnicity']
  end

  if attributes.has_key?(:'home_language')
    self.home_language = attributes[:'home_language']
  end

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'iep_status')
    self.iep_status = attributes[:'iep_status']
  end

  if attributes.has_key?(:'last_modified')
    self.last_modified = attributes[:'last_modified']
  end

  if attributes.has_key?(:'location')
    self.location = attributes[:'location']
  end

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

  if attributes.has_key?(:'race')
    self.race = attributes[:'race']
  end

  if attributes.has_key?(:'school')
    self.school = attributes[:'school']
  end

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

  if attributes.has_key?(:'sis_id')
    self.sis_id = attributes[:'sis_id']
  end

  if attributes.has_key?(:'state_id')
    self.state_id = attributes[:'state_id']
  end

  if attributes.has_key?(:'student_number')
    self.student_number = attributes[:'student_number']
  end

  if attributes.has_key?(:'unweighted_gpa')
    self.unweighted_gpa = attributes[:'unweighted_gpa']
  end

  if attributes.has_key?(:'weighted_gpa')
    self.weighted_gpa = attributes[:'weighted_gpa']
  end
end

Instance Attribute Details

#createdObject

Returns the value of attribute created.



17
18
19
# File 'lib/clever-ruby/models/student.rb', line 17

def created
  @created
end

#credentialsObject

Returns the value of attribute credentials.



19
20
21
# File 'lib/clever-ruby/models/student.rb', line 19

def credentials
  @credentials
end

#districtObject

Returns the value of attribute district.



21
22
23
# File 'lib/clever-ruby/models/student.rb', line 21

def district
  @district
end

#dobObject

Returns the value of attribute dob.



23
24
25
# File 'lib/clever-ruby/models/student.rb', line 23

def dob
  @dob
end

#ell_statusObject

Returns the value of attribute ell_status.



25
26
27
# File 'lib/clever-ruby/models/student.rb', line 25

def ell_status
  @ell_status
end

#emailObject

Returns the value of attribute email.



27
28
29
# File 'lib/clever-ruby/models/student.rb', line 27

def email
  @email
end

#enrollmentsObject

Returns the value of attribute enrollments.



29
30
31
# File 'lib/clever-ruby/models/student.rb', line 29

def enrollments
  @enrollments
end

#extObject

Returns the value of attribute ext.



31
32
33
# File 'lib/clever-ruby/models/student.rb', line 31

def ext
  @ext
end

#genderObject

Returns the value of attribute gender.



33
34
35
# File 'lib/clever-ruby/models/student.rb', line 33

def gender
  @gender
end

#gradeObject

Returns the value of attribute grade.



35
36
37
# File 'lib/clever-ruby/models/student.rb', line 35

def grade
  @grade
end

#graduation_yearObject

Returns the value of attribute graduation_year.



37
38
39
# File 'lib/clever-ruby/models/student.rb', line 37

def graduation_year
  @graduation_year
end

#hispanic_ethnicityObject

Returns the value of attribute hispanic_ethnicity.



39
40
41
# File 'lib/clever-ruby/models/student.rb', line 39

def hispanic_ethnicity
  @hispanic_ethnicity
end

#home_languageObject

Returns the value of attribute home_language.



41
42
43
# File 'lib/clever-ruby/models/student.rb', line 41

def home_language
  @home_language
end

#idObject

Returns the value of attribute id.



43
44
45
# File 'lib/clever-ruby/models/student.rb', line 43

def id
  @id
end

#iep_statusObject

Returns the value of attribute iep_status.



45
46
47
# File 'lib/clever-ruby/models/student.rb', line 45

def iep_status
  @iep_status
end

#last_modifiedObject

Returns the value of attribute last_modified.



47
48
49
# File 'lib/clever-ruby/models/student.rb', line 47

def last_modified
  @last_modified
end

#locationObject

Returns the value of attribute location.



49
50
51
# File 'lib/clever-ruby/models/student.rb', line 49

def location
  @location
end

#nameObject

Returns the value of attribute name.



51
52
53
# File 'lib/clever-ruby/models/student.rb', line 51

def name
  @name
end

#raceObject

Returns the value of attribute race.



53
54
55
# File 'lib/clever-ruby/models/student.rb', line 53

def race
  @race
end

#schoolObject

Returns the value of attribute school.



55
56
57
# File 'lib/clever-ruby/models/student.rb', line 55

def school
  @school
end

#schoolsObject

Returns the value of attribute schools.



57
58
59
# File 'lib/clever-ruby/models/student.rb', line 57

def schools
  @schools
end

#sis_idObject

Returns the value of attribute sis_id.



59
60
61
# File 'lib/clever-ruby/models/student.rb', line 59

def sis_id
  @sis_id
end

#state_idObject

Returns the value of attribute state_id.



61
62
63
# File 'lib/clever-ruby/models/student.rb', line 61

def state_id
  @state_id
end

#student_numberObject

Returns the value of attribute student_number.



63
64
65
# File 'lib/clever-ruby/models/student.rb', line 63

def student_number
  @student_number
end

#unweighted_gpaObject

Returns the value of attribute unweighted_gpa.



65
66
67
# File 'lib/clever-ruby/models/student.rb', line 65

def unweighted_gpa
  @unweighted_gpa
end

#weighted_gpaObject

Returns the value of attribute weighted_gpa.



67
68
69
# File 'lib/clever-ruby/models/student.rb', line 67

def weighted_gpa
  @weighted_gpa
end

Class Method Details

.attribute_mapObject

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



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/clever-ruby/models/student.rb', line 92

def self.attribute_map
  {
    :'created' => :'created',
    :'credentials' => :'credentials',
    :'district' => :'district',
    :'dob' => :'dob',
    :'ell_status' => :'ell_status',
    :'email' => :'email',
    :'enrollments' => :'enrollments',
    :'ext' => :'ext',
    :'gender' => :'gender',
    :'grade' => :'grade',
    :'graduation_year' => :'graduation_year',
    :'hispanic_ethnicity' => :'hispanic_ethnicity',
    :'home_language' => :'home_language',
    :'id' => :'id',
    :'iep_status' => :'iep_status',
    :'last_modified' => :'last_modified',
    :'location' => :'location',
    :'name' => :'name',
    :'race' => :'race',
    :'school' => :'school',
    :'schools' => :'schools',
    :'sis_id' => :'sis_id',
    :'state_id' => :'state_id',
    :'student_number' => :'student_number',
    :'unweighted_gpa' => :'unweighted_gpa',
    :'weighted_gpa' => :'weighted_gpa'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/clever-ruby/models/student.rb', line 124

def self.swagger_types
  {
    :'created' => :'String',
    :'credentials' => :'Credentials',
    :'district' => :'String',
    :'dob' => :'String',
    :'ell_status' => :'String',
    :'email' => :'String',
    :'enrollments' => :'Array<SchoolEnrollment>',
    :'ext' => :'Object',
    :'gender' => :'String',
    :'grade' => :'String',
    :'graduation_year' => :'String',
    :'hispanic_ethnicity' => :'String',
    :'home_language' => :'String',
    :'id' => :'String',
    :'iep_status' => :'String',
    :'last_modified' => :'String',
    :'location' => :'Location',
    :'name' => :'Name',
    :'race' => :'String',
    :'school' => :'String',
    :'schools' => :'Array<String>',
    :'sis_id' => :'String',
    :'state_id' => :'String',
    :'student_number' => :'String',
    :'unweighted_gpa' => :'String',
    :'weighted_gpa' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/clever-ruby/models/student.rb', line 359

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      created == o.created &&
      credentials == o.credentials &&
      district == o.district &&
      dob == o.dob &&
      ell_status == o.ell_status &&
      email == o.email &&
      enrollments == o.enrollments &&
      ext == o.ext &&
      gender == o.gender &&
      grade == o.grade &&
      graduation_year == o.graduation_year &&
      hispanic_ethnicity == o.hispanic_ethnicity &&
      home_language == o.home_language &&
      id == o.id &&
      iep_status == o.iep_status &&
      last_modified == o.last_modified &&
      location == o.location &&
      name == o.name &&
      race == o.race &&
      school == o.school &&
      schools == o.schools &&
      sis_id == o.sis_id &&
      state_id == o.state_id &&
      student_number == o.student_number &&
      unweighted_gpa == o.unweighted_gpa &&
      weighted_gpa == o.weighted_gpa
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



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
460
461
462
# File 'lib/clever-ruby/models/student.rb', line 426

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.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
    temp_model = Clever.const_get(type).new
    temp_model.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



492
493
494
495
496
497
498
499
500
501
502
503
504
# File 'lib/clever-ruby/models/student.rb', line 492

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



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/clever-ruby/models/student.rb', line 405

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if 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 # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


392
393
394
# File 'lib/clever-ruby/models/student.rb', line 392

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



398
399
400
# File 'lib/clever-ruby/models/student.rb', line 398

def hash
  [created, credentials, district, dob, ell_status, email, enrollments, ext, gender, grade, graduation_year, hispanic_ethnicity, home_language, id, iep_status, last_modified, location, name, race, school, schools, sis_id, state_id, student_number, unweighted_gpa, weighted_gpa].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



274
275
276
277
# File 'lib/clever-ruby/models/student.rb', line 274

def list_invalid_properties
  invalid_properties = Array.new
  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



472
473
474
# File 'lib/clever-ruby/models/student.rb', line 472

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



478
479
480
481
482
483
484
485
486
# File 'lib/clever-ruby/models/student.rb', line 478

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



466
467
468
# File 'lib/clever-ruby/models/student.rb', line 466

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



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/clever-ruby/models/student.rb', line 281

def valid?
  ell_status_validator = EnumAttributeValidator.new('String', ['Y', 'N', ''])
  return false unless ell_status_validator.valid?(@ell_status)
  gender_validator = EnumAttributeValidator.new('String', ['M', 'F', 'X', ''])
  return false unless gender_validator.valid?(@gender)
  grade_validator = EnumAttributeValidator.new('String', ['InfantToddler', 'Preschool', 'PreKindergarten', 'TransitionalKindergarten', 'Kindergarten', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', 'PostGraduate', 'Ungraded', 'Other', ''])
  return false unless grade_validator.valid?(@grade)
  hispanic_ethnicity_validator = EnumAttributeValidator.new('String', ['Y', 'N', ''])
  return false unless hispanic_ethnicity_validator.valid?(@hispanic_ethnicity)
  home_language_validator = EnumAttributeValidator.new('String', ['English', 'Albanian', 'Amharic', 'Arabic', 'Bengali', 'Bosnian', 'Burmese', 'Cantonese', 'Chinese', 'Dutch', 'Farsi', 'French', 'German', 'Hebrew', 'Hindi', 'Hmong', 'Ilocano', 'Japanese', 'Javanese', 'Karen', 'Khmer', 'Korean', 'Laotian', 'Latvian', 'Malay', 'Mandarin', 'Nepali', 'Oromo', 'Polish', 'Portuguese', 'Punjabi', 'Romanian', 'Russian', 'Samoan', 'Serbian', 'Somali', 'Spanish', 'Swahili', 'Tagalog', 'Tamil', 'Telugu', 'Thai', 'Tigrinya', 'Turkish', 'Ukrainian', 'Urdu', 'Vietnamese', ''])
  return false unless home_language_validator.valid?(@home_language)
  race_validator = EnumAttributeValidator.new('String', ['Caucasian', 'Asian', 'Black or African American', 'American Indian', 'Hawaiian or Other Pacific Islander', 'Two or More Races', 'Unknown', ''])
  return false unless race_validator.valid?(@race)
  true
end