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'
|
|
@@ -73,68 +72,87 @@ module Clever
|
|
|
73
72
|
end
|
|
74
73
|
|
|
75
74
|
# Attribute type mapping.
|
|
76
|
-
def self.
|
|
75
|
+
def self.openapi_types
|
|
77
76
|
{
|
|
78
|
-
:'district' => :'
|
|
79
|
-
:'email' => :'
|
|
80
|
-
:'id' => :'
|
|
81
|
-
:'name' => :'
|
|
82
|
-
:'phone' => :'
|
|
83
|
-
:'phone_type' => :'
|
|
84
|
-
:'relationship' => :'
|
|
85
|
-
:'sis_id' => :'
|
|
86
|
-
:'students' => :'
|
|
87
|
-
:'type' => :'
|
|
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
|
-
|
|
105
|
+
if (!attributes.is_a?(Hash))
|
|
106
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::Contact` initialize method"
|
|
107
|
+
end
|
|
95
108
|
|
|
96
|
-
# convert string to symbol for hash key
|
|
97
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
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
|
+
}
|
|
98
116
|
|
|
99
|
-
if attributes.
|
|
117
|
+
if attributes.key?(:'district')
|
|
100
118
|
self.district = attributes[:'district']
|
|
101
119
|
end
|
|
102
120
|
|
|
103
|
-
if attributes.
|
|
121
|
+
if attributes.key?(:'email')
|
|
104
122
|
self.email = attributes[:'email']
|
|
105
123
|
end
|
|
106
124
|
|
|
107
|
-
if attributes.
|
|
125
|
+
if attributes.key?(:'id')
|
|
108
126
|
self.id = attributes[:'id']
|
|
109
127
|
end
|
|
110
128
|
|
|
111
|
-
if attributes.
|
|
129
|
+
if attributes.key?(:'name')
|
|
112
130
|
self.name = attributes[:'name']
|
|
113
131
|
end
|
|
114
132
|
|
|
115
|
-
if attributes.
|
|
133
|
+
if attributes.key?(:'phone')
|
|
116
134
|
self.phone = attributes[:'phone']
|
|
117
135
|
end
|
|
118
136
|
|
|
119
|
-
if attributes.
|
|
137
|
+
if attributes.key?(:'phone_type')
|
|
120
138
|
self.phone_type = attributes[:'phone_type']
|
|
121
139
|
end
|
|
122
140
|
|
|
123
|
-
if attributes.
|
|
141
|
+
if attributes.key?(:'relationship')
|
|
124
142
|
self.relationship = attributes[:'relationship']
|
|
125
143
|
end
|
|
126
144
|
|
|
127
|
-
if attributes.
|
|
145
|
+
if attributes.key?(:'sis_id')
|
|
128
146
|
self.sis_id = attributes[:'sis_id']
|
|
129
147
|
end
|
|
130
148
|
|
|
131
|
-
if attributes.
|
|
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.
|
|
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('
|
|
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('
|
|
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('
|
|
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('
|
|
182
|
+
validator = EnumAttributeValidator.new('Object', ['Cell', 'Home', 'Work', 'Other', ''])
|
|
165
183
|
unless validator.valid?(phone_type)
|
|
166
|
-
fail ArgumentError,
|
|
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('
|
|
192
|
+
validator = EnumAttributeValidator.new('Object', ['Parent', 'Grandparent', 'Self', 'Aunt/Uncle', 'Sibling', 'Other', ''])
|
|
175
193
|
unless validator.valid?(relationship)
|
|
176
|
-
fail ArgumentError,
|
|
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('
|
|
202
|
+
validator = EnumAttributeValidator.new('Object', ['Parent/Guardian', 'Emergency', 'Primary', 'Secondary', 'Family', 'Other', ''])
|
|
185
203
|
unless validator.valid?(type)
|
|
186
|
-
fail ArgumentError,
|
|
204
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
187
205
|
end
|
|
188
206
|
@type = type
|
|
189
207
|
end
|
|
@@ -212,17 +230,24 @@ module Clever
|
|
|
212
230
|
end
|
|
213
231
|
|
|
214
232
|
# Calculates hash code according to all attributes.
|
|
215
|
-
# @return [
|
|
233
|
+
# @return [Integer] Hash code
|
|
216
234
|
def hash
|
|
217
235
|
[district, email, id, name, phone, phone_type, relationship, sis_id, students, type].hash
|
|
218
236
|
end
|
|
219
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)
|
|
243
|
+
end
|
|
244
|
+
|
|
220
245
|
# Builds the object from hash
|
|
221
246
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
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.
|
|
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
|
-
|
|
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 :
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
@@ -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
|
-
:'object' => :'
|
|
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
|
-
|
|
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|
|
|
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.
|
|
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 [
|
|
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.
|
|
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'
|
|
@@ -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
|
-
:'data' => :'
|
|
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
|
-
|
|
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|
|
|
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.
|
|
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 [
|
|
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.
|
|
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,28 +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
|
-
:'data' => :'
|
|
33
|
-
:'links' => :'
|
|
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
|
-
|
|
45
|
+
if (!attributes.is_a?(Hash))
|
|
46
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::ContactsResponse` initialize method"
|
|
47
|
+
end
|
|
41
48
|
|
|
42
|
-
# convert string to symbol for hash key
|
|
43
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
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::ContactsResponse`. 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.
|
|
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.
|
|
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 [
|
|
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.
|
|
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
|
-
|
|
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 :
|
|
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
|
-
|
|
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
|
-
|
|
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
|