class Clever::Student

Attributes

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

Public Class Methods

attribute_map() click to toggle source

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

# 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
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# 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
swagger_types() click to toggle source

Attribute type mapping.

# 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

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/clever-ruby/models/student.rb, line 374
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) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/clever-ruby/models/student.rb, line 441
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) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/clever-ruby/models/student.rb, line 507
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) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/clever-ruby/models/student.rb, line 420
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
dob=(dob) click to toggle source

Custom attribute writer method with validation @param [Object] dob Value to be assigned

# File lib/clever-ruby/models/student.rb, line 304
def dob=(dob)
  if !dob.nil? && dob !~ Regexp.new(/(?:[0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})/)
    fail ArgumentError, 'invalid value for "dob", must conform to the pattern /(?:[0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})/.'
  end

  @dob = dob
end
ell_status=(ell_status) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] ell_status Object to be assigned

# File lib/clever-ruby/models/student.rb, line 314
def ell_status=(ell_status)
  validator = EnumAttributeValidator.new('String', ['Y', 'N', ''])
  unless validator.valid?(ell_status)
    fail ArgumentError, 'invalid value for "ell_status", must be one of #{validator.allowable_values}.'
  end
  @ell_status = ell_status
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/clever-ruby/models/student.rb, line 407
def eql?(o)
  self == o
end
gender=(gender) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] gender Object to be assigned

# File lib/clever-ruby/models/student.rb, line 324
def gender=(gender)
  validator = EnumAttributeValidator.new('String', ['M', 'F', 'X', ''])
  unless validator.valid?(gender)
    fail ArgumentError, 'invalid value for "gender", must be one of #{validator.allowable_values}.'
  end
  @gender = gender
end
grade=(grade) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] grade Object to be assigned

# File lib/clever-ruby/models/student.rb, line 334
def grade=(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', ''])
  unless validator.valid?(grade)
    fail ArgumentError, 'invalid value for "grade", must be one of #{validator.allowable_values}.'
  end
  @grade = grade
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/clever-ruby/models/student.rb, line 413
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
hispanic_ethnicity=(hispanic_ethnicity) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] hispanic_ethnicity Object to be assigned

# File lib/clever-ruby/models/student.rb, line 344
def hispanic_ethnicity=(hispanic_ethnicity)
  validator = EnumAttributeValidator.new('String', ['Y', 'N', ''])
  unless validator.valid?(hispanic_ethnicity)
    fail ArgumentError, 'invalid value for "hispanic_ethnicity", must be one of #{validator.allowable_values}.'
  end
  @hispanic_ethnicity = hispanic_ethnicity
end
home_language=(home_language) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] home_language Object to be assigned

# File lib/clever-ruby/models/student.rb, line 354
def home_language=(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', ''])
  unless validator.valid?(home_language)
    fail ArgumentError, 'invalid value for "home_language", must be one of #{validator.allowable_values}.'
  end
  @home_language = home_language
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/clever-ruby/models/student.rb, line 274
def list_invalid_properties
  invalid_properties = Array.new
  if !@dob.nil? && @dob !~ Regexp.new(/(?:[0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})/)
    invalid_properties.push('invalid value for "dob", must conform to the pattern /(?:[0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})/.')
  end

  invalid_properties
end
race=(race) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] race Object to be assigned

# File lib/clever-ruby/models/student.rb, line 364
def race=(race)
  validator = EnumAttributeValidator.new('String', ['Caucasian', 'Asian', 'Black or African American', 'American Indian', 'Hawaiian or Other Pacific Islander', 'Two or More Races', 'Unknown', ''])
  unless validator.valid?(race)
    fail ArgumentError, 'invalid value for "race", must be one of #{validator.allowable_values}.'
  end
  @race = race
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/clever-ruby/models/student.rb, line 487
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/clever-ruby/models/student.rb, line 493
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() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/clever-ruby/models/student.rb, line 481
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/clever-ruby/models/student.rb, line 285
def valid?
  return false if !@dob.nil? && @dob !~ Regexp.new(/(?:[0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})/)
  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