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

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