Skip to content

Commit

Permalink
PLS-4143 add ext field for students[2]
Browse files Browse the repository at this point in the history
  • Loading branch information
yratanov committed Nov 23, 2022
1 parent 3bb28fe commit 44da8af
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 32 deletions.
65 changes: 34 additions & 31 deletions lib/clever-ruby/models/student.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ 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}
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

if attributes.has_key?(:'created')
self.created = attributes[:'created']
Expand Down Expand Up @@ -255,9 +255,11 @@ def initialize(attributes = {})
self.weighted_gpa = attributes[:'weighted_gpa']
end

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

end

Expand Down Expand Up @@ -351,30 +353,30 @@ def race=(race)
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
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

# @see the `==` method
Expand All @@ -399,7 +401,7 @@ def build_from_hash(attributes)
# 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) } )
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]]))
Expand Down Expand Up @@ -445,7 +447,8 @@ def _deserialize(type, value)
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
else
# model
temp_model = Clever.const_get(type).new
temp_model.build_from_hash(value)
end
Expand Down Expand Up @@ -481,7 +484,7 @@ def to_hash
# @return [Hash] Returns the value in the form of hash
def _to_hash(value)
if value.is_a?(Array)
value.compact.map{ |v| _to_hash(v) }
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
Expand Down
2 changes: 1 addition & 1 deletion lib/clever-ruby/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
=end

module Clever
VERSION = '2.1.1'
VERSION = '2.1.2'
end

0 comments on commit 44da8af

Please sign in to comment.