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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) 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/commonlit-clever-ruby-2.1.6.beta2.gem +0 -0
  8. data/docs/AdminName.md +0 -1
  9. data/docs/BadRequest.md +0 -1
  10. data/docs/Contact.md +1 -2
  11. data/docs/ContactObject.md +0 -1
  12. data/docs/ContactResponse.md +0 -1
  13. data/docs/ContactsCreated.md +2 -3
  14. data/docs/ContactsDeleted.md +2 -3
  15. data/docs/ContactsResponse.md +0 -1
  16. data/docs/ContactsUpdated.md +2 -3
  17. data/docs/Course.md +1 -2
  18. data/docs/CourseObject.md +0 -1
  19. data/docs/CourseResponse.md +0 -1
  20. data/docs/CoursesCreated.md +2 -3
  21. data/docs/CoursesDeleted.md +2 -3
  22. data/docs/CoursesResponse.md +0 -1
  23. data/docs/CoursesUpdated.md +2 -3
  24. data/docs/Credentials.md +0 -1
  25. data/docs/DataApi.md +2784 -0
  26. data/docs/District.md +9 -10
  27. data/docs/DistrictAdmin.md +2 -3
  28. data/docs/DistrictAdminObject.md +0 -1
  29. data/docs/DistrictAdminResponse.md +0 -1
  30. data/docs/DistrictAdminsResponse.md +0 -1
  31. data/docs/DistrictObject.md +0 -1
  32. data/docs/DistrictResponse.md +0 -1
  33. data/docs/DistrictadminsCreated.md +2 -3
  34. data/docs/DistrictadminsDeleted.md +2 -3
  35. data/docs/DistrictadminsUpdated.md +2 -3
  36. data/docs/DistrictsCreated.md +2 -3
  37. data/docs/DistrictsDeleted.md +2 -3
  38. data/docs/DistrictsResponse.md +0 -1
  39. data/docs/DistrictsUpdated.md +2 -3
  40. data/docs/Event.md +2 -3
  41. data/docs/EventResponse.md +0 -1
  42. data/docs/EventsApi.md +1 -4
  43. data/docs/EventsResponse.md +0 -1
  44. data/docs/InternalError.md +0 -1
  45. data/docs/Link.md +0 -1
  46. data/docs/Location.md +2 -3
  47. data/docs/Name.md +1 -2
  48. data/docs/NotFound.md +0 -1
  49. data/docs/Principal.md +1 -2
  50. data/docs/School.md +3 -4
  51. data/docs/SchoolAdmin.md +3 -4
  52. data/docs/SchoolAdminObject.md +0 -1
  53. data/docs/SchoolAdminResponse.md +0 -1
  54. data/docs/SchoolAdminsResponse.md +0 -1
  55. data/docs/SchoolEnrollment.md +1 -2
  56. data/docs/SchoolObject.md +0 -1
  57. data/docs/SchoolResponse.md +0 -1
  58. data/docs/SchooladminsCreated.md +2 -3
  59. data/docs/SchooladminsDeleted.md +2 -3
  60. data/docs/SchooladminsUpdated.md +2 -3
  61. data/docs/SchoolsCreated.md +2 -3
  62. data/docs/SchoolsDeleted.md +2 -3
  63. data/docs/SchoolsResponse.md +0 -1
  64. data/docs/SchoolsUpdated.md +2 -3
  65. data/docs/Section.md +2 -3
  66. data/docs/SectionObject.md +0 -1
  67. data/docs/SectionResponse.md +0 -1
  68. data/docs/SectionsCreated.md +2 -3
  69. data/docs/SectionsDeleted.md +2 -3
  70. data/docs/SectionsResponse.md +0 -1
  71. data/docs/SectionsUpdated.md +2 -3
  72. data/docs/Student.md +3 -4
  73. data/docs/StudentObject.md +0 -1
  74. data/docs/StudentResponse.md +0 -1
  75. data/docs/StudentsCreated.md +2 -3
  76. data/docs/StudentsDeleted.md +2 -3
  77. data/docs/StudentsResponse.md +0 -1
  78. data/docs/StudentsUpdated.md +2 -3
  79. data/docs/Teacher.md +2 -3
  80. data/docs/TeacherObject.md +0 -1
  81. data/docs/TeacherResponse.md +0 -1
  82. data/docs/TeachersCreated.md +2 -3
  83. data/docs/TeachersDeleted.md +2 -3
  84. data/docs/TeachersResponse.md +0 -1
  85. data/docs/TeachersUpdated.md +2 -3
  86. data/docs/Term.md +2 -3
  87. data/docs/TermObject.md +0 -1
  88. data/docs/TermResponse.md +0 -1
  89. data/docs/TermsCreated.md +2 -3
  90. data/docs/TermsDeleted.md +2 -3
  91. data/docs/TermsResponse.md +0 -1
  92. data/docs/TermsUpdated.md +2 -3
  93. data/git_push.sh +55 -0
  94. data/lib/clever-ruby/api/data_api.rb +2999 -0
  95. data/lib/clever-ruby/api/events_api.rb +25 -20
  96. data/lib/clever-ruby/api_error.rb +23 -4
  97. data/lib/clever-ruby/configuration.rb +5 -9
  98. data/lib/clever-ruby/models/admin_name.rb +46 -22
  99. data/lib/clever-ruby/models/bad_request.rb +42 -20
  100. data/lib/clever-ruby/models/contact.rb +83 -55
  101. data/lib/clever-ruby/models/contact_object.rb +42 -20
  102. data/lib/clever-ruby/models/contact_response.rb +42 -20
  103. data/lib/clever-ruby/models/contacts_response.rb +44 -22
  104. data/lib/clever-ruby/models/course.rb +60 -36
  105. data/lib/clever-ruby/models/course_object.rb +42 -20
  106. data/lib/clever-ruby/models/course_response.rb +42 -20
  107. data/lib/clever-ruby/models/courses_response.rb +44 -22
  108. data/lib/clever-ruby/models/credentials.rb +42 -20
  109. data/lib/clever-ruby/models/district.rb +122 -94
  110. data/lib/clever-ruby/models/district_admin.rb +67 -44
  111. data/lib/clever-ruby/models/district_admin_object.rb +42 -20
  112. data/lib/clever-ruby/models/district_admin_response.rb +42 -20
  113. data/lib/clever-ruby/models/district_admins_response.rb +44 -22
  114. data/lib/clever-ruby/models/district_object.rb +42 -20
  115. data/lib/clever-ruby/models/district_response.rb +42 -20
  116. data/lib/clever-ruby/models/districts_response.rb +44 -22
  117. data/lib/clever-ruby/models/event.rb +60 -33
  118. data/lib/clever-ruby/models/event_response.rb +42 -20
  119. data/lib/clever-ruby/models/events_response.rb +44 -22
  120. data/lib/clever-ruby/models/internal_error.rb +42 -20
  121. data/lib/clever-ruby/models/link.rb +47 -25
  122. data/lib/clever-ruby/models/location.rb +73 -45
  123. data/lib/clever-ruby/models/name.rb +58 -33
  124. data/lib/clever-ruby/models/not_found.rb +42 -20
  125. data/lib/clever-ruby/models/principal.rb +55 -31
  126. data/lib/clever-ruby/models/school.rb +108 -80
  127. data/lib/clever-ruby/models/school_admin.rb +85 -61
  128. data/lib/clever-ruby/models/school_admin_object.rb +42 -20
  129. data/lib/clever-ruby/models/school_admin_response.rb +42 -20
  130. data/lib/clever-ruby/models/school_admins_response.rb +44 -22
  131. data/lib/clever-ruby/models/school_enrollment.rb +56 -34
  132. data/lib/clever-ruby/models/school_object.rb +42 -20
  133. data/lib/clever-ruby/models/school_response.rb +42 -20
  134. data/lib/clever-ruby/models/schools_response.rb +44 -22
  135. data/lib/clever-ruby/models/section.rb +104 -75
  136. data/lib/clever-ruby/models/section_object.rb +42 -20
  137. data/lib/clever-ruby/models/section_response.rb +42 -20
  138. data/lib/clever-ruby/models/sections_response.rb +44 -22
  139. data/lib/clever-ruby/models/student.rb +147 -126
  140. data/lib/clever-ruby/models/student_object.rb +42 -20
  141. data/lib/clever-ruby/models/student_response.rb +42 -20
  142. data/lib/clever-ruby/models/students_response.rb +44 -22
  143. data/lib/clever-ruby/models/teacher.rb +89 -63
  144. data/lib/clever-ruby/models/teacher_object.rb +42 -20
  145. data/lib/clever-ruby/models/teacher_response.rb +42 -20
  146. data/lib/clever-ruby/models/teachers_response.rb +44 -22
  147. data/lib/clever-ruby/models/term.rb +69 -44
  148. data/lib/clever-ruby/models/term_object.rb +42 -20
  149. data/lib/clever-ruby/models/term_response.rb +42 -20
  150. data/lib/clever-ruby/models/terms_response.rb +44 -22
  151. data/lib/clever-ruby/version.rb +4 -5
  152. data/lib/clever-ruby.rb +4 -14
  153. data/override/README-extension.md +1 -1
  154. data/override/override.sh +3 -0
  155. data/spec/api/data_api_spec.rb +671 -0
  156. data/spec/api/events_api_spec.rb +4 -3
  157. data/spec/api_client_spec.rb +21 -3
  158. data/spec/spec_helper.rb +4 -3
  159. metadata +27 -180
  160. data/docs/ContactsApi.md +0 -231
  161. data/docs/CoursesApi.md +0 -231
  162. data/docs/DistrictAdminsApi.md +0 -171
  163. data/docs/DistrictsApi.md +0 -113
  164. data/docs/SchoolAdminsApi.md +0 -231
  165. data/docs/SchoolsApi.md +0 -351
  166. data/docs/SectionsApi.md +0 -499
  167. data/docs/StudentsApi.md +0 -463
  168. data/docs/TeachersApi.md +0 -403
  169. data/docs/TermsApi.md +0 -231
  170. data/lib/clever-ruby/api/contacts_api.rb +0 -241
  171. data/lib/clever-ruby/api/courses_api.rb +0 -241
  172. data/lib/clever-ruby/api/district_admins_api.rb +0 -182
  173. data/lib/clever-ruby/api/districts_api.rb +0 -123
  174. data/lib/clever-ruby/api/school_admins_api.rb +0 -241
  175. data/lib/clever-ruby/api/schools_api.rb +0 -359
  176. data/lib/clever-ruby/api/sections_api.rb +0 -500
  177. data/lib/clever-ruby/api/students_api.rb +0 -468
  178. data/lib/clever-ruby/api/teachers_api.rb +0 -409
  179. data/lib/clever-ruby/api/terms_api.rb +0 -241
  180. data/spec/api/contacts_api_spec.rb +0 -84
  181. data/spec/api/courses_api_spec.rb +0 -84
  182. data/spec/api/district_admins_api_spec.rb +0 -70
  183. data/spec/api/districts_api_spec.rb +0 -56
  184. data/spec/api/school_admins_api_spec.rb +0 -84
  185. data/spec/api/schools_api_spec.rb +0 -112
  186. data/spec/api/sections_api_spec.rb +0 -142
  187. data/spec/api/students_api_spec.rb +0 -137
  188. data/spec/api/teachers_api_spec.rb +0 -123
  189. data/spec/api/terms_api_spec.rb +0 -84
@@ -1,21 +1,18 @@
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 Teacher
17
- attr_accessor :id
18
-
19
16
  attr_accessor :created
20
17
 
21
18
  attr_accessor :credentials
@@ -24,6 +21,10 @@ module Clever
24
21
 
25
22
  attr_accessor :email
26
23
 
24
+ attr_accessor :ext
25
+
26
+ attr_accessor :id
27
+
27
28
  attr_accessor :last_modified
28
29
 
29
30
  attr_accessor :name
@@ -40,16 +41,15 @@ module Clever
40
41
 
41
42
  attr_accessor :title
42
43
 
43
- attr_accessor :ext
44
-
45
44
  # Attribute mapping from ruby-style variable name to JSON key.
46
45
  def self.attribute_map
47
46
  {
48
- :'id' => :'id',
49
47
  :'created' => :'created',
50
48
  :'credentials' => :'credentials',
51
49
  :'district' => :'district',
52
50
  :'email' => :'email',
51
+ :'ext' => :'ext',
52
+ :'id' => :'id',
53
53
  :'last_modified' => :'last_modified',
54
54
  :'name' => :'name',
55
55
  :'school' => :'school',
@@ -57,96 +57,112 @@ module Clever
57
57
  :'sis_id' => :'sis_id',
58
58
  :'state_id' => :'state_id',
59
59
  :'teacher_number' => :'teacher_number',
60
- :'title' => :'title',
61
- :'ext' => :'ext'
60
+ :'title' => :'title'
62
61
  }
63
62
  end
64
63
 
65
64
  # Attribute type mapping.
66
- def self.swagger_types
65
+ def self.openapi_types
67
66
  {
68
- :'id' => :'String',
69
- :'created' => :'String',
70
- :'credentials' => :'Credentials',
71
- :'district' => :'String',
72
- :'email' => :'String',
73
- :'last_modified' => :'String',
74
- :'name' => :'Name',
75
- :'school' => :'String',
76
- :'schools' => :'Array<String>',
77
- :'sis_id' => :'String',
78
- :'state_id' => :'String',
79
- :'teacher_number' => :'String',
80
- :'title' => :'String',
81
- :'ext' => :'Object'
67
+ :'created' => :'Object',
68
+ :'credentials' => :'Object',
69
+ :'district' => :'Object',
70
+ :'email' => :'Object',
71
+ :'ext' => :'Object',
72
+ :'id' => :'Object',
73
+ :'last_modified' => :'Object',
74
+ :'name' => :'Object',
75
+ :'school' => :'Object',
76
+ :'schools' => :'Object',
77
+ :'sis_id' => :'Object',
78
+ :'state_id' => :'Object',
79
+ :'teacher_number' => :'Object',
80
+ :'title' => :'Object'
82
81
  }
83
82
  end
84
83
 
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ :'email',
88
+ :'state_id',
89
+ :'teacher_number',
90
+ :'title'
91
+ ])
92
+ end
93
+
85
94
  # Initializes the object
86
95
  # @param [Hash] attributes Model attributes in the form of hash
87
96
  def initialize(attributes = {})
88
- return unless attributes.is_a?(Hash)
89
-
90
- # convert string to symbol for hash key
91
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
92
-
93
- if attributes.has_key?(:'id')
94
- self.id = attributes[:'id']
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::Teacher` initialize method"
95
99
  end
96
100
 
97
- if attributes.has_key?(:'created')
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ attributes = attributes.each_with_object({}) { |(k, v), h|
103
+ if (!self.class.attribute_map.key?(k.to_sym))
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::Teacher`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
105
+ end
106
+ h[k.to_sym] = v
107
+ }
108
+
109
+ if attributes.key?(:'created')
98
110
  self.created = attributes[:'created']
99
111
  end
100
112
 
101
- if attributes.has_key?(:'credentials')
113
+ if attributes.key?(:'credentials')
102
114
  self.credentials = attributes[:'credentials']
103
115
  end
104
116
 
105
- if attributes.has_key?(:'district')
117
+ if attributes.key?(:'district')
106
118
  self.district = attributes[:'district']
107
119
  end
108
120
 
109
- if attributes.has_key?(:'email')
121
+ if attributes.key?(:'email')
110
122
  self.email = attributes[:'email']
111
123
  end
112
124
 
113
- if attributes.has_key?(:'last_modified')
125
+ if attributes.key?(:'ext')
126
+ self.ext = attributes[:'ext']
127
+ end
128
+
129
+ if attributes.key?(:'id')
130
+ self.id = attributes[:'id']
131
+ end
132
+
133
+ if attributes.key?(:'last_modified')
114
134
  self.last_modified = attributes[:'last_modified']
115
135
  end
116
136
 
117
- if attributes.has_key?(:'name')
137
+ if attributes.key?(:'name')
118
138
  self.name = attributes[:'name']
119
139
  end
120
140
 
121
- if attributes.has_key?(:'school')
141
+ if attributes.key?(:'school')
122
142
  self.school = attributes[:'school']
123
143
  end
124
144
 
125
- if attributes.has_key?(:'schools')
145
+ if attributes.key?(:'schools')
126
146
  if (value = attributes[:'schools']).is_a?(Array)
127
147
  self.schools = value
128
148
  end
129
149
  end
130
150
 
131
- if attributes.has_key?(:'sis_id')
151
+ if attributes.key?(:'sis_id')
132
152
  self.sis_id = attributes[:'sis_id']
133
153
  end
134
154
 
135
- if attributes.has_key?(:'state_id')
155
+ if attributes.key?(:'state_id')
136
156
  self.state_id = attributes[:'state_id']
137
157
  end
138
158
 
139
- if attributes.has_key?(:'teacher_number')
159
+ if attributes.key?(:'teacher_number')
140
160
  self.teacher_number = attributes[:'teacher_number']
141
161
  end
142
162
 
143
- if attributes.has_key?(:'title')
163
+ if attributes.key?(:'title')
144
164
  self.title = attributes[:'title']
145
165
  end
146
-
147
- if attributes.has_key?(:'ext')
148
- self.ext = attributes[:'ext']
149
- end
150
166
  end
151
167
 
152
168
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -167,11 +183,12 @@ module Clever
167
183
  def ==(o)
168
184
  return true if self.equal?(o)
169
185
  self.class == o.class &&
170
- id == o.id &&
171
186
  created == o.created &&
172
187
  credentials == o.credentials &&
173
188
  district == o.district &&
174
189
  email == o.email &&
190
+ ext == o.ext &&
191
+ id == o.id &&
175
192
  last_modified == o.last_modified &&
176
193
  name == o.name &&
177
194
  school == o.school &&
@@ -179,8 +196,7 @@ module Clever
179
196
  sis_id == o.sis_id &&
180
197
  state_id == o.state_id &&
181
198
  teacher_number == o.teacher_number &&
182
- title == o.title &&
183
- ext == o.ext
199
+ title == o.title
184
200
  end
185
201
 
186
202
  # @see the `==` method
@@ -190,9 +206,16 @@ module Clever
190
206
  end
191
207
 
192
208
  # Calculates hash code according to all attributes.
193
- # @return [Fixnum] Hash code
209
+ # @return [Integer] Hash code
194
210
  def hash
195
- [id, created, credentials, district, email, last_modified, name, school, schools, sis_id, state_id, teacher_number, title, ext].hash
211
+ [created, credentials, district, email, ext, id, last_modified, name, school, schools, sis_id, state_id, teacher_number, title].hash
212
+ end
213
+
214
+ # Builds the object from hash
215
+ # @param [Hash] attributes Model attributes in the form of hash
216
+ # @return [Object] Returns the model itself
217
+ def self.build_from_hash(attributes)
218
+ new.build_from_hash(attributes)
196
219
  end
197
220
 
198
221
  # Builds the object from hash
@@ -200,7 +223,7 @@ module Clever
200
223
  # @return [Object] Returns the model itself
201
224
  def build_from_hash(attributes)
202
225
  return nil unless attributes.is_a?(Hash)
203
- self.class.swagger_types.each_pair do |key, type|
226
+ self.class.openapi_types.each_pair do |key, type|
204
227
  if type =~ /\AArray<(.*)>/i
205
228
  # check to ensure the input is an array given that the attribute
206
229
  # is documented as an array but the input is not
@@ -209,7 +232,9 @@ module Clever
209
232
  end
210
233
  elsif !attributes[self.class.attribute_map[key]].nil?
211
234
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
212
- end # or else data not found in attributes(hash), not an issue as the data can be optional
235
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
236
+ self.send("#{key}=", nil)
237
+ end
213
238
  end
214
239
 
215
240
  self
@@ -231,7 +256,7 @@ module Clever
231
256
  value.to_i
232
257
  when :Float
233
258
  value.to_f
234
- when :BOOLEAN
259
+ when :Boolean
235
260
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
236
261
  true
237
262
  else
@@ -252,8 +277,7 @@ module Clever
252
277
  end
253
278
  end
254
279
  else # model
255
- temp_model = Clever.const_get(type).new
256
- temp_model.build_from_hash(value)
280
+ Clever.const_get(type).build_from_hash(value)
257
281
  end
258
282
  end
259
283
 
@@ -275,7 +299,11 @@ module Clever
275
299
  hash = {}
276
300
  self.class.attribute_map.each_pair do |attr, param|
277
301
  value = self.send(attr)
278
- next if value.nil?
302
+ if value.nil?
303
+ is_nullable = self.class.openapi_nullable.include?(attr)
304
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
305
+ end
306
+
279
307
  hash[param] = _to_hash(value)
280
308
  end
281
309
  hash
@@ -297,7 +325,5 @@ module Clever
297
325
  else
298
326
  value
299
327
  end
300
- end
301
-
302
- end
328
+ end end
303
329
  end
@@ -1,13 +1,12 @@
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'
@@ -24,21 +23,34 @@ module Clever
24
23
  end
25
24
 
26
25
  # Attribute type mapping.
27
- def self.swagger_types
26
+ def self.openapi_types
28
27
  {
29
- :'object' => :'Teacher'
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
- return unless attributes.is_a?(Hash)
41
+ if (!attributes.is_a?(Hash))
42
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::TeacherObject` initialize method"
43
+ end
37
44
 
38
- # convert string to symbol for hash key
39
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
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::TeacherObject`. 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.has_key?(:'object')
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 [Fixnum] Hash code
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.swagger_types.each_pair do |key, type|
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
- end # or else data not found in attributes(hash), not an issue as the data can be optional
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 :BOOLEAN
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
- temp_model = Clever.const_get(type).new
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
- next if value.nil?
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
@@ -1,13 +1,12 @@
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'
@@ -24,21 +23,34 @@ module Clever
24
23
  end
25
24
 
26
25
  # Attribute type mapping.
27
- def self.swagger_types
26
+ def self.openapi_types
28
27
  {
29
- :'data' => :'Teacher'
28
+ :'data' => :'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
- return unless attributes.is_a?(Hash)
41
+ if (!attributes.is_a?(Hash))
42
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::TeacherResponse` initialize method"
43
+ end
37
44
 
38
- # convert string to symbol for hash key
39
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
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::TeacherResponse`. 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.has_key?(:'data')
53
+ if attributes.key?(:'data')
42
54
  self.data = attributes[:'data']
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 [Fixnum] Hash code
86
+ # @return [Integer] Hash code
75
87
  def hash
76
88
  [data].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.swagger_types.each_pair do |key, type|
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
- end # or else data not found in attributes(hash), not an issue as the data can be optional
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 :BOOLEAN
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
- temp_model = Clever.const_get(type).new
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
- next if value.nil?
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