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.
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'
@@ -33,36 +32,51 @@ module Clever
33
32
  end
34
33
 
35
34
  # Attribute type mapping.
36
- def self.swagger_types
35
+ def self.openapi_types
37
36
  {
38
- :'district' => :'String',
39
- :'id' => :'String',
40
- :'name' => :'String',
41
- :'number' => :'String'
37
+ :'district' => :'Object',
38
+ :'id' => :'Object',
39
+ :'name' => :'Object',
40
+ :'number' => :'Object'
42
41
  }
43
42
  end
44
43
 
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ :'name',
48
+ :'number'
49
+ ])
50
+ end
51
+
45
52
  # Initializes the object
46
53
  # @param [Hash] attributes Model attributes in the form of hash
47
54
  def initialize(attributes = {})
48
- return unless attributes.is_a?(Hash)
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::Course` initialize method"
57
+ end
49
58
 
50
- # convert string to symbol for hash key
51
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::Course`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
52
66
 
53
- if attributes.has_key?(:'district')
67
+ if attributes.key?(:'district')
54
68
  self.district = attributes[:'district']
55
69
  end
56
70
 
57
- if attributes.has_key?(:'id')
71
+ if attributes.key?(:'id')
58
72
  self.id = attributes[:'id']
59
73
  end
60
74
 
61
- if attributes.has_key?(:'name')
75
+ if attributes.key?(:'name')
62
76
  self.name = attributes[:'name']
63
77
  end
64
78
 
65
- if attributes.has_key?(:'number')
79
+ if attributes.key?(:'number')
66
80
  self.number = attributes[:'number']
67
81
  end
68
82
  end
@@ -98,17 +112,24 @@ module Clever
98
112
  end
99
113
 
100
114
  # Calculates hash code according to all attributes.
101
- # @return [Fixnum] Hash code
115
+ # @return [Integer] Hash code
102
116
  def hash
103
117
  [district, id, name, number].hash
104
118
  end
105
119
 
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
125
+ end
126
+
106
127
  # Builds the object from hash
107
128
  # @param [Hash] attributes Model attributes in the form of hash
108
129
  # @return [Object] Returns the model itself
109
130
  def build_from_hash(attributes)
110
131
  return nil unless attributes.is_a?(Hash)
111
- self.class.swagger_types.each_pair do |key, type|
132
+ self.class.openapi_types.each_pair do |key, type|
112
133
  if type =~ /\AArray<(.*)>/i
113
134
  # check to ensure the input is an array given that the attribute
114
135
  # is documented as an array but the input is not
@@ -117,7 +138,9 @@ module Clever
117
138
  end
118
139
  elsif !attributes[self.class.attribute_map[key]].nil?
119
140
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
- end # or else data not found in attributes(hash), not an issue as the data can be optional
141
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
142
+ self.send("#{key}=", nil)
143
+ end
121
144
  end
122
145
 
123
146
  self
@@ -139,7 +162,7 @@ module Clever
139
162
  value.to_i
140
163
  when :Float
141
164
  value.to_f
142
- when :BOOLEAN
165
+ when :Boolean
143
166
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
167
  true
145
168
  else
@@ -160,8 +183,7 @@ module Clever
160
183
  end
161
184
  end
162
185
  else # model
163
- temp_model = Clever.const_get(type).new
164
- temp_model.build_from_hash(value)
186
+ Clever.const_get(type).build_from_hash(value)
165
187
  end
166
188
  end
167
189
 
@@ -183,7 +205,11 @@ module Clever
183
205
  hash = {}
184
206
  self.class.attribute_map.each_pair do |attr, param|
185
207
  value = self.send(attr)
186
- next if value.nil?
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
187
213
  hash[param] = _to_hash(value)
188
214
  end
189
215
  hash
@@ -205,7 +231,5 @@ module Clever
205
231
  else
206
232
  value
207
233
  end
208
- end
209
-
210
- end
234
+ end end
211
235
  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' => :'Course'
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::CourseObject` 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::CourseObject`. 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' => :'Course'
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::CourseResponse` 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::CourseResponse`. 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
@@ -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'
@@ -27,28 +26,41 @@ module Clever
27
26
  end
28
27
 
29
28
  # Attribute type mapping.
30
- def self.swagger_types
29
+ def self.openapi_types
31
30
  {
32
- :'data' => :'Array<CourseResponse>',
33
- :'links' => :'Array<Link>'
31
+ :'data' => :'Object',
32
+ :'links' => :'Object'
34
33
  }
35
34
  end
36
35
 
36
+ # List of attributes with nullable: true
37
+ def self.openapi_nullable
38
+ Set.new([
39
+ ])
40
+ end
41
+
37
42
  # Initializes the object
38
43
  # @param [Hash] attributes Model attributes in the form of hash
39
44
  def initialize(attributes = {})
40
- return unless attributes.is_a?(Hash)
45
+ if (!attributes.is_a?(Hash))
46
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::CoursesResponse` initialize method"
47
+ end
41
48
 
42
- # convert string to symbol for hash key
43
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
49
+ # check to see if the attribute exists and convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h|
51
+ if (!self.class.attribute_map.key?(k.to_sym))
52
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::CoursesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
+ end
54
+ h[k.to_sym] = v
55
+ }
44
56
 
45
- if attributes.has_key?(:'data')
57
+ if attributes.key?(:'data')
46
58
  if (value = attributes[:'data']).is_a?(Array)
47
59
  self.data = value
48
60
  end
49
61
  end
50
62
 
51
- if attributes.has_key?(:'links')
63
+ if attributes.key?(:'links')
52
64
  if (value = attributes[:'links']).is_a?(Array)
53
65
  self.links = value
54
66
  end
@@ -84,17 +96,24 @@ module Clever
84
96
  end
85
97
 
86
98
  # Calculates hash code according to all attributes.
87
- # @return [Fixnum] Hash code
99
+ # @return [Integer] Hash code
88
100
  def hash
89
101
  [data, links].hash
90
102
  end
91
103
 
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ new.build_from_hash(attributes)
109
+ end
110
+
92
111
  # Builds the object from hash
93
112
  # @param [Hash] attributes Model attributes in the form of hash
94
113
  # @return [Object] Returns the model itself
95
114
  def build_from_hash(attributes)
96
115
  return nil unless attributes.is_a?(Hash)
97
- self.class.swagger_types.each_pair do |key, type|
116
+ self.class.openapi_types.each_pair do |key, type|
98
117
  if type =~ /\AArray<(.*)>/i
99
118
  # check to ensure the input is an array given that the attribute
100
119
  # is documented as an array but the input is not
@@ -103,7 +122,9 @@ module Clever
103
122
  end
104
123
  elsif !attributes[self.class.attribute_map[key]].nil?
105
124
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
106
- end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
126
+ self.send("#{key}=", nil)
127
+ end
107
128
  end
108
129
 
109
130
  self
@@ -125,7 +146,7 @@ module Clever
125
146
  value.to_i
126
147
  when :Float
127
148
  value.to_f
128
- when :BOOLEAN
149
+ when :Boolean
129
150
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
130
151
  true
131
152
  else
@@ -146,8 +167,7 @@ module Clever
146
167
  end
147
168
  end
148
169
  else # model
149
- temp_model = Clever.const_get(type).new
150
- temp_model.build_from_hash(value)
170
+ Clever.const_get(type).build_from_hash(value)
151
171
  end
152
172
  end
153
173
 
@@ -169,7 +189,11 @@ module Clever
169
189
  hash = {}
170
190
  self.class.attribute_map.each_pair do |attr, param|
171
191
  value = self.send(attr)
172
- next if value.nil?
192
+ if value.nil?
193
+ is_nullable = self.class.openapi_nullable.include?(attr)
194
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
+ end
196
+
173
197
  hash[param] = _to_hash(value)
174
198
  end
175
199
  hash
@@ -191,7 +215,5 @@ module Clever
191
215
  else
192
216
  value
193
217
  end
194
- end
195
-
196
- end
218
+ end end
197
219
  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
- :'district_username' => :'String'
28
+ :'district_username' => :'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::Credentials` 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::Credentials`. 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?(:'district_username')
53
+ if attributes.key?(:'district_username')
42
54
  self.district_username = attributes[:'district_username']
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
  [district_username].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