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.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +46 -41
- data/Makefile +1 -1
- data/README.md +943 -11
- data/clever-ruby.gemspec +3 -10
- data/commonlit-clever-ruby-2.1.6.beta1.gem +0 -0
- data/docs/AdminName.md +0 -1
- data/docs/BadRequest.md +0 -1
- data/docs/Contact.md +0 -1
- data/docs/ContactObject.md +0 -1
- data/docs/ContactResponse.md +0 -1
- data/docs/ContactsCreated.md +0 -1
- data/docs/ContactsDeleted.md +0 -1
- data/docs/ContactsResponse.md +0 -1
- data/docs/ContactsUpdated.md +0 -1
- data/docs/Course.md +0 -1
- data/docs/CourseObject.md +0 -1
- data/docs/CourseResponse.md +0 -1
- data/docs/CoursesCreated.md +0 -1
- data/docs/CoursesDeleted.md +0 -1
- data/docs/CoursesResponse.md +0 -1
- data/docs/CoursesUpdated.md +0 -1
- data/docs/Credentials.md +0 -1
- data/docs/DataApi.md +1 -69
- data/docs/District.md +0 -1
- data/docs/DistrictAdmin.md +0 -1
- data/docs/DistrictAdminObject.md +0 -1
- data/docs/DistrictAdminResponse.md +0 -1
- data/docs/DistrictAdminsResponse.md +0 -1
- data/docs/DistrictObject.md +0 -1
- data/docs/DistrictResponse.md +0 -1
- data/docs/DistrictadminsCreated.md +0 -1
- data/docs/DistrictadminsDeleted.md +0 -1
- data/docs/DistrictadminsUpdated.md +0 -1
- data/docs/DistrictsCreated.md +0 -1
- data/docs/DistrictsDeleted.md +0 -1
- data/docs/DistrictsResponse.md +0 -1
- data/docs/DistrictsUpdated.md +0 -1
- data/docs/Event.md +0 -1
- data/docs/EventResponse.md +0 -1
- data/docs/EventsApi.md +0 -3
- data/docs/EventsResponse.md +0 -1
- data/docs/InternalError.md +0 -1
- data/docs/Link.md +0 -1
- data/docs/Location.md +0 -1
- data/docs/Name.md +0 -1
- data/docs/NotFound.md +0 -1
- data/docs/Principal.md +0 -1
- data/docs/School.md +0 -1
- data/docs/SchoolAdmin.md +0 -1
- data/docs/SchoolAdminObject.md +0 -1
- data/docs/SchoolAdminResponse.md +0 -1
- data/docs/SchoolAdminsResponse.md +0 -1
- data/docs/SchoolEnrollment.md +0 -1
- data/docs/SchoolObject.md +0 -1
- data/docs/SchoolResponse.md +0 -1
- data/docs/SchooladminsCreated.md +0 -1
- data/docs/SchooladminsDeleted.md +0 -1
- data/docs/SchooladminsUpdated.md +0 -1
- data/docs/SchoolsCreated.md +0 -1
- data/docs/SchoolsDeleted.md +0 -1
- data/docs/SchoolsResponse.md +0 -1
- data/docs/SchoolsUpdated.md +0 -1
- data/docs/Section.md +0 -1
- data/docs/SectionObject.md +0 -1
- data/docs/SectionResponse.md +0 -1
- data/docs/SectionsCreated.md +0 -1
- data/docs/SectionsDeleted.md +0 -1
- data/docs/SectionsResponse.md +0 -1
- data/docs/SectionsUpdated.md +0 -1
- data/docs/Student.md +0 -1
- data/docs/StudentObject.md +0 -1
- data/docs/StudentResponse.md +0 -1
- data/docs/StudentsCreated.md +0 -1
- data/docs/StudentsDeleted.md +0 -1
- data/docs/StudentsResponse.md +0 -1
- data/docs/StudentsUpdated.md +0 -1
- data/docs/Teacher.md +0 -1
- data/docs/TeacherObject.md +0 -1
- data/docs/TeacherResponse.md +0 -1
- data/docs/TeachersCreated.md +0 -1
- data/docs/TeachersDeleted.md +0 -1
- data/docs/TeachersResponse.md +0 -1
- data/docs/TeachersUpdated.md +0 -1
- data/docs/Term.md +0 -1
- data/docs/TermObject.md +0 -1
- data/docs/TermResponse.md +0 -1
- data/docs/TermsCreated.md +0 -1
- data/docs/TermsDeleted.md +0 -1
- data/docs/TermsResponse.md +0 -1
- data/docs/TermsUpdated.md +0 -1
- data/full-v2.yml +2541 -0
- data/lib/clever-ruby/api/data_api.rb +836 -635
- data/lib/clever-ruby/api/events_api.rb +23 -18
- data/lib/clever-ruby/api_client.rb +1 -0
- data/lib/clever-ruby/api_error.rb +21 -2
- data/lib/clever-ruby/configuration.rb +3 -7
- data/lib/clever-ruby/models/admin_name.rb +44 -20
- data/lib/clever-ruby/models/bad_request.rb +40 -18
- data/lib/clever-ruby/models/contact.rb +73 -45
- data/lib/clever-ruby/models/contact_object.rb +40 -18
- data/lib/clever-ruby/models/contact_response.rb +40 -18
- data/lib/clever-ruby/models/contacts_response.rb +42 -20
- data/lib/clever-ruby/models/course.rb +48 -24
- data/lib/clever-ruby/models/course_object.rb +40 -18
- data/lib/clever-ruby/models/course_response.rb +40 -18
- data/lib/clever-ruby/models/courses_response.rb +42 -20
- data/lib/clever-ruby/models/credentials.rb +40 -18
- data/lib/clever-ruby/models/district.rb +75 -47
- data/lib/clever-ruby/models/district_admin.rb +49 -26
- data/lib/clever-ruby/models/district_admin_object.rb +40 -18
- data/lib/clever-ruby/models/district_admin_response.rb +40 -18
- data/lib/clever-ruby/models/district_admins_response.rb +42 -20
- data/lib/clever-ruby/models/district_object.rb +40 -18
- data/lib/clever-ruby/models/district_response.rb +40 -18
- data/lib/clever-ruby/models/districts_response.rb +42 -20
- data/lib/clever-ruby/models/event.rb +49 -22
- data/lib/clever-ruby/models/event_response.rb +40 -18
- data/lib/clever-ruby/models/events_response.rb +42 -20
- data/lib/clever-ruby/models/internal_error.rb +40 -18
- data/lib/clever-ruby/models/link.rb +45 -23
- data/lib/clever-ruby/models/location.rb +56 -28
- data/lib/clever-ruby/models/name.rb +47 -22
- data/lib/clever-ruby/models/not_found.rb +40 -18
- data/lib/clever-ruby/models/principal.rb +44 -20
- data/lib/clever-ruby/models/school.rb +81 -53
- data/lib/clever-ruby/models/school_admin.rb +59 -35
- data/lib/clever-ruby/models/school_admin_object.rb +40 -18
- data/lib/clever-ruby/models/school_admin_response.rb +40 -18
- data/lib/clever-ruby/models/school_admins_response.rb +42 -20
- data/lib/clever-ruby/models/school_enrollment.rb +44 -22
- data/lib/clever-ruby/models/school_object.rb +40 -18
- data/lib/clever-ruby/models/school_response.rb +40 -18
- data/lib/clever-ruby/models/schools_response.rb +42 -20
- data/lib/clever-ruby/models/section.rb +84 -55
- data/lib/clever-ruby/models/section_object.rb +40 -18
- data/lib/clever-ruby/models/section_response.rb +40 -18
- data/lib/clever-ruby/models/sections_response.rb +42 -20
- data/lib/clever-ruby/models/student.rb +121 -100
- data/lib/clever-ruby/models/student_object.rb +40 -18
- data/lib/clever-ruby/models/student_response.rb +40 -18
- data/lib/clever-ruby/models/students_response.rb +42 -20
- data/lib/clever-ruby/models/teacher.rb +69 -43
- data/lib/clever-ruby/models/teacher_object.rb +40 -18
- data/lib/clever-ruby/models/teacher_response.rb +40 -18
- data/lib/clever-ruby/models/teachers_response.rb +42 -20
- data/lib/clever-ruby/models/term.rb +51 -26
- data/lib/clever-ruby/models/term_object.rb +40 -18
- data/lib/clever-ruby/models/term_response.rb +40 -18
- data/lib/clever-ruby/models/terms_response.rb +42 -20
- data/lib/clever-ruby/version.rb +2 -3
- data/lib/clever-ruby.rb +1 -2
- data/override/README-extension.md +4 -5
- data/override/api_client.rb +1 -0
- data/override/override.sh +7 -5
- data/spec/api/data_api_spec.rb +671 -0
- data/spec/api/events_api_spec.rb +61 -0
- data/spec/api_client_spec.rb +243 -0
- data/spec/spec_helper.rb +26 -18
- metadata +34 -150
- data/commonlit-clever-ruby-2.1.3.gem +0 -0
- data/spec/events.json +0 -227
- 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:
|
|
10
|
-
|
|
9
|
+
Swagger Codegen version: 3.0.51
|
|
11
10
|
=end
|
|
12
11
|
|
|
13
12
|
require 'date'
|
|
@@ -39,46 +38,65 @@ module Clever
|
|
|
39
38
|
end
|
|
40
39
|
|
|
41
40
|
# Attribute type mapping.
|
|
42
|
-
def self.
|
|
41
|
+
def self.openapi_types
|
|
43
42
|
{
|
|
44
|
-
:'address' => :'
|
|
45
|
-
:'city' => :'
|
|
46
|
-
:'lat' => :'
|
|
47
|
-
:'lon' => :'
|
|
48
|
-
:'state' => :'
|
|
49
|
-
:'zip' => :'
|
|
43
|
+
:'address' => :'Object',
|
|
44
|
+
:'city' => :'Object',
|
|
45
|
+
:'lat' => :'Object',
|
|
46
|
+
:'lon' => :'Object',
|
|
47
|
+
:'state' => :'Object',
|
|
48
|
+
:'zip' => :'Object'
|
|
50
49
|
}
|
|
51
50
|
end
|
|
52
51
|
|
|
52
|
+
# List of attributes with nullable: true
|
|
53
|
+
def self.openapi_nullable
|
|
54
|
+
Set.new([
|
|
55
|
+
:'address',
|
|
56
|
+
:'city',
|
|
57
|
+
:'lat',
|
|
58
|
+
:'lon',
|
|
59
|
+
:'state',
|
|
60
|
+
:'zip'
|
|
61
|
+
])
|
|
62
|
+
end
|
|
63
|
+
|
|
53
64
|
# Initializes the object
|
|
54
65
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
55
66
|
def initialize(attributes = {})
|
|
56
|
-
|
|
67
|
+
if (!attributes.is_a?(Hash))
|
|
68
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::Location` initialize method"
|
|
69
|
+
end
|
|
57
70
|
|
|
58
|
-
# convert string to symbol for hash key
|
|
59
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
71
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
72
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
73
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
74
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::Location`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
75
|
+
end
|
|
76
|
+
h[k.to_sym] = v
|
|
77
|
+
}
|
|
60
78
|
|
|
61
|
-
if attributes.
|
|
79
|
+
if attributes.key?(:'address')
|
|
62
80
|
self.address = attributes[:'address']
|
|
63
81
|
end
|
|
64
82
|
|
|
65
|
-
if attributes.
|
|
83
|
+
if attributes.key?(:'city')
|
|
66
84
|
self.city = attributes[:'city']
|
|
67
85
|
end
|
|
68
86
|
|
|
69
|
-
if attributes.
|
|
87
|
+
if attributes.key?(:'lat')
|
|
70
88
|
self.lat = attributes[:'lat']
|
|
71
89
|
end
|
|
72
90
|
|
|
73
|
-
if attributes.
|
|
91
|
+
if attributes.key?(:'lon')
|
|
74
92
|
self.lon = attributes[:'lon']
|
|
75
93
|
end
|
|
76
94
|
|
|
77
|
-
if attributes.
|
|
95
|
+
if attributes.key?(:'state')
|
|
78
96
|
self.state = attributes[:'state']
|
|
79
97
|
end
|
|
80
98
|
|
|
81
|
-
if attributes.
|
|
99
|
+
if attributes.key?(:'zip')
|
|
82
100
|
self.zip = attributes[:'zip']
|
|
83
101
|
end
|
|
84
102
|
end
|
|
@@ -116,17 +134,24 @@ module Clever
|
|
|
116
134
|
end
|
|
117
135
|
|
|
118
136
|
# Calculates hash code according to all attributes.
|
|
119
|
-
# @return [
|
|
137
|
+
# @return [Integer] Hash code
|
|
120
138
|
def hash
|
|
121
139
|
[address, city, lat, lon, state, zip].hash
|
|
122
140
|
end
|
|
123
141
|
|
|
142
|
+
# Builds the object from hash
|
|
143
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
144
|
+
# @return [Object] Returns the model itself
|
|
145
|
+
def self.build_from_hash(attributes)
|
|
146
|
+
new.build_from_hash(attributes)
|
|
147
|
+
end
|
|
148
|
+
|
|
124
149
|
# Builds the object from hash
|
|
125
150
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
126
151
|
# @return [Object] Returns the model itself
|
|
127
152
|
def build_from_hash(attributes)
|
|
128
153
|
return nil unless attributes.is_a?(Hash)
|
|
129
|
-
self.class.
|
|
154
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
130
155
|
if type =~ /\AArray<(.*)>/i
|
|
131
156
|
# check to ensure the input is an array given that the attribute
|
|
132
157
|
# is documented as an array but the input is not
|
|
@@ -135,7 +160,9 @@ module Clever
|
|
|
135
160
|
end
|
|
136
161
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
137
162
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
138
|
-
|
|
163
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
164
|
+
self.send("#{key}=", nil)
|
|
165
|
+
end
|
|
139
166
|
end
|
|
140
167
|
|
|
141
168
|
self
|
|
@@ -157,7 +184,7 @@ module Clever
|
|
|
157
184
|
value.to_i
|
|
158
185
|
when :Float
|
|
159
186
|
value.to_f
|
|
160
|
-
when :
|
|
187
|
+
when :Boolean
|
|
161
188
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
162
189
|
true
|
|
163
190
|
else
|
|
@@ -178,8 +205,7 @@ module Clever
|
|
|
178
205
|
end
|
|
179
206
|
end
|
|
180
207
|
else # model
|
|
181
|
-
|
|
182
|
-
temp_model.build_from_hash(value)
|
|
208
|
+
Clever.const_get(type).build_from_hash(value)
|
|
183
209
|
end
|
|
184
210
|
end
|
|
185
211
|
|
|
@@ -201,7 +227,11 @@ module Clever
|
|
|
201
227
|
hash = {}
|
|
202
228
|
self.class.attribute_map.each_pair do |attr, param|
|
|
203
229
|
value = self.send(attr)
|
|
204
|
-
|
|
230
|
+
if value.nil?
|
|
231
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
232
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
233
|
+
end
|
|
234
|
+
|
|
205
235
|
hash[param] = _to_hash(value)
|
|
206
236
|
end
|
|
207
237
|
hash
|
|
@@ -223,7 +253,5 @@ module Clever
|
|
|
223
253
|
else
|
|
224
254
|
value
|
|
225
255
|
end
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
end
|
|
256
|
+
end end
|
|
229
257
|
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:
|
|
10
|
-
|
|
9
|
+
Swagger Codegen version: 3.0.51
|
|
11
10
|
=end
|
|
12
11
|
|
|
13
12
|
require 'date'
|
|
@@ -30,31 +29,47 @@ module Clever
|
|
|
30
29
|
end
|
|
31
30
|
|
|
32
31
|
# Attribute type mapping.
|
|
33
|
-
def self.
|
|
32
|
+
def self.openapi_types
|
|
34
33
|
{
|
|
35
|
-
:'first' => :'
|
|
36
|
-
:'last' => :'
|
|
37
|
-
:'middle' => :'
|
|
34
|
+
:'first' => :'Object',
|
|
35
|
+
:'last' => :'Object',
|
|
36
|
+
:'middle' => :'Object'
|
|
38
37
|
}
|
|
39
38
|
end
|
|
40
39
|
|
|
40
|
+
# List of attributes with nullable: true
|
|
41
|
+
def self.openapi_nullable
|
|
42
|
+
Set.new([
|
|
43
|
+
:'first',
|
|
44
|
+
:'last',
|
|
45
|
+
:'middle'
|
|
46
|
+
])
|
|
47
|
+
end
|
|
48
|
+
|
|
41
49
|
# Initializes the object
|
|
42
50
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
43
51
|
def initialize(attributes = {})
|
|
44
|
-
|
|
52
|
+
if (!attributes.is_a?(Hash))
|
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::Name` initialize method"
|
|
54
|
+
end
|
|
45
55
|
|
|
46
|
-
# convert string to symbol for hash key
|
|
47
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::Name`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
60
|
+
end
|
|
61
|
+
h[k.to_sym] = v
|
|
62
|
+
}
|
|
48
63
|
|
|
49
|
-
if attributes.
|
|
64
|
+
if attributes.key?(:'first')
|
|
50
65
|
self.first = attributes[:'first']
|
|
51
66
|
end
|
|
52
67
|
|
|
53
|
-
if attributes.
|
|
68
|
+
if attributes.key?(:'last')
|
|
54
69
|
self.last = attributes[:'last']
|
|
55
70
|
end
|
|
56
71
|
|
|
57
|
-
if attributes.
|
|
72
|
+
if attributes.key?(:'middle')
|
|
58
73
|
self.middle = attributes[:'middle']
|
|
59
74
|
end
|
|
60
75
|
end
|
|
@@ -89,17 +104,24 @@ module Clever
|
|
|
89
104
|
end
|
|
90
105
|
|
|
91
106
|
# Calculates hash code according to all attributes.
|
|
92
|
-
# @return [
|
|
107
|
+
# @return [Integer] Hash code
|
|
93
108
|
def hash
|
|
94
109
|
[first, last, middle].hash
|
|
95
110
|
end
|
|
96
111
|
|
|
112
|
+
# Builds the object from hash
|
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
114
|
+
# @return [Object] Returns the model itself
|
|
115
|
+
def self.build_from_hash(attributes)
|
|
116
|
+
new.build_from_hash(attributes)
|
|
117
|
+
end
|
|
118
|
+
|
|
97
119
|
# Builds the object from hash
|
|
98
120
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
99
121
|
# @return [Object] Returns the model itself
|
|
100
122
|
def build_from_hash(attributes)
|
|
101
123
|
return nil unless attributes.is_a?(Hash)
|
|
102
|
-
self.class.
|
|
124
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
103
125
|
if type =~ /\AArray<(.*)>/i
|
|
104
126
|
# check to ensure the input is an array given that the attribute
|
|
105
127
|
# is documented as an array but the input is not
|
|
@@ -108,7 +130,9 @@ module Clever
|
|
|
108
130
|
end
|
|
109
131
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
110
132
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
111
|
-
|
|
133
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
134
|
+
self.send("#{key}=", nil)
|
|
135
|
+
end
|
|
112
136
|
end
|
|
113
137
|
|
|
114
138
|
self
|
|
@@ -130,7 +154,7 @@ module Clever
|
|
|
130
154
|
value.to_i
|
|
131
155
|
when :Float
|
|
132
156
|
value.to_f
|
|
133
|
-
when :
|
|
157
|
+
when :Boolean
|
|
134
158
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
135
159
|
true
|
|
136
160
|
else
|
|
@@ -151,8 +175,7 @@ module Clever
|
|
|
151
175
|
end
|
|
152
176
|
end
|
|
153
177
|
else # model
|
|
154
|
-
|
|
155
|
-
temp_model.build_from_hash(value)
|
|
178
|
+
Clever.const_get(type).build_from_hash(value)
|
|
156
179
|
end
|
|
157
180
|
end
|
|
158
181
|
|
|
@@ -174,7 +197,11 @@ module Clever
|
|
|
174
197
|
hash = {}
|
|
175
198
|
self.class.attribute_map.each_pair do |attr, param|
|
|
176
199
|
value = self.send(attr)
|
|
177
|
-
|
|
200
|
+
if value.nil?
|
|
201
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
202
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
203
|
+
end
|
|
204
|
+
|
|
178
205
|
hash[param] = _to_hash(value)
|
|
179
206
|
end
|
|
180
207
|
hash
|
|
@@ -196,7 +223,5 @@ module Clever
|
|
|
196
223
|
else
|
|
197
224
|
value
|
|
198
225
|
end
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
end
|
|
226
|
+
end end
|
|
202
227
|
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:
|
|
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.
|
|
26
|
+
def self.openapi_types
|
|
28
27
|
{
|
|
29
|
-
:'message' => :'
|
|
28
|
+
:'message' => :'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
|
-
|
|
41
|
+
if (!attributes.is_a?(Hash))
|
|
42
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::NotFound` initialize method"
|
|
43
|
+
end
|
|
37
44
|
|
|
38
|
-
# convert string to symbol for hash key
|
|
39
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
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::NotFound`. 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.
|
|
53
|
+
if attributes.key?(:'message')
|
|
42
54
|
self.message = attributes[:'message']
|
|
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 [
|
|
86
|
+
# @return [Integer] Hash code
|
|
75
87
|
def hash
|
|
76
88
|
[message].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.
|
|
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
|
-
|
|
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 :
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
10
|
-
|
|
9
|
+
Swagger Codegen version: 3.0.51
|
|
11
10
|
=end
|
|
12
11
|
|
|
13
12
|
require 'date'
|
|
@@ -27,26 +26,41 @@ module Clever
|
|
|
27
26
|
end
|
|
28
27
|
|
|
29
28
|
# Attribute type mapping.
|
|
30
|
-
def self.
|
|
29
|
+
def self.openapi_types
|
|
31
30
|
{
|
|
32
|
-
:'email' => :'
|
|
33
|
-
:'name' => :'
|
|
31
|
+
:'email' => :'Object',
|
|
32
|
+
:'name' => :'Object'
|
|
34
33
|
}
|
|
35
34
|
end
|
|
36
35
|
|
|
36
|
+
# List of attributes with nullable: true
|
|
37
|
+
def self.openapi_nullable
|
|
38
|
+
Set.new([
|
|
39
|
+
:'email',
|
|
40
|
+
:'name'
|
|
41
|
+
])
|
|
42
|
+
end
|
|
43
|
+
|
|
37
44
|
# Initializes the object
|
|
38
45
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
39
46
|
def initialize(attributes = {})
|
|
40
|
-
|
|
47
|
+
if (!attributes.is_a?(Hash))
|
|
48
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::Principal` initialize method"
|
|
49
|
+
end
|
|
41
50
|
|
|
42
|
-
# convert string to symbol for hash key
|
|
43
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
53
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
54
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::Principal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
55
|
+
end
|
|
56
|
+
h[k.to_sym] = v
|
|
57
|
+
}
|
|
44
58
|
|
|
45
|
-
if attributes.
|
|
59
|
+
if attributes.key?(:'email')
|
|
46
60
|
self.email = attributes[:'email']
|
|
47
61
|
end
|
|
48
62
|
|
|
49
|
-
if attributes.
|
|
63
|
+
if attributes.key?(:'name')
|
|
50
64
|
self.name = attributes[:'name']
|
|
51
65
|
end
|
|
52
66
|
end
|
|
@@ -80,17 +94,24 @@ module Clever
|
|
|
80
94
|
end
|
|
81
95
|
|
|
82
96
|
# Calculates hash code according to all attributes.
|
|
83
|
-
# @return [
|
|
97
|
+
# @return [Integer] Hash code
|
|
84
98
|
def hash
|
|
85
99
|
[email, name].hash
|
|
86
100
|
end
|
|
87
101
|
|
|
102
|
+
# Builds the object from hash
|
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
104
|
+
# @return [Object] Returns the model itself
|
|
105
|
+
def self.build_from_hash(attributes)
|
|
106
|
+
new.build_from_hash(attributes)
|
|
107
|
+
end
|
|
108
|
+
|
|
88
109
|
# Builds the object from hash
|
|
89
110
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
90
111
|
# @return [Object] Returns the model itself
|
|
91
112
|
def build_from_hash(attributes)
|
|
92
113
|
return nil unless attributes.is_a?(Hash)
|
|
93
|
-
self.class.
|
|
114
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
94
115
|
if type =~ /\AArray<(.*)>/i
|
|
95
116
|
# check to ensure the input is an array given that the attribute
|
|
96
117
|
# is documented as an array but the input is not
|
|
@@ -99,7 +120,9 @@ module Clever
|
|
|
99
120
|
end
|
|
100
121
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
101
122
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
102
|
-
|
|
123
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
124
|
+
self.send("#{key}=", nil)
|
|
125
|
+
end
|
|
103
126
|
end
|
|
104
127
|
|
|
105
128
|
self
|
|
@@ -121,7 +144,7 @@ module Clever
|
|
|
121
144
|
value.to_i
|
|
122
145
|
when :Float
|
|
123
146
|
value.to_f
|
|
124
|
-
when :
|
|
147
|
+
when :Boolean
|
|
125
148
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
126
149
|
true
|
|
127
150
|
else
|
|
@@ -142,8 +165,7 @@ module Clever
|
|
|
142
165
|
end
|
|
143
166
|
end
|
|
144
167
|
else # model
|
|
145
|
-
|
|
146
|
-
temp_model.build_from_hash(value)
|
|
168
|
+
Clever.const_get(type).build_from_hash(value)
|
|
147
169
|
end
|
|
148
170
|
end
|
|
149
171
|
|
|
@@ -165,7 +187,11 @@ module Clever
|
|
|
165
187
|
hash = {}
|
|
166
188
|
self.class.attribute_map.each_pair do |attr, param|
|
|
167
189
|
value = self.send(attr)
|
|
168
|
-
|
|
190
|
+
if value.nil?
|
|
191
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
192
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
193
|
+
end
|
|
194
|
+
|
|
169
195
|
hash[param] = _to_hash(value)
|
|
170
196
|
end
|
|
171
197
|
hash
|
|
@@ -187,7 +213,5 @@ module Clever
|
|
|
187
213
|
else
|
|
188
214
|
value
|
|
189
215
|
end
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
end
|
|
216
|
+
end end
|
|
193
217
|
end
|