commonlit-clever-ruby 2.1.4 → 2.1.6.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +46 -41
- data/Makefile +1 -1
- data/README.md +943 -11
- data/clever-ruby.gemspec +3 -10
- data/commonlit-clever-ruby-2.1.6.beta1.gem +0 -0
- data/docs/AdminName.md +0 -1
- data/docs/BadRequest.md +0 -1
- data/docs/Contact.md +0 -1
- data/docs/ContactObject.md +0 -1
- data/docs/ContactResponse.md +0 -1
- data/docs/ContactsCreated.md +0 -1
- data/docs/ContactsDeleted.md +0 -1
- data/docs/ContactsResponse.md +0 -1
- data/docs/ContactsUpdated.md +0 -1
- data/docs/Course.md +0 -1
- data/docs/CourseObject.md +0 -1
- data/docs/CourseResponse.md +0 -1
- data/docs/CoursesCreated.md +0 -1
- data/docs/CoursesDeleted.md +0 -1
- data/docs/CoursesResponse.md +0 -1
- data/docs/CoursesUpdated.md +0 -1
- data/docs/Credentials.md +0 -1
- data/docs/DataApi.md +1 -69
- data/docs/District.md +0 -1
- data/docs/DistrictAdmin.md +0 -1
- data/docs/DistrictAdminObject.md +0 -1
- data/docs/DistrictAdminResponse.md +0 -1
- data/docs/DistrictAdminsResponse.md +0 -1
- data/docs/DistrictObject.md +0 -1
- data/docs/DistrictResponse.md +0 -1
- data/docs/DistrictadminsCreated.md +0 -1
- data/docs/DistrictadminsDeleted.md +0 -1
- data/docs/DistrictadminsUpdated.md +0 -1
- data/docs/DistrictsCreated.md +0 -1
- data/docs/DistrictsDeleted.md +0 -1
- data/docs/DistrictsResponse.md +0 -1
- data/docs/DistrictsUpdated.md +0 -1
- data/docs/Event.md +0 -1
- data/docs/EventResponse.md +0 -1
- data/docs/EventsApi.md +0 -3
- data/docs/EventsResponse.md +0 -1
- data/docs/InternalError.md +0 -1
- data/docs/Link.md +0 -1
- data/docs/Location.md +0 -1
- data/docs/Name.md +0 -1
- data/docs/NotFound.md +0 -1
- data/docs/Principal.md +0 -1
- data/docs/School.md +0 -1
- data/docs/SchoolAdmin.md +0 -1
- data/docs/SchoolAdminObject.md +0 -1
- data/docs/SchoolAdminResponse.md +0 -1
- data/docs/SchoolAdminsResponse.md +0 -1
- data/docs/SchoolEnrollment.md +0 -1
- data/docs/SchoolObject.md +0 -1
- data/docs/SchoolResponse.md +0 -1
- data/docs/SchooladminsCreated.md +0 -1
- data/docs/SchooladminsDeleted.md +0 -1
- data/docs/SchooladminsUpdated.md +0 -1
- data/docs/SchoolsCreated.md +0 -1
- data/docs/SchoolsDeleted.md +0 -1
- data/docs/SchoolsResponse.md +0 -1
- data/docs/SchoolsUpdated.md +0 -1
- data/docs/Section.md +0 -1
- data/docs/SectionObject.md +0 -1
- data/docs/SectionResponse.md +0 -1
- data/docs/SectionsCreated.md +0 -1
- data/docs/SectionsDeleted.md +0 -1
- data/docs/SectionsResponse.md +0 -1
- data/docs/SectionsUpdated.md +0 -1
- data/docs/Student.md +0 -1
- data/docs/StudentObject.md +0 -1
- data/docs/StudentResponse.md +0 -1
- data/docs/StudentsCreated.md +0 -1
- data/docs/StudentsDeleted.md +0 -1
- data/docs/StudentsResponse.md +0 -1
- data/docs/StudentsUpdated.md +0 -1
- data/docs/Teacher.md +0 -1
- data/docs/TeacherObject.md +0 -1
- data/docs/TeacherResponse.md +0 -1
- data/docs/TeachersCreated.md +0 -1
- data/docs/TeachersDeleted.md +0 -1
- data/docs/TeachersResponse.md +0 -1
- data/docs/TeachersUpdated.md +0 -1
- data/docs/Term.md +0 -1
- data/docs/TermObject.md +0 -1
- data/docs/TermResponse.md +0 -1
- data/docs/TermsCreated.md +0 -1
- data/docs/TermsDeleted.md +0 -1
- data/docs/TermsResponse.md +0 -1
- data/docs/TermsUpdated.md +0 -1
- data/full-v2.yml +2541 -0
- data/lib/clever-ruby/api/data_api.rb +836 -635
- data/lib/clever-ruby/api/events_api.rb +23 -18
- data/lib/clever-ruby/api_client.rb +1 -0
- data/lib/clever-ruby/api_error.rb +21 -2
- data/lib/clever-ruby/configuration.rb +3 -7
- data/lib/clever-ruby/models/admin_name.rb +44 -20
- data/lib/clever-ruby/models/bad_request.rb +40 -18
- data/lib/clever-ruby/models/contact.rb +73 -45
- data/lib/clever-ruby/models/contact_object.rb +40 -18
- data/lib/clever-ruby/models/contact_response.rb +40 -18
- data/lib/clever-ruby/models/contacts_response.rb +42 -20
- data/lib/clever-ruby/models/course.rb +48 -24
- data/lib/clever-ruby/models/course_object.rb +40 -18
- data/lib/clever-ruby/models/course_response.rb +40 -18
- data/lib/clever-ruby/models/courses_response.rb +42 -20
- data/lib/clever-ruby/models/credentials.rb +40 -18
- data/lib/clever-ruby/models/district.rb +75 -47
- data/lib/clever-ruby/models/district_admin.rb +49 -26
- data/lib/clever-ruby/models/district_admin_object.rb +40 -18
- data/lib/clever-ruby/models/district_admin_response.rb +40 -18
- data/lib/clever-ruby/models/district_admins_response.rb +42 -20
- data/lib/clever-ruby/models/district_object.rb +40 -18
- data/lib/clever-ruby/models/district_response.rb +40 -18
- data/lib/clever-ruby/models/districts_response.rb +42 -20
- data/lib/clever-ruby/models/event.rb +49 -22
- data/lib/clever-ruby/models/event_response.rb +40 -18
- data/lib/clever-ruby/models/events_response.rb +42 -20
- data/lib/clever-ruby/models/internal_error.rb +40 -18
- data/lib/clever-ruby/models/link.rb +45 -23
- data/lib/clever-ruby/models/location.rb +56 -28
- data/lib/clever-ruby/models/name.rb +47 -22
- data/lib/clever-ruby/models/not_found.rb +40 -18
- data/lib/clever-ruby/models/principal.rb +44 -20
- data/lib/clever-ruby/models/school.rb +81 -53
- data/lib/clever-ruby/models/school_admin.rb +59 -35
- data/lib/clever-ruby/models/school_admin_object.rb +40 -18
- data/lib/clever-ruby/models/school_admin_response.rb +40 -18
- data/lib/clever-ruby/models/school_admins_response.rb +42 -20
- data/lib/clever-ruby/models/school_enrollment.rb +44 -22
- data/lib/clever-ruby/models/school_object.rb +40 -18
- data/lib/clever-ruby/models/school_response.rb +40 -18
- data/lib/clever-ruby/models/schools_response.rb +42 -20
- data/lib/clever-ruby/models/section.rb +84 -55
- data/lib/clever-ruby/models/section_object.rb +40 -18
- data/lib/clever-ruby/models/section_response.rb +40 -18
- data/lib/clever-ruby/models/sections_response.rb +42 -20
- data/lib/clever-ruby/models/student.rb +121 -100
- data/lib/clever-ruby/models/student_object.rb +40 -18
- data/lib/clever-ruby/models/student_response.rb +40 -18
- data/lib/clever-ruby/models/students_response.rb +42 -20
- data/lib/clever-ruby/models/teacher.rb +69 -43
- data/lib/clever-ruby/models/teacher_object.rb +40 -18
- data/lib/clever-ruby/models/teacher_response.rb +40 -18
- data/lib/clever-ruby/models/teachers_response.rb +42 -20
- data/lib/clever-ruby/models/term.rb +51 -26
- data/lib/clever-ruby/models/term_object.rb +40 -18
- data/lib/clever-ruby/models/term_response.rb +40 -18
- data/lib/clever-ruby/models/terms_response.rb +42 -20
- data/lib/clever-ruby/version.rb +2 -3
- data/lib/clever-ruby.rb +1 -2
- data/override/README-extension.md +4 -5
- data/override/api_client.rb +1 -0
- data/override/override.sh +7 -5
- data/spec/api/data_api_spec.rb +671 -0
- data/spec/api/events_api_spec.rb +61 -0
- data/spec/api_client_spec.rb +243 -0
- data/spec/spec_helper.rb +26 -18
- metadata +34 -150
- data/commonlit-clever-ruby-2.1.3.gem +0 -0
- data/spec/events.json +0 -227
- data/tags +0 -1681
@@ -6,8 +6,7 @@
|
|
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:
|
10
|
-
|
9
|
+
Swagger Codegen version: 3.0.51
|
11
10
|
=end
|
12
11
|
|
13
12
|
require 'date'
|
@@ -91,96 +90,115 @@ module Clever
|
|
91
90
|
end
|
92
91
|
|
93
92
|
# Attribute type mapping.
|
94
|
-
def self.
|
93
|
+
def self.openapi_types
|
95
94
|
{
|
96
|
-
:'created' => :'
|
97
|
-
:'district' => :'
|
95
|
+
:'created' => :'Object',
|
96
|
+
:'district' => :'Object',
|
98
97
|
:'ext' => :'Object',
|
99
|
-
:'high_grade' => :'
|
100
|
-
:'id' => :'
|
101
|
-
:'last_modified' => :'
|
102
|
-
:'location' => :'
|
103
|
-
:'low_grade' => :'
|
104
|
-
:'mdr_number' => :'
|
105
|
-
:'name' => :'
|
106
|
-
:'nces_id' => :'
|
107
|
-
:'phone' => :'
|
108
|
-
:'principal' => :'
|
109
|
-
:'school_number' => :'
|
110
|
-
:'sis_id' => :'
|
111
|
-
:'state_id' => :'
|
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
|
-
|
129
|
+
if (!attributes.is_a?(Hash))
|
130
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::School` initialize method"
|
131
|
+
end
|
119
132
|
|
120
|
-
# convert string to symbol for hash key
|
121
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
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
|
+
}
|
122
140
|
|
123
|
-
if attributes.
|
141
|
+
if attributes.key?(:'created')
|
124
142
|
self.created = attributes[:'created']
|
125
143
|
end
|
126
144
|
|
127
|
-
if attributes.
|
145
|
+
if attributes.key?(:'district')
|
128
146
|
self.district = attributes[:'district']
|
129
147
|
end
|
130
148
|
|
131
|
-
if attributes.
|
149
|
+
if attributes.key?(:'ext')
|
132
150
|
self.ext = attributes[:'ext']
|
133
151
|
end
|
134
152
|
|
135
|
-
if attributes.
|
153
|
+
if attributes.key?(:'high_grade')
|
136
154
|
self.high_grade = attributes[:'high_grade']
|
137
155
|
end
|
138
156
|
|
139
|
-
if attributes.
|
157
|
+
if attributes.key?(:'id')
|
140
158
|
self.id = attributes[:'id']
|
141
159
|
end
|
142
160
|
|
143
|
-
if attributes.
|
161
|
+
if attributes.key?(:'last_modified')
|
144
162
|
self.last_modified = attributes[:'last_modified']
|
145
163
|
end
|
146
164
|
|
147
|
-
if attributes.
|
165
|
+
if attributes.key?(:'location')
|
148
166
|
self.location = attributes[:'location']
|
149
167
|
end
|
150
168
|
|
151
|
-
if attributes.
|
169
|
+
if attributes.key?(:'low_grade')
|
152
170
|
self.low_grade = attributes[:'low_grade']
|
153
171
|
end
|
154
172
|
|
155
|
-
if attributes.
|
173
|
+
if attributes.key?(:'mdr_number')
|
156
174
|
self.mdr_number = attributes[:'mdr_number']
|
157
175
|
end
|
158
176
|
|
159
|
-
if attributes.
|
177
|
+
if attributes.key?(:'name')
|
160
178
|
self.name = attributes[:'name']
|
161
179
|
end
|
162
180
|
|
163
|
-
if attributes.
|
181
|
+
if attributes.key?(:'nces_id')
|
164
182
|
self.nces_id = attributes[:'nces_id']
|
165
183
|
end
|
166
184
|
|
167
|
-
if attributes.
|
185
|
+
if attributes.key?(:'phone')
|
168
186
|
self.phone = attributes[:'phone']
|
169
187
|
end
|
170
188
|
|
171
|
-
if attributes.
|
189
|
+
if attributes.key?(:'principal')
|
172
190
|
self.principal = attributes[:'principal']
|
173
191
|
end
|
174
192
|
|
175
|
-
if attributes.
|
193
|
+
if attributes.key?(:'school_number')
|
176
194
|
self.school_number = attributes[:'school_number']
|
177
195
|
end
|
178
196
|
|
179
|
-
if attributes.
|
197
|
+
if attributes.key?(:'sis_id')
|
180
198
|
self.sis_id = attributes[:'sis_id']
|
181
199
|
end
|
182
200
|
|
183
|
-
if attributes.
|
201
|
+
if attributes.key?(:'state_id')
|
184
202
|
self.state_id = attributes[:'state_id']
|
185
203
|
end
|
186
204
|
end
|
@@ -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('
|
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('
|
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('
|
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,
|
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('
|
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,
|
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
|
@@ -252,17 +270,24 @@ module Clever
|
|
252
270
|
end
|
253
271
|
|
254
272
|
# Calculates hash code according to all attributes.
|
255
|
-
# @return [
|
273
|
+
# @return [Integer] Hash code
|
256
274
|
def hash
|
257
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
|
258
276
|
end
|
259
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)
|
283
|
+
end
|
284
|
+
|
260
285
|
# Builds the object from hash
|
261
286
|
# @param [Hash] attributes Model attributes in the form of hash
|
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.
|
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
|
-
|
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 :
|
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
|
-
|
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
|
-
|
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
|
@@ -6,8 +6,7 @@
|
|
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:
|
10
|
-
|
9
|
+
Swagger Codegen version: 3.0.51
|
11
10
|
=end
|
12
11
|
|
13
12
|
require 'date'
|
@@ -51,68 +50,83 @@ module Clever
|
|
51
50
|
end
|
52
51
|
|
53
52
|
# Attribute type mapping.
|
54
|
-
def self.
|
53
|
+
def self.openapi_types
|
55
54
|
{
|
56
|
-
:'credentials' => :'
|
57
|
-
:'department' => :'
|
58
|
-
:'district' => :'
|
59
|
-
:'email' => :'
|
55
|
+
:'credentials' => :'Object',
|
56
|
+
:'department' => :'Object',
|
57
|
+
:'district' => :'Object',
|
58
|
+
:'email' => :'Object',
|
60
59
|
:'ext' => :'Object',
|
61
|
-
:'id' => :'
|
62
|
-
:'name' => :'
|
63
|
-
:'schools' => :'
|
64
|
-
:'staff_id' => :'
|
65
|
-
:'title' => :'
|
60
|
+
:'id' => :'Object',
|
61
|
+
:'name' => :'Object',
|
62
|
+
:'schools' => :'Object',
|
63
|
+
:'staff_id' => :'Object',
|
64
|
+
:'title' => :'Object'
|
66
65
|
}
|
67
66
|
end
|
68
67
|
|
68
|
+
# List of attributes with nullable: true
|
69
|
+
def self.openapi_nullable
|
70
|
+
Set.new([
|
71
|
+
:'department',
|
72
|
+
:'title'
|
73
|
+
])
|
74
|
+
end
|
75
|
+
|
69
76
|
# Initializes the object
|
70
77
|
# @param [Hash] attributes Model attributes in the form of hash
|
71
78
|
def initialize(attributes = {})
|
72
|
-
|
79
|
+
if (!attributes.is_a?(Hash))
|
80
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::SchoolAdmin` initialize method"
|
81
|
+
end
|
73
82
|
|
74
|
-
# convert string to symbol for hash key
|
75
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
83
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
84
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
85
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
86
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::SchoolAdmin`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
87
|
+
end
|
88
|
+
h[k.to_sym] = v
|
89
|
+
}
|
76
90
|
|
77
|
-
if attributes.
|
91
|
+
if attributes.key?(:'credentials')
|
78
92
|
self.credentials = attributes[:'credentials']
|
79
93
|
end
|
80
94
|
|
81
|
-
if attributes.
|
95
|
+
if attributes.key?(:'department')
|
82
96
|
self.department = attributes[:'department']
|
83
97
|
end
|
84
98
|
|
85
|
-
if attributes.
|
99
|
+
if attributes.key?(:'district')
|
86
100
|
self.district = attributes[:'district']
|
87
101
|
end
|
88
102
|
|
89
|
-
if attributes.
|
103
|
+
if attributes.key?(:'email')
|
90
104
|
self.email = attributes[:'email']
|
91
105
|
end
|
92
106
|
|
93
|
-
if attributes.
|
107
|
+
if attributes.key?(:'ext')
|
94
108
|
self.ext = attributes[:'ext']
|
95
109
|
end
|
96
110
|
|
97
|
-
if attributes.
|
111
|
+
if attributes.key?(:'id')
|
98
112
|
self.id = attributes[:'id']
|
99
113
|
end
|
100
114
|
|
101
|
-
if attributes.
|
115
|
+
if attributes.key?(:'name')
|
102
116
|
self.name = attributes[:'name']
|
103
117
|
end
|
104
118
|
|
105
|
-
if attributes.
|
119
|
+
if attributes.key?(:'schools')
|
106
120
|
if (value = attributes[:'schools']).is_a?(Array)
|
107
121
|
self.schools = value
|
108
122
|
end
|
109
123
|
end
|
110
124
|
|
111
|
-
if attributes.
|
125
|
+
if attributes.key?(:'staff_id')
|
112
126
|
self.staff_id = attributes[:'staff_id']
|
113
127
|
end
|
114
128
|
|
115
|
-
if attributes.
|
129
|
+
if attributes.key?(:'title')
|
116
130
|
self.title = attributes[:'title']
|
117
131
|
end
|
118
132
|
end
|
@@ -154,17 +168,24 @@ module Clever
|
|
154
168
|
end
|
155
169
|
|
156
170
|
# Calculates hash code according to all attributes.
|
157
|
-
# @return [
|
171
|
+
# @return [Integer] Hash code
|
158
172
|
def hash
|
159
173
|
[credentials, department, district, email, ext, id, name, schools, staff_id, title].hash
|
160
174
|
end
|
161
175
|
|
176
|
+
# Builds the object from hash
|
177
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
178
|
+
# @return [Object] Returns the model itself
|
179
|
+
def self.build_from_hash(attributes)
|
180
|
+
new.build_from_hash(attributes)
|
181
|
+
end
|
182
|
+
|
162
183
|
# Builds the object from hash
|
163
184
|
# @param [Hash] attributes Model attributes in the form of hash
|
164
185
|
# @return [Object] Returns the model itself
|
165
186
|
def build_from_hash(attributes)
|
166
187
|
return nil unless attributes.is_a?(Hash)
|
167
|
-
self.class.
|
188
|
+
self.class.openapi_types.each_pair do |key, type|
|
168
189
|
if type =~ /\AArray<(.*)>/i
|
169
190
|
# check to ensure the input is an array given that the attribute
|
170
191
|
# is documented as an array but the input is not
|
@@ -173,7 +194,9 @@ module Clever
|
|
173
194
|
end
|
174
195
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
175
196
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
176
|
-
|
197
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
198
|
+
self.send("#{key}=", nil)
|
199
|
+
end
|
177
200
|
end
|
178
201
|
|
179
202
|
self
|
@@ -195,7 +218,7 @@ module Clever
|
|
195
218
|
value.to_i
|
196
219
|
when :Float
|
197
220
|
value.to_f
|
198
|
-
when :
|
221
|
+
when :Boolean
|
199
222
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
200
223
|
true
|
201
224
|
else
|
@@ -216,8 +239,7 @@ module Clever
|
|
216
239
|
end
|
217
240
|
end
|
218
241
|
else # model
|
219
|
-
|
220
|
-
temp_model.build_from_hash(value)
|
242
|
+
Clever.const_get(type).build_from_hash(value)
|
221
243
|
end
|
222
244
|
end
|
223
245
|
|
@@ -239,7 +261,11 @@ module Clever
|
|
239
261
|
hash = {}
|
240
262
|
self.class.attribute_map.each_pair do |attr, param|
|
241
263
|
value = self.send(attr)
|
242
|
-
|
264
|
+
if value.nil?
|
265
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
266
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
267
|
+
end
|
268
|
+
|
243
269
|
hash[param] = _to_hash(value)
|
244
270
|
end
|
245
271
|
hash
|
@@ -261,7 +287,5 @@ module Clever
|
|
261
287
|
else
|
262
288
|
value
|
263
289
|
end
|
264
|
-
end
|
265
|
-
|
266
|
-
end
|
290
|
+
end end
|
267
291
|
end
|
@@ -6,8 +6,7 @@
|
|
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:
|
10
|
-
|
9
|
+
Swagger Codegen version: 3.0.51
|
11
10
|
=end
|
12
11
|
|
13
12
|
require 'date'
|
@@ -24,21 +23,34 @@ module Clever
|
|
24
23
|
end
|
25
24
|
|
26
25
|
# Attribute type mapping.
|
27
|
-
def self.
|
26
|
+
def self.openapi_types
|
28
27
|
{
|
29
|
-
:'object' => :'
|
28
|
+
:'object' => :'Object'
|
30
29
|
}
|
31
30
|
end
|
32
31
|
|
32
|
+
# List of attributes with nullable: true
|
33
|
+
def self.openapi_nullable
|
34
|
+
Set.new([
|
35
|
+
])
|
36
|
+
end
|
37
|
+
|
33
38
|
# Initializes the object
|
34
39
|
# @param [Hash] attributes Model attributes in the form of hash
|
35
40
|
def initialize(attributes = {})
|
36
|
-
|
41
|
+
if (!attributes.is_a?(Hash))
|
42
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::SchoolAdminObject` initialize method"
|
43
|
+
end
|
37
44
|
|
38
|
-
# convert string to symbol for hash key
|
39
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
45
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
46
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
47
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
48
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::SchoolAdminObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
49
|
+
end
|
50
|
+
h[k.to_sym] = v
|
51
|
+
}
|
40
52
|
|
41
|
-
if attributes.
|
53
|
+
if attributes.key?(:'object')
|
42
54
|
self.object = attributes[:'object']
|
43
55
|
end
|
44
56
|
end
|
@@ -71,17 +83,24 @@ module Clever
|
|
71
83
|
end
|
72
84
|
|
73
85
|
# Calculates hash code according to all attributes.
|
74
|
-
# @return [
|
86
|
+
# @return [Integer] Hash code
|
75
87
|
def hash
|
76
88
|
[object].hash
|
77
89
|
end
|
78
90
|
|
91
|
+
# Builds the object from hash
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
93
|
+
# @return [Object] Returns the model itself
|
94
|
+
def self.build_from_hash(attributes)
|
95
|
+
new.build_from_hash(attributes)
|
96
|
+
end
|
97
|
+
|
79
98
|
# Builds the object from hash
|
80
99
|
# @param [Hash] attributes Model attributes in the form of hash
|
81
100
|
# @return [Object] Returns the model itself
|
82
101
|
def build_from_hash(attributes)
|
83
102
|
return nil unless attributes.is_a?(Hash)
|
84
|
-
self.class.
|
103
|
+
self.class.openapi_types.each_pair do |key, type|
|
85
104
|
if type =~ /\AArray<(.*)>/i
|
86
105
|
# check to ensure the input is an array given that the attribute
|
87
106
|
# is documented as an array but the input is not
|
@@ -90,7 +109,9 @@ module Clever
|
|
90
109
|
end
|
91
110
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
92
111
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
93
|
-
|
112
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
113
|
+
self.send("#{key}=", nil)
|
114
|
+
end
|
94
115
|
end
|
95
116
|
|
96
117
|
self
|
@@ -112,7 +133,7 @@ module Clever
|
|
112
133
|
value.to_i
|
113
134
|
when :Float
|
114
135
|
value.to_f
|
115
|
-
when :
|
136
|
+
when :Boolean
|
116
137
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
117
138
|
true
|
118
139
|
else
|
@@ -133,8 +154,7 @@ module Clever
|
|
133
154
|
end
|
134
155
|
end
|
135
156
|
else # model
|
136
|
-
|
137
|
-
temp_model.build_from_hash(value)
|
157
|
+
Clever.const_get(type).build_from_hash(value)
|
138
158
|
end
|
139
159
|
end
|
140
160
|
|
@@ -156,7 +176,11 @@ module Clever
|
|
156
176
|
hash = {}
|
157
177
|
self.class.attribute_map.each_pair do |attr, param|
|
158
178
|
value = self.send(attr)
|
159
|
-
|
179
|
+
if value.nil?
|
180
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
181
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
182
|
+
end
|
183
|
+
|
160
184
|
hash[param] = _to_hash(value)
|
161
185
|
end
|
162
186
|
hash
|
@@ -178,7 +202,5 @@ module Clever
|
|
178
202
|
else
|
179
203
|
value
|
180
204
|
end
|
181
|
-
end
|
182
|
-
|
183
|
-
end
|
205
|
+
end end
|
184
206
|
end
|