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,25 +1,24 @@
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 Contact
17
- attr_accessor :id
18
-
19
16
  attr_accessor :district
20
17
 
21
18
  attr_accessor :email
22
19
 
20
+ attr_accessor :id
21
+
23
22
  attr_accessor :name
24
23
 
25
24
  attr_accessor :phone
@@ -59,9 +58,9 @@ module Clever
59
58
  # Attribute mapping from ruby-style variable name to JSON key.
60
59
  def self.attribute_map
61
60
  {
62
- :'id' => :'id',
63
61
  :'district' => :'district',
64
62
  :'email' => :'email',
63
+ :'id' => :'id',
65
64
  :'name' => :'name',
66
65
  :'phone' => :'phone',
67
66
  :'phone_type' => :'phone_type',
@@ -73,68 +72,87 @@ module Clever
73
72
  end
74
73
 
75
74
  # Attribute type mapping.
76
- def self.swagger_types
75
+ def self.openapi_types
77
76
  {
78
- :'id' => :'String',
79
- :'district' => :'String',
80
- :'email' => :'String',
81
- :'name' => :'String',
82
- :'phone' => :'String',
83
- :'phone_type' => :'String',
84
- :'relationship' => :'String',
85
- :'sis_id' => :'String',
86
- :'students' => :'Array<String>',
87
- :'type' => :'String'
77
+ :'district' => :'Object',
78
+ :'email' => :'Object',
79
+ :'id' => :'Object',
80
+ :'name' => :'Object',
81
+ :'phone' => :'Object',
82
+ :'phone_type' => :'Object',
83
+ :'relationship' => :'Object',
84
+ :'sis_id' => :'Object',
85
+ :'students' => :'Object',
86
+ :'type' => :'Object'
88
87
  }
89
88
  end
90
89
 
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ :'email',
94
+ :'phone',
95
+ :'phone_type',
96
+ :'relationship',
97
+ :'sis_id',
98
+ :'type'
99
+ ])
100
+ end
101
+
91
102
  # Initializes the object
92
103
  # @param [Hash] attributes Model attributes in the form of hash
93
104
  def initialize(attributes = {})
94
- return unless attributes.is_a?(Hash)
95
-
96
- # convert string to symbol for hash key
97
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
98
-
99
- if attributes.has_key?(:'id')
100
- self.id = attributes[:'id']
105
+ if (!attributes.is_a?(Hash))
106
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::Contact` initialize method"
101
107
  end
102
108
 
103
- if attributes.has_key?(:'district')
109
+ # check to see if the attribute exists and convert string to symbol for hash key
110
+ attributes = attributes.each_with_object({}) { |(k, v), h|
111
+ if (!self.class.attribute_map.key?(k.to_sym))
112
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::Contact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
113
+ end
114
+ h[k.to_sym] = v
115
+ }
116
+
117
+ if attributes.key?(:'district')
104
118
  self.district = attributes[:'district']
105
119
  end
106
120
 
107
- if attributes.has_key?(:'email')
121
+ if attributes.key?(:'email')
108
122
  self.email = attributes[:'email']
109
123
  end
110
124
 
111
- if attributes.has_key?(:'name')
125
+ if attributes.key?(:'id')
126
+ self.id = attributes[:'id']
127
+ end
128
+
129
+ if attributes.key?(:'name')
112
130
  self.name = attributes[:'name']
113
131
  end
114
132
 
115
- if attributes.has_key?(:'phone')
133
+ if attributes.key?(:'phone')
116
134
  self.phone = attributes[:'phone']
117
135
  end
118
136
 
119
- if attributes.has_key?(:'phone_type')
137
+ if attributes.key?(:'phone_type')
120
138
  self.phone_type = attributes[:'phone_type']
121
139
  end
122
140
 
123
- if attributes.has_key?(:'relationship')
141
+ if attributes.key?(:'relationship')
124
142
  self.relationship = attributes[:'relationship']
125
143
  end
126
144
 
127
- if attributes.has_key?(:'sis_id')
145
+ if attributes.key?(:'sis_id')
128
146
  self.sis_id = attributes[:'sis_id']
129
147
  end
130
148
 
131
- if attributes.has_key?(:'students')
149
+ if attributes.key?(:'students')
132
150
  if (value = attributes[:'students']).is_a?(Array)
133
151
  self.students = value
134
152
  end
135
153
  end
136
154
 
137
- if attributes.has_key?(:'type')
155
+ if attributes.key?(:'type')
138
156
  self.type = attributes[:'type']
139
157
  end
140
158
  end
@@ -149,11 +167,11 @@ module Clever
149
167
  # Check to see if the all the properties in the model are valid
150
168
  # @return true if the model is valid
151
169
  def valid?
152
- phone_type_validator = EnumAttributeValidator.new('String', ['Cell', 'Home', 'Work', 'Other', ''])
170
+ phone_type_validator = EnumAttributeValidator.new('Object', ['Cell', 'Home', 'Work', 'Other', ''])
153
171
  return false unless phone_type_validator.valid?(@phone_type)
154
- relationship_validator = EnumAttributeValidator.new('String', ['Parent', 'Grandparent', 'Self', 'Aunt/Uncle', 'Sibling', 'Other', ''])
172
+ relationship_validator = EnumAttributeValidator.new('Object', ['Parent', 'Grandparent', 'Self', 'Aunt/Uncle', 'Sibling', 'Other', ''])
155
173
  return false unless relationship_validator.valid?(@relationship)
156
- type_validator = EnumAttributeValidator.new('String', ['Parent/Guardian', 'Emergency', 'Primary', 'Secondary', 'Family', 'Other', ''])
174
+ type_validator = EnumAttributeValidator.new('Object', ['Parent/Guardian', 'Emergency', 'Primary', 'Secondary', 'Family', 'Other', ''])
157
175
  return false unless type_validator.valid?(@type)
158
176
  true
159
177
  end
@@ -161,9 +179,9 @@ module Clever
161
179
  # Custom attribute writer method checking allowed values (enum).
162
180
  # @param [Object] phone_type Object to be assigned
163
181
  def phone_type=(phone_type)
164
- validator = EnumAttributeValidator.new('String', ['Cell', 'Home', 'Work', 'Other', ''])
182
+ validator = EnumAttributeValidator.new('Object', ['Cell', 'Home', 'Work', 'Other', ''])
165
183
  unless validator.valid?(phone_type)
166
- fail ArgumentError, 'invalid value for "phone_type", must be one of #{validator.allowable_values}.'
184
+ fail ArgumentError, "invalid value for \"phone_type\", must be one of #{validator.allowable_values}."
167
185
  end
168
186
  @phone_type = phone_type
169
187
  end
@@ -171,9 +189,9 @@ module Clever
171
189
  # Custom attribute writer method checking allowed values (enum).
172
190
  # @param [Object] relationship Object to be assigned
173
191
  def relationship=(relationship)
174
- validator = EnumAttributeValidator.new('String', ['Parent', 'Grandparent', 'Self', 'Aunt/Uncle', 'Sibling', 'Other', ''])
192
+ validator = EnumAttributeValidator.new('Object', ['Parent', 'Grandparent', 'Self', 'Aunt/Uncle', 'Sibling', 'Other', ''])
175
193
  unless validator.valid?(relationship)
176
- fail ArgumentError, 'invalid value for "relationship", must be one of #{validator.allowable_values}.'
194
+ fail ArgumentError, "invalid value for \"relationship\", must be one of #{validator.allowable_values}."
177
195
  end
178
196
  @relationship = relationship
179
197
  end
@@ -181,9 +199,9 @@ module Clever
181
199
  # Custom attribute writer method checking allowed values (enum).
182
200
  # @param [Object] type Object to be assigned
183
201
  def type=(type)
184
- validator = EnumAttributeValidator.new('String', ['Parent/Guardian', 'Emergency', 'Primary', 'Secondary', 'Family', 'Other', ''])
202
+ validator = EnumAttributeValidator.new('Object', ['Parent/Guardian', 'Emergency', 'Primary', 'Secondary', 'Family', 'Other', ''])
185
203
  unless validator.valid?(type)
186
- fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
204
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
187
205
  end
188
206
  @type = type
189
207
  end
@@ -193,9 +211,9 @@ module Clever
193
211
  def ==(o)
194
212
  return true if self.equal?(o)
195
213
  self.class == o.class &&
196
- id == o.id &&
197
214
  district == o.district &&
198
215
  email == o.email &&
216
+ id == o.id &&
199
217
  name == o.name &&
200
218
  phone == o.phone &&
201
219
  phone_type == o.phone_type &&
@@ -212,9 +230,16 @@ module Clever
212
230
  end
213
231
 
214
232
  # Calculates hash code according to all attributes.
215
- # @return [Fixnum] Hash code
233
+ # @return [Integer] Hash code
216
234
  def hash
217
- [id, district, email, name, phone, phone_type, relationship, sis_id, students, type].hash
235
+ [district, email, id, name, phone, phone_type, relationship, sis_id, students, type].hash
236
+ end
237
+
238
+ # Builds the object from hash
239
+ # @param [Hash] attributes Model attributes in the form of hash
240
+ # @return [Object] Returns the model itself
241
+ def self.build_from_hash(attributes)
242
+ new.build_from_hash(attributes)
218
243
  end
219
244
 
220
245
  # Builds the object from hash
@@ -222,7 +247,7 @@ module Clever
222
247
  # @return [Object] Returns the model itself
223
248
  def build_from_hash(attributes)
224
249
  return nil unless attributes.is_a?(Hash)
225
- self.class.swagger_types.each_pair do |key, type|
250
+ self.class.openapi_types.each_pair do |key, type|
226
251
  if type =~ /\AArray<(.*)>/i
227
252
  # check to ensure the input is an array given that the attribute
228
253
  # is documented as an array but the input is not
@@ -231,7 +256,9 @@ module Clever
231
256
  end
232
257
  elsif !attributes[self.class.attribute_map[key]].nil?
233
258
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
234
- end # or else data not found in attributes(hash), not an issue as the data can be optional
259
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
260
+ self.send("#{key}=", nil)
261
+ end
235
262
  end
236
263
 
237
264
  self
@@ -253,7 +280,7 @@ module Clever
253
280
  value.to_i
254
281
  when :Float
255
282
  value.to_f
256
- when :BOOLEAN
283
+ when :Boolean
257
284
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
258
285
  true
259
286
  else
@@ -274,8 +301,7 @@ module Clever
274
301
  end
275
302
  end
276
303
  else # model
277
- temp_model = Clever.const_get(type).new
278
- temp_model.build_from_hash(value)
304
+ Clever.const_get(type).build_from_hash(value)
279
305
  end
280
306
  end
281
307
 
@@ -297,7 +323,11 @@ module Clever
297
323
  hash = {}
298
324
  self.class.attribute_map.each_pair do |attr, param|
299
325
  value = self.send(attr)
300
- next if value.nil?
326
+ if value.nil?
327
+ is_nullable = self.class.openapi_nullable.include?(attr)
328
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
329
+ end
330
+
301
331
  hash[param] = _to_hash(value)
302
332
  end
303
333
  hash
@@ -319,7 +349,5 @@ module Clever
319
349
  else
320
350
  value
321
351
  end
322
- end
323
-
324
- end
352
+ end end
325
353
  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' => :'Contact'
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::ContactObject` 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::ContactObject`. 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' => :'Contact'
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::ContactResponse` 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::ContactResponse`. 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