commonlit-clever-ruby 2.1.6.beta1 → 2.1.6.beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +37 -29
  4. data/README.md +994 -61
  5. data/clever-ruby.gemspec +6 -13
  6. data/commonlit-clever-ruby-2.1.6.beta1.gem +0 -0
  7. data/docs/AdminName.md +0 -1
  8. data/docs/BadRequest.md +0 -1
  9. data/docs/Contact.md +1 -2
  10. data/docs/ContactObject.md +0 -1
  11. data/docs/ContactResponse.md +0 -1
  12. data/docs/ContactsCreated.md +2 -3
  13. data/docs/ContactsDeleted.md +2 -3
  14. data/docs/ContactsResponse.md +0 -1
  15. data/docs/ContactsUpdated.md +2 -3
  16. data/docs/Course.md +1 -2
  17. data/docs/CourseObject.md +0 -1
  18. data/docs/CourseResponse.md +0 -1
  19. data/docs/CoursesCreated.md +2 -3
  20. data/docs/CoursesDeleted.md +2 -3
  21. data/docs/CoursesResponse.md +0 -1
  22. data/docs/CoursesUpdated.md +2 -3
  23. data/docs/Credentials.md +0 -1
  24. data/docs/DataApi.md +2784 -0
  25. data/docs/District.md +9 -10
  26. data/docs/DistrictAdmin.md +2 -3
  27. data/docs/DistrictAdminObject.md +0 -1
  28. data/docs/DistrictAdminResponse.md +0 -1
  29. data/docs/DistrictAdminsResponse.md +0 -1
  30. data/docs/DistrictObject.md +0 -1
  31. data/docs/DistrictResponse.md +0 -1
  32. data/docs/DistrictadminsCreated.md +2 -3
  33. data/docs/DistrictadminsDeleted.md +2 -3
  34. data/docs/DistrictadminsUpdated.md +2 -3
  35. data/docs/DistrictsCreated.md +2 -3
  36. data/docs/DistrictsDeleted.md +2 -3
  37. data/docs/DistrictsResponse.md +0 -1
  38. data/docs/DistrictsUpdated.md +2 -3
  39. data/docs/Event.md +2 -3
  40. data/docs/EventResponse.md +0 -1
  41. data/docs/EventsApi.md +1 -4
  42. data/docs/EventsResponse.md +0 -1
  43. data/docs/InternalError.md +0 -1
  44. data/docs/Link.md +0 -1
  45. data/docs/Location.md +2 -3
  46. data/docs/Name.md +1 -2
  47. data/docs/NotFound.md +0 -1
  48. data/docs/Principal.md +1 -2
  49. data/docs/School.md +3 -4
  50. data/docs/SchoolAdmin.md +3 -4
  51. data/docs/SchoolAdminObject.md +0 -1
  52. data/docs/SchoolAdminResponse.md +0 -1
  53. data/docs/SchoolAdminsResponse.md +0 -1
  54. data/docs/SchoolEnrollment.md +1 -2
  55. data/docs/SchoolObject.md +0 -1
  56. data/docs/SchoolResponse.md +0 -1
  57. data/docs/SchooladminsCreated.md +2 -3
  58. data/docs/SchooladminsDeleted.md +2 -3
  59. data/docs/SchooladminsUpdated.md +2 -3
  60. data/docs/SchoolsCreated.md +2 -3
  61. data/docs/SchoolsDeleted.md +2 -3
  62. data/docs/SchoolsResponse.md +0 -1
  63. data/docs/SchoolsUpdated.md +2 -3
  64. data/docs/Section.md +2 -3
  65. data/docs/SectionObject.md +0 -1
  66. data/docs/SectionResponse.md +0 -1
  67. data/docs/SectionsCreated.md +2 -3
  68. data/docs/SectionsDeleted.md +2 -3
  69. data/docs/SectionsResponse.md +0 -1
  70. data/docs/SectionsUpdated.md +2 -3
  71. data/docs/Student.md +3 -4
  72. data/docs/StudentObject.md +0 -1
  73. data/docs/StudentResponse.md +0 -1
  74. data/docs/StudentsCreated.md +2 -3
  75. data/docs/StudentsDeleted.md +2 -3
  76. data/docs/StudentsResponse.md +0 -1
  77. data/docs/StudentsUpdated.md +2 -3
  78. data/docs/Teacher.md +2 -3
  79. data/docs/TeacherObject.md +0 -1
  80. data/docs/TeacherResponse.md +0 -1
  81. data/docs/TeachersCreated.md +2 -3
  82. data/docs/TeachersDeleted.md +2 -3
  83. data/docs/TeachersResponse.md +0 -1
  84. data/docs/TeachersUpdated.md +2 -3
  85. data/docs/Term.md +2 -3
  86. data/docs/TermObject.md +0 -1
  87. data/docs/TermResponse.md +0 -1
  88. data/docs/TermsCreated.md +2 -3
  89. data/docs/TermsDeleted.md +2 -3
  90. data/docs/TermsResponse.md +0 -1
  91. data/docs/TermsUpdated.md +2 -3
  92. data/git_push.sh +55 -0
  93. data/lib/clever-ruby/api/data_api.rb +2999 -0
  94. data/lib/clever-ruby/api/events_api.rb +25 -20
  95. data/lib/clever-ruby/api_error.rb +23 -4
  96. data/lib/clever-ruby/configuration.rb +5 -9
  97. data/lib/clever-ruby/models/admin_name.rb +46 -22
  98. data/lib/clever-ruby/models/bad_request.rb +42 -20
  99. data/lib/clever-ruby/models/contact.rb +83 -55
  100. data/lib/clever-ruby/models/contact_object.rb +42 -20
  101. data/lib/clever-ruby/models/contact_response.rb +42 -20
  102. data/lib/clever-ruby/models/contacts_response.rb +44 -22
  103. data/lib/clever-ruby/models/course.rb +60 -36
  104. data/lib/clever-ruby/models/course_object.rb +42 -20
  105. data/lib/clever-ruby/models/course_response.rb +42 -20
  106. data/lib/clever-ruby/models/courses_response.rb +44 -22
  107. data/lib/clever-ruby/models/credentials.rb +42 -20
  108. data/lib/clever-ruby/models/district.rb +122 -94
  109. data/lib/clever-ruby/models/district_admin.rb +67 -44
  110. data/lib/clever-ruby/models/district_admin_object.rb +42 -20
  111. data/lib/clever-ruby/models/district_admin_response.rb +42 -20
  112. data/lib/clever-ruby/models/district_admins_response.rb +44 -22
  113. data/lib/clever-ruby/models/district_object.rb +42 -20
  114. data/lib/clever-ruby/models/district_response.rb +42 -20
  115. data/lib/clever-ruby/models/districts_response.rb +44 -22
  116. data/lib/clever-ruby/models/event.rb +60 -33
  117. data/lib/clever-ruby/models/event_response.rb +42 -20
  118. data/lib/clever-ruby/models/events_response.rb +44 -22
  119. data/lib/clever-ruby/models/internal_error.rb +42 -20
  120. data/lib/clever-ruby/models/link.rb +47 -25
  121. data/lib/clever-ruby/models/location.rb +73 -45
  122. data/lib/clever-ruby/models/name.rb +58 -33
  123. data/lib/clever-ruby/models/not_found.rb +42 -20
  124. data/lib/clever-ruby/models/principal.rb +55 -31
  125. data/lib/clever-ruby/models/school.rb +108 -80
  126. data/lib/clever-ruby/models/school_admin.rb +85 -61
  127. data/lib/clever-ruby/models/school_admin_object.rb +42 -20
  128. data/lib/clever-ruby/models/school_admin_response.rb +42 -20
  129. data/lib/clever-ruby/models/school_admins_response.rb +44 -22
  130. data/lib/clever-ruby/models/school_enrollment.rb +56 -34
  131. data/lib/clever-ruby/models/school_object.rb +42 -20
  132. data/lib/clever-ruby/models/school_response.rb +42 -20
  133. data/lib/clever-ruby/models/schools_response.rb +44 -22
  134. data/lib/clever-ruby/models/section.rb +104 -75
  135. data/lib/clever-ruby/models/section_object.rb +42 -20
  136. data/lib/clever-ruby/models/section_response.rb +42 -20
  137. data/lib/clever-ruby/models/sections_response.rb +44 -22
  138. data/lib/clever-ruby/models/student.rb +147 -126
  139. data/lib/clever-ruby/models/student_object.rb +42 -20
  140. data/lib/clever-ruby/models/student_response.rb +42 -20
  141. data/lib/clever-ruby/models/students_response.rb +44 -22
  142. data/lib/clever-ruby/models/teacher.rb +89 -63
  143. data/lib/clever-ruby/models/teacher_object.rb +42 -20
  144. data/lib/clever-ruby/models/teacher_response.rb +42 -20
  145. data/lib/clever-ruby/models/teachers_response.rb +44 -22
  146. data/lib/clever-ruby/models/term.rb +69 -44
  147. data/lib/clever-ruby/models/term_object.rb +42 -20
  148. data/lib/clever-ruby/models/term_response.rb +42 -20
  149. data/lib/clever-ruby/models/terms_response.rb +44 -22
  150. data/lib/clever-ruby/version.rb +4 -5
  151. data/lib/clever-ruby.rb +4 -14
  152. data/override/README-extension.md +1 -1
  153. data/override/override.sh +3 -0
  154. data/spec/api/data_api_spec.rb +671 -0
  155. data/spec/api/events_api_spec.rb +4 -3
  156. data/spec/api_client_spec.rb +21 -3
  157. data/spec/spec_helper.rb +4 -3
  158. metadata +25 -179
  159. data/docs/ContactsApi.md +0 -231
  160. data/docs/CoursesApi.md +0 -231
  161. data/docs/DistrictAdminsApi.md +0 -171
  162. data/docs/DistrictsApi.md +0 -113
  163. data/docs/SchoolAdminsApi.md +0 -231
  164. data/docs/SchoolsApi.md +0 -351
  165. data/docs/SectionsApi.md +0 -499
  166. data/docs/StudentsApi.md +0 -463
  167. data/docs/TeachersApi.md +0 -403
  168. data/docs/TermsApi.md +0 -231
  169. data/lib/clever-ruby/api/contacts_api.rb +0 -241
  170. data/lib/clever-ruby/api/courses_api.rb +0 -241
  171. data/lib/clever-ruby/api/district_admins_api.rb +0 -182
  172. data/lib/clever-ruby/api/districts_api.rb +0 -123
  173. data/lib/clever-ruby/api/school_admins_api.rb +0 -241
  174. data/lib/clever-ruby/api/schools_api.rb +0 -359
  175. data/lib/clever-ruby/api/sections_api.rb +0 -500
  176. data/lib/clever-ruby/api/students_api.rb +0 -468
  177. data/lib/clever-ruby/api/teachers_api.rb +0 -409
  178. data/lib/clever-ruby/api/terms_api.rb +0 -241
  179. data/spec/api/contacts_api_spec.rb +0 -84
  180. data/spec/api/courses_api_spec.rb +0 -84
  181. data/spec/api/district_admins_api_spec.rb +0 -70
  182. data/spec/api/districts_api_spec.rb +0 -56
  183. data/spec/api/school_admins_api_spec.rb +0 -84
  184. data/spec/api/schools_api_spec.rb +0 -112
  185. data/spec/api/sections_api_spec.rb +0 -142
  186. data/spec/api/students_api_spec.rb +0 -137
  187. data/spec/api/teachers_api_spec.rb +0 -123
  188. data/spec/api/terms_api_spec.rb +0 -84
@@ -1,53 +1,67 @@
1
1
  =begin
2
- #Data API
2
+ #Clever API
3
3
 
4
- #Serves the Clever Data API
4
+ #The Clever API
5
5
 
6
6
  OpenAPI spec version: 2.1.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.37
10
-
9
+ Swagger Codegen version: 3.0.51
11
10
  =end
12
11
 
13
12
  require 'date'
14
13
 
15
14
  module Clever
16
15
  class Principal
17
- attr_accessor :name
18
-
19
16
  attr_accessor :email
20
17
 
18
+ attr_accessor :name
19
+
21
20
  # Attribute mapping from ruby-style variable name to JSON key.
22
21
  def self.attribute_map
23
22
  {
24
- :'name' => :'name',
25
- :'email' => :'email'
23
+ :'email' => :'email',
24
+ :'name' => :'name'
26
25
  }
27
26
  end
28
27
 
29
28
  # Attribute type mapping.
30
- def self.swagger_types
29
+ def self.openapi_types
31
30
  {
32
- :'name' => :'String',
33
- :'email' => :'String'
31
+ :'email' => :'Object',
32
+ :'name' => :'Object'
34
33
  }
35
34
  end
36
35
 
36
+ # List of attributes with nullable: true
37
+ def self.openapi_nullable
38
+ Set.new([
39
+ :'email',
40
+ :'name'
41
+ ])
42
+ end
43
+
37
44
  # Initializes the object
38
45
  # @param [Hash] attributes Model attributes in the form of hash
39
46
  def initialize(attributes = {})
40
- return unless attributes.is_a?(Hash)
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::Principal` initialize method"
49
+ end
41
50
 
42
- # convert string to symbol for hash key
43
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::Principal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
44
58
 
45
- if attributes.has_key?(:'name')
46
- self.name = attributes[:'name']
59
+ if attributes.key?(:'email')
60
+ self.email = attributes[:'email']
47
61
  end
48
62
 
49
- if attributes.has_key?(:'email')
50
- self.email = attributes[:'email']
63
+ if attributes.key?(:'name')
64
+ self.name = attributes[:'name']
51
65
  end
52
66
  end
53
67
 
@@ -69,8 +83,8 @@ module Clever
69
83
  def ==(o)
70
84
  return true if self.equal?(o)
71
85
  self.class == o.class &&
72
- name == o.name &&
73
- email == o.email
86
+ email == o.email &&
87
+ name == o.name
74
88
  end
75
89
 
76
90
  # @see the `==` method
@@ -80,9 +94,16 @@ module Clever
80
94
  end
81
95
 
82
96
  # Calculates hash code according to all attributes.
83
- # @return [Fixnum] Hash code
97
+ # @return [Integer] Hash code
84
98
  def hash
85
- [name, email].hash
99
+ [email, name].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def self.build_from_hash(attributes)
106
+ new.build_from_hash(attributes)
86
107
  end
87
108
 
88
109
  # Builds the object from hash
@@ -90,7 +111,7 @@ module Clever
90
111
  # @return [Object] Returns the model itself
91
112
  def build_from_hash(attributes)
92
113
  return nil unless attributes.is_a?(Hash)
93
- self.class.swagger_types.each_pair do |key, type|
114
+ self.class.openapi_types.each_pair do |key, type|
94
115
  if type =~ /\AArray<(.*)>/i
95
116
  # check to ensure the input is an array given that the attribute
96
117
  # is documented as an array but the input is not
@@ -99,7 +120,9 @@ module Clever
99
120
  end
100
121
  elsif !attributes[self.class.attribute_map[key]].nil?
101
122
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
- end # or else data not found in attributes(hash), not an issue as the data can be optional
123
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
124
+ self.send("#{key}=", nil)
125
+ end
103
126
  end
104
127
 
105
128
  self
@@ -121,7 +144,7 @@ module Clever
121
144
  value.to_i
122
145
  when :Float
123
146
  value.to_f
124
- when :BOOLEAN
147
+ when :Boolean
125
148
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
149
  true
127
150
  else
@@ -142,8 +165,7 @@ module Clever
142
165
  end
143
166
  end
144
167
  else # model
145
- temp_model = Clever.const_get(type).new
146
- temp_model.build_from_hash(value)
168
+ Clever.const_get(type).build_from_hash(value)
147
169
  end
148
170
  end
149
171
 
@@ -165,7 +187,11 @@ module Clever
165
187
  hash = {}
166
188
  self.class.attribute_map.each_pair do |attr, param|
167
189
  value = self.send(attr)
168
- next if value.nil?
190
+ if value.nil?
191
+ is_nullable = self.class.openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
169
195
  hash[param] = _to_hash(value)
170
196
  end
171
197
  hash
@@ -187,7 +213,5 @@ module Clever
187
213
  else
188
214
  value
189
215
  end
190
- end
191
-
192
- end
216
+ end end
193
217
  end
@@ -1,33 +1,36 @@
1
1
  =begin
2
- #Data API
2
+ #Clever API
3
3
 
4
- #Serves the Clever Data API
4
+ #The Clever API
5
5
 
6
6
  OpenAPI spec version: 2.1.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.37
10
-
9
+ Swagger Codegen version: 3.0.51
11
10
  =end
12
11
 
13
12
  require 'date'
14
13
 
15
14
  module Clever
16
15
  class School
17
- attr_accessor :id
18
-
19
16
  attr_accessor :created
20
17
 
21
18
  attr_accessor :district
22
19
 
20
+ attr_accessor :ext
21
+
23
22
  attr_accessor :high_grade
24
23
 
24
+ attr_accessor :id
25
+
25
26
  attr_accessor :last_modified
26
27
 
27
28
  attr_accessor :location
28
29
 
29
30
  attr_accessor :low_grade
30
31
 
32
+ attr_accessor :mdr_number
33
+
31
34
  attr_accessor :name
32
35
 
33
36
  attr_accessor :nces_id
@@ -42,10 +45,6 @@ module Clever
42
45
 
43
46
  attr_accessor :state_id
44
47
 
45
- attr_accessor :mdr_number
46
-
47
- attr_accessor :ext
48
-
49
48
  class EnumAttributeValidator
50
49
  attr_reader :datatype
51
50
  attr_reader :allowable_values
@@ -71,118 +70,137 @@ module Clever
71
70
  # Attribute mapping from ruby-style variable name to JSON key.
72
71
  def self.attribute_map
73
72
  {
74
- :'id' => :'id',
75
73
  :'created' => :'created',
76
74
  :'district' => :'district',
75
+ :'ext' => :'ext',
77
76
  :'high_grade' => :'high_grade',
77
+ :'id' => :'id',
78
78
  :'last_modified' => :'last_modified',
79
79
  :'location' => :'location',
80
80
  :'low_grade' => :'low_grade',
81
+ :'mdr_number' => :'mdr_number',
81
82
  :'name' => :'name',
82
83
  :'nces_id' => :'nces_id',
83
84
  :'phone' => :'phone',
84
85
  :'principal' => :'principal',
85
86
  :'school_number' => :'school_number',
86
87
  :'sis_id' => :'sis_id',
87
- :'state_id' => :'state_id',
88
- :'mdr_number' => :'mdr_number',
89
- :'ext' => :'ext'
88
+ :'state_id' => :'state_id'
90
89
  }
91
90
  end
92
91
 
93
92
  # Attribute type mapping.
94
- def self.swagger_types
93
+ def self.openapi_types
95
94
  {
96
- :'id' => :'String',
97
- :'created' => :'String',
98
- :'district' => :'String',
99
- :'high_grade' => :'String',
100
- :'last_modified' => :'String',
101
- :'location' => :'Location',
102
- :'low_grade' => :'String',
103
- :'name' => :'String',
104
- :'nces_id' => :'String',
105
- :'phone' => :'String',
106
- :'principal' => :'Principal',
107
- :'school_number' => :'String',
108
- :'sis_id' => :'String',
109
- :'state_id' => :'String',
110
- :'mdr_number' => :'String',
111
- :'ext' => :'Object'
95
+ :'created' => :'Object',
96
+ :'district' => :'Object',
97
+ :'ext' => :'Object',
98
+ :'high_grade' => :'Object',
99
+ :'id' => :'Object',
100
+ :'last_modified' => :'Object',
101
+ :'location' => :'Object',
102
+ :'low_grade' => :'Object',
103
+ :'mdr_number' => :'Object',
104
+ :'name' => :'Object',
105
+ :'nces_id' => :'Object',
106
+ :'phone' => :'Object',
107
+ :'principal' => :'Object',
108
+ :'school_number' => :'Object',
109
+ :'sis_id' => :'Object',
110
+ :'state_id' => :'Object'
112
111
  }
113
112
  end
114
113
 
114
+ # List of attributes with nullable: true
115
+ def self.openapi_nullable
116
+ Set.new([
117
+ :'high_grade',
118
+ :'low_grade',
119
+ :'mdr_number',
120
+ :'nces_id',
121
+ :'phone',
122
+ :'state_id'
123
+ ])
124
+ end
125
+
115
126
  # Initializes the object
116
127
  # @param [Hash] attributes Model attributes in the form of hash
117
128
  def initialize(attributes = {})
118
- return unless attributes.is_a?(Hash)
119
-
120
- # convert string to symbol for hash key
121
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
122
-
123
- if attributes.has_key?(:'id')
124
- self.id = attributes[:'id']
129
+ if (!attributes.is_a?(Hash))
130
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::School` initialize method"
125
131
  end
126
132
 
127
- if attributes.has_key?(:'created')
133
+ # check to see if the attribute exists and convert string to symbol for hash key
134
+ attributes = attributes.each_with_object({}) { |(k, v), h|
135
+ if (!self.class.attribute_map.key?(k.to_sym))
136
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::School`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
137
+ end
138
+ h[k.to_sym] = v
139
+ }
140
+
141
+ if attributes.key?(:'created')
128
142
  self.created = attributes[:'created']
129
143
  end
130
144
 
131
- if attributes.has_key?(:'district')
145
+ if attributes.key?(:'district')
132
146
  self.district = attributes[:'district']
133
147
  end
134
148
 
135
- if attributes.has_key?(:'high_grade')
149
+ if attributes.key?(:'ext')
150
+ self.ext = attributes[:'ext']
151
+ end
152
+
153
+ if attributes.key?(:'high_grade')
136
154
  self.high_grade = attributes[:'high_grade']
137
155
  end
138
156
 
139
- if attributes.has_key?(:'last_modified')
157
+ if attributes.key?(:'id')
158
+ self.id = attributes[:'id']
159
+ end
160
+
161
+ if attributes.key?(:'last_modified')
140
162
  self.last_modified = attributes[:'last_modified']
141
163
  end
142
164
 
143
- if attributes.has_key?(:'location')
165
+ if attributes.key?(:'location')
144
166
  self.location = attributes[:'location']
145
167
  end
146
168
 
147
- if attributes.has_key?(:'low_grade')
169
+ if attributes.key?(:'low_grade')
148
170
  self.low_grade = attributes[:'low_grade']
149
171
  end
150
172
 
151
- if attributes.has_key?(:'name')
173
+ if attributes.key?(:'mdr_number')
174
+ self.mdr_number = attributes[:'mdr_number']
175
+ end
176
+
177
+ if attributes.key?(:'name')
152
178
  self.name = attributes[:'name']
153
179
  end
154
180
 
155
- if attributes.has_key?(:'nces_id')
181
+ if attributes.key?(:'nces_id')
156
182
  self.nces_id = attributes[:'nces_id']
157
183
  end
158
184
 
159
- if attributes.has_key?(:'phone')
185
+ if attributes.key?(:'phone')
160
186
  self.phone = attributes[:'phone']
161
187
  end
162
188
 
163
- if attributes.has_key?(:'principal')
189
+ if attributes.key?(:'principal')
164
190
  self.principal = attributes[:'principal']
165
191
  end
166
192
 
167
- if attributes.has_key?(:'school_number')
193
+ if attributes.key?(:'school_number')
168
194
  self.school_number = attributes[:'school_number']
169
195
  end
170
196
 
171
- if attributes.has_key?(:'sis_id')
197
+ if attributes.key?(:'sis_id')
172
198
  self.sis_id = attributes[:'sis_id']
173
199
  end
174
200
 
175
- if attributes.has_key?(:'state_id')
201
+ if attributes.key?(:'state_id')
176
202
  self.state_id = attributes[:'state_id']
177
203
  end
178
-
179
- if attributes.has_key?(:'mdr_number')
180
- self.mdr_number = attributes[:'mdr_number']
181
- end
182
-
183
- if attributes.has_key?(:'ext')
184
- self.ext = attributes[:'ext']
185
- end
186
204
  end
187
205
 
188
206
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -195,9 +213,9 @@ module Clever
195
213
  # Check to see if the all the properties in the model are valid
196
214
  # @return true if the model is valid
197
215
  def valid?
198
- high_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', ''])
216
+ high_grade_validator = EnumAttributeValidator.new('Object', ['InfantToddler', 'Preschool', 'PreKindergarten', 'TransitionalKindergarten', 'Kindergarten', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', 'PostGraduate', 'Ungraded', 'Other', ''])
199
217
  return false unless high_grade_validator.valid?(@high_grade)
200
- low_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', ''])
218
+ low_grade_validator = EnumAttributeValidator.new('Object', ['InfantToddler', 'Preschool', 'PreKindergarten', 'TransitionalKindergarten', 'Kindergarten', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', 'PostGraduate', 'Ungraded', 'Other', ''])
201
219
  return false unless low_grade_validator.valid?(@low_grade)
202
220
  true
203
221
  end
@@ -205,9 +223,9 @@ module Clever
205
223
  # Custom attribute writer method checking allowed values (enum).
206
224
  # @param [Object] high_grade Object to be assigned
207
225
  def high_grade=(high_grade)
208
- 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', ''])
226
+ validator = EnumAttributeValidator.new('Object', ['InfantToddler', 'Preschool', 'PreKindergarten', 'TransitionalKindergarten', 'Kindergarten', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', 'PostGraduate', 'Ungraded', 'Other', ''])
209
227
  unless validator.valid?(high_grade)
210
- fail ArgumentError, 'invalid value for "high_grade", must be one of #{validator.allowable_values}.'
228
+ fail ArgumentError, "invalid value for \"high_grade\", must be one of #{validator.allowable_values}."
211
229
  end
212
230
  @high_grade = high_grade
213
231
  end
@@ -215,9 +233,9 @@ module Clever
215
233
  # Custom attribute writer method checking allowed values (enum).
216
234
  # @param [Object] low_grade Object to be assigned
217
235
  def low_grade=(low_grade)
218
- 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', ''])
236
+ validator = EnumAttributeValidator.new('Object', ['InfantToddler', 'Preschool', 'PreKindergarten', 'TransitionalKindergarten', 'Kindergarten', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', 'PostGraduate', 'Ungraded', 'Other', ''])
219
237
  unless validator.valid?(low_grade)
220
- fail ArgumentError, 'invalid value for "low_grade", must be one of #{validator.allowable_values}.'
238
+ fail ArgumentError, "invalid value for \"low_grade\", must be one of #{validator.allowable_values}."
221
239
  end
222
240
  @low_grade = low_grade
223
241
  end
@@ -227,22 +245,22 @@ module Clever
227
245
  def ==(o)
228
246
  return true if self.equal?(o)
229
247
  self.class == o.class &&
230
- id == o.id &&
231
248
  created == o.created &&
232
249
  district == o.district &&
250
+ ext == o.ext &&
233
251
  high_grade == o.high_grade &&
252
+ id == o.id &&
234
253
  last_modified == o.last_modified &&
235
254
  location == o.location &&
236
255
  low_grade == o.low_grade &&
256
+ mdr_number == o.mdr_number &&
237
257
  name == o.name &&
238
258
  nces_id == o.nces_id &&
239
259
  phone == o.phone &&
240
260
  principal == o.principal &&
241
261
  school_number == o.school_number &&
242
262
  sis_id == o.sis_id &&
243
- state_id == o.state_id &&
244
- mdr_number == o.mdr_number &&
245
- ext == o.ext
263
+ state_id == o.state_id
246
264
  end
247
265
 
248
266
  # @see the `==` method
@@ -252,9 +270,16 @@ module Clever
252
270
  end
253
271
 
254
272
  # Calculates hash code according to all attributes.
255
- # @return [Fixnum] Hash code
273
+ # @return [Integer] Hash code
256
274
  def hash
257
- [id, created, district, high_grade, last_modified, location, low_grade, name, nces_id, phone, principal, school_number, sis_id, state_id, mdr_number, ext].hash
275
+ [created, district, ext, high_grade, id, last_modified, location, low_grade, mdr_number, name, nces_id, phone, principal, school_number, sis_id, state_id].hash
276
+ end
277
+
278
+ # Builds the object from hash
279
+ # @param [Hash] attributes Model attributes in the form of hash
280
+ # @return [Object] Returns the model itself
281
+ def self.build_from_hash(attributes)
282
+ new.build_from_hash(attributes)
258
283
  end
259
284
 
260
285
  # Builds the object from hash
@@ -262,7 +287,7 @@ module Clever
262
287
  # @return [Object] Returns the model itself
263
288
  def build_from_hash(attributes)
264
289
  return nil unless attributes.is_a?(Hash)
265
- self.class.swagger_types.each_pair do |key, type|
290
+ self.class.openapi_types.each_pair do |key, type|
266
291
  if type =~ /\AArray<(.*)>/i
267
292
  # check to ensure the input is an array given that the attribute
268
293
  # is documented as an array but the input is not
@@ -271,7 +296,9 @@ module Clever
271
296
  end
272
297
  elsif !attributes[self.class.attribute_map[key]].nil?
273
298
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
274
- end # or else data not found in attributes(hash), not an issue as the data can be optional
299
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
300
+ self.send("#{key}=", nil)
301
+ end
275
302
  end
276
303
 
277
304
  self
@@ -293,7 +320,7 @@ module Clever
293
320
  value.to_i
294
321
  when :Float
295
322
  value.to_f
296
- when :BOOLEAN
323
+ when :Boolean
297
324
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
298
325
  true
299
326
  else
@@ -314,8 +341,7 @@ module Clever
314
341
  end
315
342
  end
316
343
  else # model
317
- temp_model = Clever.const_get(type).new
318
- temp_model.build_from_hash(value)
344
+ Clever.const_get(type).build_from_hash(value)
319
345
  end
320
346
  end
321
347
 
@@ -337,7 +363,11 @@ module Clever
337
363
  hash = {}
338
364
  self.class.attribute_map.each_pair do |attr, param|
339
365
  value = self.send(attr)
340
- next if value.nil?
366
+ if value.nil?
367
+ is_nullable = self.class.openapi_nullable.include?(attr)
368
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
369
+ end
370
+
341
371
  hash[param] = _to_hash(value)
342
372
  end
343
373
  hash
@@ -359,7 +389,5 @@ module Clever
359
389
  else
360
390
  value
361
391
  end
362
- end
363
-
364
- end
392
+ end end
365
393
  end