commonlit-clever-ruby 2.1.4 → 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 (164) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +46 -41
  4. data/Makefile +1 -1
  5. data/README.md +943 -11
  6. data/clever-ruby.gemspec +3 -10
  7. data/commonlit-clever-ruby-2.1.6.beta1.gem +0 -0
  8. data/docs/AdminName.md +0 -1
  9. data/docs/BadRequest.md +0 -1
  10. data/docs/Contact.md +0 -1
  11. data/docs/ContactObject.md +0 -1
  12. data/docs/ContactResponse.md +0 -1
  13. data/docs/ContactsCreated.md +0 -1
  14. data/docs/ContactsDeleted.md +0 -1
  15. data/docs/ContactsResponse.md +0 -1
  16. data/docs/ContactsUpdated.md +0 -1
  17. data/docs/Course.md +0 -1
  18. data/docs/CourseObject.md +0 -1
  19. data/docs/CourseResponse.md +0 -1
  20. data/docs/CoursesCreated.md +0 -1
  21. data/docs/CoursesDeleted.md +0 -1
  22. data/docs/CoursesResponse.md +0 -1
  23. data/docs/CoursesUpdated.md +0 -1
  24. data/docs/Credentials.md +0 -1
  25. data/docs/DataApi.md +1 -69
  26. data/docs/District.md +0 -1
  27. data/docs/DistrictAdmin.md +0 -1
  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 +0 -1
  34. data/docs/DistrictadminsDeleted.md +0 -1
  35. data/docs/DistrictadminsUpdated.md +0 -1
  36. data/docs/DistrictsCreated.md +0 -1
  37. data/docs/DistrictsDeleted.md +0 -1
  38. data/docs/DistrictsResponse.md +0 -1
  39. data/docs/DistrictsUpdated.md +0 -1
  40. data/docs/Event.md +0 -1
  41. data/docs/EventResponse.md +0 -1
  42. data/docs/EventsApi.md +0 -3
  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 +0 -1
  47. data/docs/Name.md +0 -1
  48. data/docs/NotFound.md +0 -1
  49. data/docs/Principal.md +0 -1
  50. data/docs/School.md +0 -1
  51. data/docs/SchoolAdmin.md +0 -1
  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 +0 -1
  56. data/docs/SchoolObject.md +0 -1
  57. data/docs/SchoolResponse.md +0 -1
  58. data/docs/SchooladminsCreated.md +0 -1
  59. data/docs/SchooladminsDeleted.md +0 -1
  60. data/docs/SchooladminsUpdated.md +0 -1
  61. data/docs/SchoolsCreated.md +0 -1
  62. data/docs/SchoolsDeleted.md +0 -1
  63. data/docs/SchoolsResponse.md +0 -1
  64. data/docs/SchoolsUpdated.md +0 -1
  65. data/docs/Section.md +0 -1
  66. data/docs/SectionObject.md +0 -1
  67. data/docs/SectionResponse.md +0 -1
  68. data/docs/SectionsCreated.md +0 -1
  69. data/docs/SectionsDeleted.md +0 -1
  70. data/docs/SectionsResponse.md +0 -1
  71. data/docs/SectionsUpdated.md +0 -1
  72. data/docs/Student.md +0 -1
  73. data/docs/StudentObject.md +0 -1
  74. data/docs/StudentResponse.md +0 -1
  75. data/docs/StudentsCreated.md +0 -1
  76. data/docs/StudentsDeleted.md +0 -1
  77. data/docs/StudentsResponse.md +0 -1
  78. data/docs/StudentsUpdated.md +0 -1
  79. data/docs/Teacher.md +0 -1
  80. data/docs/TeacherObject.md +0 -1
  81. data/docs/TeacherResponse.md +0 -1
  82. data/docs/TeachersCreated.md +0 -1
  83. data/docs/TeachersDeleted.md +0 -1
  84. data/docs/TeachersResponse.md +0 -1
  85. data/docs/TeachersUpdated.md +0 -1
  86. data/docs/Term.md +0 -1
  87. data/docs/TermObject.md +0 -1
  88. data/docs/TermResponse.md +0 -1
  89. data/docs/TermsCreated.md +0 -1
  90. data/docs/TermsDeleted.md +0 -1
  91. data/docs/TermsResponse.md +0 -1
  92. data/docs/TermsUpdated.md +0 -1
  93. data/full-v2.yml +2541 -0
  94. data/lib/clever-ruby/api/data_api.rb +836 -635
  95. data/lib/clever-ruby/api/events_api.rb +23 -18
  96. data/lib/clever-ruby/api_client.rb +1 -0
  97. data/lib/clever-ruby/api_error.rb +21 -2
  98. data/lib/clever-ruby/configuration.rb +3 -7
  99. data/lib/clever-ruby/models/admin_name.rb +44 -20
  100. data/lib/clever-ruby/models/bad_request.rb +40 -18
  101. data/lib/clever-ruby/models/contact.rb +73 -45
  102. data/lib/clever-ruby/models/contact_object.rb +40 -18
  103. data/lib/clever-ruby/models/contact_response.rb +40 -18
  104. data/lib/clever-ruby/models/contacts_response.rb +42 -20
  105. data/lib/clever-ruby/models/course.rb +48 -24
  106. data/lib/clever-ruby/models/course_object.rb +40 -18
  107. data/lib/clever-ruby/models/course_response.rb +40 -18
  108. data/lib/clever-ruby/models/courses_response.rb +42 -20
  109. data/lib/clever-ruby/models/credentials.rb +40 -18
  110. data/lib/clever-ruby/models/district.rb +75 -47
  111. data/lib/clever-ruby/models/district_admin.rb +49 -26
  112. data/lib/clever-ruby/models/district_admin_object.rb +40 -18
  113. data/lib/clever-ruby/models/district_admin_response.rb +40 -18
  114. data/lib/clever-ruby/models/district_admins_response.rb +42 -20
  115. data/lib/clever-ruby/models/district_object.rb +40 -18
  116. data/lib/clever-ruby/models/district_response.rb +40 -18
  117. data/lib/clever-ruby/models/districts_response.rb +42 -20
  118. data/lib/clever-ruby/models/event.rb +49 -22
  119. data/lib/clever-ruby/models/event_response.rb +40 -18
  120. data/lib/clever-ruby/models/events_response.rb +42 -20
  121. data/lib/clever-ruby/models/internal_error.rb +40 -18
  122. data/lib/clever-ruby/models/link.rb +45 -23
  123. data/lib/clever-ruby/models/location.rb +56 -28
  124. data/lib/clever-ruby/models/name.rb +47 -22
  125. data/lib/clever-ruby/models/not_found.rb +40 -18
  126. data/lib/clever-ruby/models/principal.rb +44 -20
  127. data/lib/clever-ruby/models/school.rb +81 -53
  128. data/lib/clever-ruby/models/school_admin.rb +59 -35
  129. data/lib/clever-ruby/models/school_admin_object.rb +40 -18
  130. data/lib/clever-ruby/models/school_admin_response.rb +40 -18
  131. data/lib/clever-ruby/models/school_admins_response.rb +42 -20
  132. data/lib/clever-ruby/models/school_enrollment.rb +44 -22
  133. data/lib/clever-ruby/models/school_object.rb +40 -18
  134. data/lib/clever-ruby/models/school_response.rb +40 -18
  135. data/lib/clever-ruby/models/schools_response.rb +42 -20
  136. data/lib/clever-ruby/models/section.rb +84 -55
  137. data/lib/clever-ruby/models/section_object.rb +40 -18
  138. data/lib/clever-ruby/models/section_response.rb +40 -18
  139. data/lib/clever-ruby/models/sections_response.rb +42 -20
  140. data/lib/clever-ruby/models/student.rb +121 -100
  141. data/lib/clever-ruby/models/student_object.rb +40 -18
  142. data/lib/clever-ruby/models/student_response.rb +40 -18
  143. data/lib/clever-ruby/models/students_response.rb +42 -20
  144. data/lib/clever-ruby/models/teacher.rb +69 -43
  145. data/lib/clever-ruby/models/teacher_object.rb +40 -18
  146. data/lib/clever-ruby/models/teacher_response.rb +40 -18
  147. data/lib/clever-ruby/models/teachers_response.rb +42 -20
  148. data/lib/clever-ruby/models/term.rb +51 -26
  149. data/lib/clever-ruby/models/term_object.rb +40 -18
  150. data/lib/clever-ruby/models/term_response.rb +40 -18
  151. data/lib/clever-ruby/models/terms_response.rb +42 -20
  152. data/lib/clever-ruby/version.rb +2 -3
  153. data/lib/clever-ruby.rb +1 -2
  154. data/override/README-extension.md +4 -5
  155. data/override/api_client.rb +1 -0
  156. data/override/override.sh +7 -5
  157. data/spec/api/data_api_spec.rb +671 -0
  158. data/spec/api/events_api_spec.rb +61 -0
  159. data/spec/api_client_spec.rb +243 -0
  160. data/spec/spec_helper.rb +26 -18
  161. metadata +34 -150
  162. data/commonlit-clever-ruby-2.1.3.gem +0 -0
  163. data/spec/events.json +0 -227
  164. 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: 2.4.18
10
-
9
+ Swagger Codegen version: 3.0.51
11
10
  =end
12
11
 
13
12
  require 'date'
@@ -85,88 +84,107 @@ module Clever
85
84
  end
86
85
 
87
86
  # Attribute type mapping.
88
- def self.swagger_types
87
+ def self.openapi_types
89
88
  {
90
- :'district_contact' => :'DistrictAdmin',
91
- :'error' => :'String',
92
- :'id' => :'String',
93
- :'last_sync' => :'String',
94
- :'launch_date' => :'String',
95
- :'login_methods' => :'Array<String>',
96
- :'mdr_number' => :'String',
97
- :'name' => :'String',
98
- :'nces_id' => :'String',
99
- :'pause_end' => :'String',
100
- :'pause_start' => :'String',
101
- :'portal_url' => :'String',
102
- :'sis_type' => :'String',
103
- :'state' => :'String'
89
+ :'district_contact' => :'Object',
90
+ :'error' => :'Object',
91
+ :'id' => :'Object',
92
+ :'last_sync' => :'Object',
93
+ :'launch_date' => :'Object',
94
+ :'login_methods' => :'Object',
95
+ :'mdr_number' => :'Object',
96
+ :'name' => :'Object',
97
+ :'nces_id' => :'Object',
98
+ :'pause_end' => :'Object',
99
+ :'pause_start' => :'Object',
100
+ :'portal_url' => :'Object',
101
+ :'sis_type' => :'Object',
102
+ :'state' => :'Object'
104
103
  }
105
104
  end
106
105
 
106
+ # List of attributes with nullable: true
107
+ def self.openapi_nullable
108
+ Set.new([
109
+ :'last_sync',
110
+ :'mdr_number',
111
+ :'nces_id',
112
+ :'pause_end',
113
+ :'pause_start',
114
+ :'state'
115
+ ])
116
+ end
117
+
107
118
  # Initializes the object
108
119
  # @param [Hash] attributes Model attributes in the form of hash
109
120
  def initialize(attributes = {})
110
- return unless attributes.is_a?(Hash)
121
+ if (!attributes.is_a?(Hash))
122
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::District` initialize method"
123
+ end
111
124
 
112
- # convert string to symbol for hash key
113
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
125
+ # check to see if the attribute exists and convert string to symbol for hash key
126
+ attributes = attributes.each_with_object({}) { |(k, v), h|
127
+ if (!self.class.attribute_map.key?(k.to_sym))
128
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::District`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
129
+ end
130
+ h[k.to_sym] = v
131
+ }
114
132
 
115
- if attributes.has_key?(:'district_contact')
133
+ if attributes.key?(:'district_contact')
116
134
  self.district_contact = attributes[:'district_contact']
117
135
  end
118
136
 
119
- if attributes.has_key?(:'error')
137
+ if attributes.key?(:'error')
120
138
  self.error = attributes[:'error']
121
139
  end
122
140
 
123
- if attributes.has_key?(:'id')
141
+ if attributes.key?(:'id')
124
142
  self.id = attributes[:'id']
125
143
  end
126
144
 
127
- if attributes.has_key?(:'last_sync')
145
+ if attributes.key?(:'last_sync')
128
146
  self.last_sync = attributes[:'last_sync']
129
147
  end
130
148
 
131
- if attributes.has_key?(:'launch_date')
149
+ if attributes.key?(:'launch_date')
132
150
  self.launch_date = attributes[:'launch_date']
133
151
  end
134
152
 
135
- if attributes.has_key?(:'login_methods')
153
+ if attributes.key?(:'login_methods')
136
154
  if (value = attributes[:'login_methods']).is_a?(Array)
137
155
  self.login_methods = value
138
156
  end
139
157
  end
140
158
 
141
- if attributes.has_key?(:'mdr_number')
159
+ if attributes.key?(:'mdr_number')
142
160
  self.mdr_number = attributes[:'mdr_number']
143
161
  end
144
162
 
145
- if attributes.has_key?(:'name')
163
+ if attributes.key?(:'name')
146
164
  self.name = attributes[:'name']
147
165
  end
148
166
 
149
- if attributes.has_key?(:'nces_id')
167
+ if attributes.key?(:'nces_id')
150
168
  self.nces_id = attributes[:'nces_id']
151
169
  end
152
170
 
153
- if attributes.has_key?(:'pause_end')
171
+ if attributes.key?(:'pause_end')
154
172
  self.pause_end = attributes[:'pause_end']
155
173
  end
156
174
 
157
- if attributes.has_key?(:'pause_start')
175
+ if attributes.key?(:'pause_start')
158
176
  self.pause_start = attributes[:'pause_start']
159
177
  end
160
178
 
161
- if attributes.has_key?(:'portal_url')
179
+ if attributes.key?(:'portal_url')
162
180
  self.portal_url = attributes[:'portal_url']
163
181
  end
164
182
 
165
- if attributes.has_key?(:'sis_type')
183
+ if attributes.key?(:'sis_type')
166
184
  self.sis_type = attributes[:'sis_type']
167
185
  end
168
186
 
169
- if attributes.has_key?(:'state')
187
+ if attributes.key?(:'state')
170
188
  self.state = attributes[:'state']
171
189
  end
172
190
  end
@@ -181,7 +199,7 @@ module Clever
181
199
  # Check to see if the all the properties in the model are valid
182
200
  # @return true if the model is valid
183
201
  def valid?
184
- state_validator = EnumAttributeValidator.new('String', ['running', 'pending', 'error', 'paused', '', 'success'])
202
+ state_validator = EnumAttributeValidator.new('Object', ['running', 'pending', 'error', 'paused', '', 'success'])
185
203
  return false unless state_validator.valid?(@state)
186
204
  true
187
205
  end
@@ -189,9 +207,9 @@ module Clever
189
207
  # Custom attribute writer method checking allowed values (enum).
190
208
  # @param [Object] state Object to be assigned
191
209
  def state=(state)
192
- validator = EnumAttributeValidator.new('String', ['running', 'pending', 'error', 'paused', '', 'success'])
210
+ validator = EnumAttributeValidator.new('Object', ['running', 'pending', 'error', 'paused', '', 'success'])
193
211
  unless validator.valid?(state)
194
- fail ArgumentError, 'invalid value for "state", must be one of #{validator.allowable_values}.'
212
+ fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
195
213
  end
196
214
  @state = state
197
215
  end
@@ -224,17 +242,24 @@ module Clever
224
242
  end
225
243
 
226
244
  # Calculates hash code according to all attributes.
227
- # @return [Fixnum] Hash code
245
+ # @return [Integer] Hash code
228
246
  def hash
229
247
  [district_contact, error, id, last_sync, launch_date, login_methods, mdr_number, name, nces_id, pause_end, pause_start, portal_url, sis_type, state].hash
230
248
  end
231
249
 
250
+ # Builds the object from hash
251
+ # @param [Hash] attributes Model attributes in the form of hash
252
+ # @return [Object] Returns the model itself
253
+ def self.build_from_hash(attributes)
254
+ new.build_from_hash(attributes)
255
+ end
256
+
232
257
  # Builds the object from hash
233
258
  # @param [Hash] attributes Model attributes in the form of hash
234
259
  # @return [Object] Returns the model itself
235
260
  def build_from_hash(attributes)
236
261
  return nil unless attributes.is_a?(Hash)
237
- self.class.swagger_types.each_pair do |key, type|
262
+ self.class.openapi_types.each_pair do |key, type|
238
263
  if type =~ /\AArray<(.*)>/i
239
264
  # check to ensure the input is an array given that the attribute
240
265
  # is documented as an array but the input is not
@@ -243,7 +268,9 @@ module Clever
243
268
  end
244
269
  elsif !attributes[self.class.attribute_map[key]].nil?
245
270
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
246
- end # or else data not found in attributes(hash), not an issue as the data can be optional
271
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
272
+ self.send("#{key}=", nil)
273
+ end
247
274
  end
248
275
 
249
276
  self
@@ -265,7 +292,7 @@ module Clever
265
292
  value.to_i
266
293
  when :Float
267
294
  value.to_f
268
- when :BOOLEAN
295
+ when :Boolean
269
296
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
270
297
  true
271
298
  else
@@ -286,8 +313,7 @@ module Clever
286
313
  end
287
314
  end
288
315
  else # model
289
- temp_model = Clever.const_get(type).new
290
- temp_model.build_from_hash(value)
316
+ Clever.const_get(type).build_from_hash(value)
291
317
  end
292
318
  end
293
319
 
@@ -309,7 +335,11 @@ module Clever
309
335
  hash = {}
310
336
  self.class.attribute_map.each_pair do |attr, param|
311
337
  value = self.send(attr)
312
- next if value.nil?
338
+ if value.nil?
339
+ is_nullable = self.class.openapi_nullable.include?(attr)
340
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
341
+ end
342
+
313
343
  hash[param] = _to_hash(value)
314
344
  end
315
345
  hash
@@ -331,7 +361,5 @@ module Clever
331
361
  else
332
362
  value
333
363
  end
334
- end
335
-
336
- end
364
+ end end
337
365
  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: 2.4.18
10
-
9
+ Swagger Codegen version: 3.0.51
11
10
  =end
12
11
 
13
12
  require 'date'
@@ -36,41 +35,55 @@ module Clever
36
35
  end
37
36
 
38
37
  # Attribute type mapping.
39
- def self.swagger_types
38
+ def self.openapi_types
40
39
  {
41
- :'district' => :'String',
42
- :'email' => :'String',
43
- :'id' => :'String',
44
- :'name' => :'AdminName',
45
- :'title' => :'String'
40
+ :'district' => :'Object',
41
+ :'email' => :'Object',
42
+ :'id' => :'Object',
43
+ :'name' => :'Object',
44
+ :'title' => :'Object'
46
45
  }
47
46
  end
48
47
 
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ :'title'
52
+ ])
53
+ end
54
+
49
55
  # Initializes the object
50
56
  # @param [Hash] attributes Model attributes in the form of hash
51
57
  def initialize(attributes = {})
52
- return unless attributes.is_a?(Hash)
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::DistrictAdmin` initialize method"
60
+ end
53
61
 
54
- # convert string to symbol for hash key
55
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::DistrictAdmin`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
56
69
 
57
- if attributes.has_key?(:'district')
70
+ if attributes.key?(:'district')
58
71
  self.district = attributes[:'district']
59
72
  end
60
73
 
61
- if attributes.has_key?(:'email')
74
+ if attributes.key?(:'email')
62
75
  self.email = attributes[:'email']
63
76
  end
64
77
 
65
- if attributes.has_key?(:'id')
78
+ if attributes.key?(:'id')
66
79
  self.id = attributes[:'id']
67
80
  end
68
81
 
69
- if attributes.has_key?(:'name')
82
+ if attributes.key?(:'name')
70
83
  self.name = attributes[:'name']
71
84
  end
72
85
 
73
- if attributes.has_key?(:'title')
86
+ if attributes.key?(:'title')
74
87
  self.title = attributes[:'title']
75
88
  end
76
89
  end
@@ -107,17 +120,24 @@ module Clever
107
120
  end
108
121
 
109
122
  # Calculates hash code according to all attributes.
110
- # @return [Fixnum] Hash code
123
+ # @return [Integer] Hash code
111
124
  def hash
112
125
  [district, email, id, name, title].hash
113
126
  end
114
127
 
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def self.build_from_hash(attributes)
132
+ new.build_from_hash(attributes)
133
+ end
134
+
115
135
  # Builds the object from hash
116
136
  # @param [Hash] attributes Model attributes in the form of hash
117
137
  # @return [Object] Returns the model itself
118
138
  def build_from_hash(attributes)
119
139
  return nil unless attributes.is_a?(Hash)
120
- self.class.swagger_types.each_pair do |key, type|
140
+ self.class.openapi_types.each_pair do |key, type|
121
141
  if type =~ /\AArray<(.*)>/i
122
142
  # check to ensure the input is an array given that the attribute
123
143
  # is documented as an array but the input is not
@@ -126,7 +146,9 @@ module Clever
126
146
  end
127
147
  elsif !attributes[self.class.attribute_map[key]].nil?
128
148
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
129
- end # or else data not found in attributes(hash), not an issue as the data can be optional
149
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
150
+ self.send("#{key}=", nil)
151
+ end
130
152
  end
131
153
 
132
154
  self
@@ -148,7 +170,7 @@ module Clever
148
170
  value.to_i
149
171
  when :Float
150
172
  value.to_f
151
- when :BOOLEAN
173
+ when :Boolean
152
174
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
153
175
  true
154
176
  else
@@ -169,8 +191,7 @@ module Clever
169
191
  end
170
192
  end
171
193
  else # model
172
- temp_model = Clever.const_get(type).new
173
- temp_model.build_from_hash(value)
194
+ Clever.const_get(type).build_from_hash(value)
174
195
  end
175
196
  end
176
197
 
@@ -192,7 +213,11 @@ module Clever
192
213
  hash = {}
193
214
  self.class.attribute_map.each_pair do |attr, param|
194
215
  value = self.send(attr)
195
- next if value.nil?
216
+ if value.nil?
217
+ is_nullable = self.class.openapi_nullable.include?(attr)
218
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
219
+ end
220
+
196
221
  hash[param] = _to_hash(value)
197
222
  end
198
223
  hash
@@ -214,7 +239,5 @@ module Clever
214
239
  else
215
240
  value
216
241
  end
217
- end
218
-
219
- end
242
+ end end
220
243
  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: 2.4.18
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' => :'DistrictAdmin'
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::DistrictAdminObject` 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::DistrictAdminObject`. 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
@@ -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: 2.4.18
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' => :'DistrictAdmin'
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::DistrictAdminResponse` 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::DistrictAdminResponse`. 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