Class: Clever::Student
- Inherits:
-
Object
- Object
- Clever::Student
- Defined in:
- lib/clever-ruby/models/student.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#created ⇒ Object
Returns the value of attribute created.
-
#credentials ⇒ Object
Returns the value of attribute credentials.
-
#district ⇒ Object
Returns the value of attribute district.
-
#dob ⇒ Object
Returns the value of attribute dob.
-
#ell_status ⇒ Object
Returns the value of attribute ell_status.
-
#email ⇒ Object
Returns the value of attribute email.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#grade ⇒ Object
Returns the value of attribute grade.
-
#graduation_year ⇒ Object
Returns the value of attribute graduation_year.
-
#hispanic_ethnicity ⇒ Object
Returns the value of attribute hispanic_ethnicity.
-
#home_language ⇒ Object
Returns the value of attribute home_language.
-
#id ⇒ Object
Returns the value of attribute id.
-
#iep_status ⇒ Object
Returns the value of attribute iep_status.
-
#last_modified ⇒ Object
Returns the value of attribute last_modified.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#race ⇒ Object
Returns the value of attribute race.
-
#school ⇒ Object
Returns the value of attribute school.
-
#schools ⇒ Object
Returns the value of attribute schools.
-
#sis_id ⇒ Object
Returns the value of attribute sis_id.
-
#state_id ⇒ Object
Returns the value of attribute state_id.
-
#student_number ⇒ Object
Returns the value of attribute student_number.
-
#unweighted_gpa ⇒ Object
Returns the value of attribute unweighted_gpa.
-
#weighted_gpa ⇒ Object
Returns the value of attribute weighted_gpa.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Student
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Student
Initializes the object
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 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 |
# File 'lib/clever-ruby/models/student.rb', line 150 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?(:'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
#created ⇒ Object
Returns the value of attribute created.
18 19 20 |
# File 'lib/clever-ruby/models/student.rb', line 18 def created @created end |
#credentials ⇒ Object
Returns the value of attribute credentials.
20 21 22 |
# File 'lib/clever-ruby/models/student.rb', line 20 def credentials @credentials end |
#district ⇒ Object
Returns the value of attribute district.
22 23 24 |
# File 'lib/clever-ruby/models/student.rb', line 22 def district @district end |
#dob ⇒ Object
Returns the value of attribute dob.
24 25 26 |
# File 'lib/clever-ruby/models/student.rb', line 24 def dob @dob end |
#ell_status ⇒ Object
Returns the value of attribute ell_status.
26 27 28 |
# File 'lib/clever-ruby/models/student.rb', line 26 def ell_status @ell_status end |
#email ⇒ Object
Returns the value of attribute email.
28 29 30 |
# File 'lib/clever-ruby/models/student.rb', line 28 def email @email end |
#gender ⇒ Object
Returns the value of attribute gender.
30 31 32 |
# File 'lib/clever-ruby/models/student.rb', line 30 def gender @gender end |
#grade ⇒ Object
Returns the value of attribute grade.
32 33 34 |
# File 'lib/clever-ruby/models/student.rb', line 32 def grade @grade end |
#graduation_year ⇒ Object
Returns the value of attribute graduation_year.
34 35 36 |
# File 'lib/clever-ruby/models/student.rb', line 34 def graduation_year @graduation_year end |
#hispanic_ethnicity ⇒ Object
Returns the value of attribute hispanic_ethnicity.
36 37 38 |
# File 'lib/clever-ruby/models/student.rb', line 36 def hispanic_ethnicity @hispanic_ethnicity end |
#home_language ⇒ Object
Returns the value of attribute home_language.
38 39 40 |
# File 'lib/clever-ruby/models/student.rb', line 38 def home_language @home_language end |
#id ⇒ Object
Returns the value of attribute id.
40 41 42 |
# File 'lib/clever-ruby/models/student.rb', line 40 def id @id end |
#iep_status ⇒ Object
Returns the value of attribute iep_status.
42 43 44 |
# File 'lib/clever-ruby/models/student.rb', line 42 def iep_status @iep_status end |
#last_modified ⇒ Object
Returns the value of attribute last_modified.
44 45 46 |
# File 'lib/clever-ruby/models/student.rb', line 44 def last_modified @last_modified end |
#location ⇒ Object
Returns the value of attribute location.
46 47 48 |
# File 'lib/clever-ruby/models/student.rb', line 46 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
48 49 50 |
# File 'lib/clever-ruby/models/student.rb', line 48 def name @name end |
#race ⇒ Object
Returns the value of attribute race.
50 51 52 |
# File 'lib/clever-ruby/models/student.rb', line 50 def race @race end |
#school ⇒ Object
Returns the value of attribute school.
52 53 54 |
# File 'lib/clever-ruby/models/student.rb', line 52 def school @school end |
#schools ⇒ Object
Returns the value of attribute schools.
54 55 56 |
# File 'lib/clever-ruby/models/student.rb', line 54 def schools @schools end |
#sis_id ⇒ Object
Returns the value of attribute sis_id.
56 57 58 |
# File 'lib/clever-ruby/models/student.rb', line 56 def sis_id @sis_id end |
#state_id ⇒ Object
Returns the value of attribute state_id.
58 59 60 |
# File 'lib/clever-ruby/models/student.rb', line 58 def state_id @state_id end |
#student_number ⇒ Object
Returns the value of attribute student_number.
60 61 62 |
# File 'lib/clever-ruby/models/student.rb', line 60 def student_number @student_number end |
#unweighted_gpa ⇒ Object
Returns the value of attribute unweighted_gpa.
62 63 64 |
# File 'lib/clever-ruby/models/student.rb', line 62 def unweighted_gpa @unweighted_gpa end |
#weighted_gpa ⇒ Object
Returns the value of attribute weighted_gpa.
64 65 66 |
# File 'lib/clever-ruby/models/student.rb', line 64 def weighted_gpa @weighted_gpa end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
89 90 91 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 |
# File 'lib/clever-ruby/models/student.rb', line 89 def self.attribute_map { :'created' => :'created', :'credentials' => :'credentials', :'district' => :'district', :'dob' => :'dob', :'ell_status' => :'ell_status', :'email' => :'email', :'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_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/clever-ruby/models/student.rb', line 119 def self.swagger_types { :'created' => :'String', :'credentials' => :'Credentials', :'district' => :'String', :'dob' => :'String', :'ell_status' => :'String', :'email' => :'String', :'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.
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/clever-ruby/models/student.rb', line 343 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 && 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
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/clever-ruby/models/student.rb', line 408 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
474 475 476 477 478 479 480 481 482 483 484 485 486 |
# File 'lib/clever-ruby/models/student.rb', line 474 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
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/clever-ruby/models/student.rb', line 387 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 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
374 375 376 |
# File 'lib/clever-ruby/models/student.rb', line 374 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
380 381 382 |
# File 'lib/clever-ruby/models/student.rb', line 380 def hash [created, credentials, district, dob, ell_status, email, 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_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
258 259 260 261 |
# File 'lib/clever-ruby/models/student.rb', line 258 def list_invalid_properties invalid_properties = Array.new return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
454 455 456 |
# File 'lib/clever-ruby/models/student.rb', line 454 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
460 461 462 463 464 465 466 467 468 |
# File 'lib/clever-ruby/models/student.rb', line 460 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_s ⇒ String
Returns the string representation of the object
448 449 450 |
# File 'lib/clever-ruby/models/student.rb', line 448 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/clever-ruby/models/student.rb', line 265 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", ""]) return false unless gender_validator.valid?(@gender) grade_validator = EnumAttributeValidator.new('String', ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "PreKindergarten", "Kindergarten", "PostGraduate", "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) return true end |