unienv_api 1.0.0

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.
@@ -0,0 +1,425 @@
1
+ =begin
2
+ #UniEnv Core API
3
+
4
+ #Документация по API UniEnv
5
+
6
+ OpenAPI spec version: v1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.24-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SwaggerClient
16
+ class Profile
17
+ attr_accessor :id
18
+
19
+ attr_accessor :email
20
+
21
+ attr_accessor :first_name
22
+
23
+ attr_accessor :last_name
24
+
25
+ attr_accessor :middle_name
26
+
27
+ attr_accessor :role
28
+
29
+ attr_accessor :student_group
30
+
31
+ attr_accessor :institute
32
+
33
+ attr_accessor :photo_url
34
+
35
+ # Авторизация в Gitlab: дата последней авторизации или null, если авторизации еще не было
36
+ attr_accessor :gitlab_auth_time
37
+
38
+ class EnumAttributeValidator
39
+ attr_reader :datatype
40
+ attr_reader :allowable_values
41
+
42
+ def initialize(datatype, allowable_values)
43
+ @allowable_values = allowable_values.map do |value|
44
+ case datatype.to_s
45
+ when /Integer/i
46
+ value.to_i
47
+ when /Float/i
48
+ value.to_f
49
+ else
50
+ value
51
+ end
52
+ end
53
+ end
54
+
55
+ def valid?(value)
56
+ !value || allowable_values.include?(value)
57
+ end
58
+ end
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'id' => :'id',
64
+ :'email' => :'email',
65
+ :'first_name' => :'first_name',
66
+ :'last_name' => :'last_name',
67
+ :'middle_name' => :'middle_name',
68
+ :'role' => :'role',
69
+ :'student_group' => :'student_group',
70
+ :'institute' => :'institute',
71
+ :'photo_url' => :'photo_url',
72
+ :'gitlab_auth_time' => :'gitlab_auth_time'
73
+ }
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.swagger_types
78
+ {
79
+ :'id' => :'Integer',
80
+ :'email' => :'String',
81
+ :'first_name' => :'String',
82
+ :'last_name' => :'String',
83
+ :'middle_name' => :'String',
84
+ :'role' => :'String',
85
+ :'student_group' => :'Group',
86
+ :'institute' => :'Institute',
87
+ :'photo_url' => :'String',
88
+ :'gitlab_auth_time' => :'String'
89
+ }
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ return unless attributes.is_a?(Hash)
96
+
97
+ # convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
99
+
100
+ if attributes.has_key?(:'id')
101
+ self.id = attributes[:'id']
102
+ end
103
+
104
+ if attributes.has_key?(:'email')
105
+ self.email = attributes[:'email']
106
+ end
107
+
108
+ if attributes.has_key?(:'first_name')
109
+ self.first_name = attributes[:'first_name']
110
+ end
111
+
112
+ if attributes.has_key?(:'last_name')
113
+ self.last_name = attributes[:'last_name']
114
+ end
115
+
116
+ if attributes.has_key?(:'middle_name')
117
+ self.middle_name = attributes[:'middle_name']
118
+ end
119
+
120
+ if attributes.has_key?(:'role')
121
+ self.role = attributes[:'role']
122
+ end
123
+
124
+ if attributes.has_key?(:'student_group')
125
+ self.student_group = attributes[:'student_group']
126
+ end
127
+
128
+ if attributes.has_key?(:'institute')
129
+ self.institute = attributes[:'institute']
130
+ end
131
+
132
+ if attributes.has_key?(:'photo_url')
133
+ self.photo_url = attributes[:'photo_url']
134
+ end
135
+
136
+ if attributes.has_key?(:'gitlab_auth_time')
137
+ self.gitlab_auth_time = attributes[:'gitlab_auth_time']
138
+ end
139
+ end
140
+
141
+ # Show invalid properties with the reasons. Usually used together with valid?
142
+ # @return Array for valid properties with the reasons
143
+ def list_invalid_properties
144
+ invalid_properties = Array.new
145
+ if !@email.nil? && @email.to_s.length > 254
146
+ invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 254.')
147
+ end
148
+
149
+ if !@email.nil? && @email.to_s.length < 1
150
+ invalid_properties.push('invalid value for "email", the character length must be great than or equal to 1.')
151
+ end
152
+
153
+ if @first_name.nil?
154
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
155
+ end
156
+
157
+ if @first_name.to_s.length > 255
158
+ invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 255.')
159
+ end
160
+
161
+ if @first_name.to_s.length < 1
162
+ invalid_properties.push('invalid value for "first_name", the character length must be great than or equal to 1.')
163
+ end
164
+
165
+ if @last_name.nil?
166
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
167
+ end
168
+
169
+ if @last_name.to_s.length > 255
170
+ invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 255.')
171
+ end
172
+
173
+ if @last_name.to_s.length < 1
174
+ invalid_properties.push('invalid value for "last_name", the character length must be great than or equal to 1.')
175
+ end
176
+
177
+ if !@middle_name.nil? && @middle_name.to_s.length > 255
178
+ invalid_properties.push('invalid value for "middle_name", the character length must be smaller than or equal to 255.')
179
+ end
180
+
181
+ if @institute.nil?
182
+ invalid_properties.push('invalid value for "institute", institute cannot be nil.')
183
+ end
184
+
185
+ if !@photo_url.nil? && @photo_url.to_s.length > 200
186
+ invalid_properties.push('invalid value for "photo_url", the character length must be smaller than or equal to 200.')
187
+ end
188
+
189
+ invalid_properties
190
+ end
191
+
192
+ # Check to see if the all the properties in the model are valid
193
+ # @return true if the model is valid
194
+ def valid?
195
+ return false if !@email.nil? && @email.to_s.length > 254
196
+ return false if !@email.nil? && @email.to_s.length < 1
197
+ return false if @first_name.nil?
198
+ return false if @first_name.to_s.length > 255
199
+ return false if @first_name.to_s.length < 1
200
+ return false if @last_name.nil?
201
+ return false if @last_name.to_s.length > 255
202
+ return false if @last_name.to_s.length < 1
203
+ return false if !@middle_name.nil? && @middle_name.to_s.length > 255
204
+ role_validator = EnumAttributeValidator.new('String', ['superadmin', 'admin', 'teacher', 'student'])
205
+ return false unless role_validator.valid?(@role)
206
+ return false if @institute.nil?
207
+ return false if !@photo_url.nil? && @photo_url.to_s.length > 200
208
+ true
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] email Value to be assigned
213
+ def email=(email)
214
+ if !email.nil? && email.to_s.length > 254
215
+ fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 254.'
216
+ end
217
+
218
+ if !email.nil? && email.to_s.length < 1
219
+ fail ArgumentError, 'invalid value for "email", the character length must be great than or equal to 1.'
220
+ end
221
+
222
+ @email = email
223
+ end
224
+
225
+ # Custom attribute writer method with validation
226
+ # @param [Object] first_name Value to be assigned
227
+ def first_name=(first_name)
228
+ if first_name.nil?
229
+ fail ArgumentError, 'first_name cannot be nil'
230
+ end
231
+
232
+ if first_name.to_s.length > 255
233
+ fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 255.'
234
+ end
235
+
236
+ if first_name.to_s.length < 1
237
+ fail ArgumentError, 'invalid value for "first_name", the character length must be great than or equal to 1.'
238
+ end
239
+
240
+ @first_name = first_name
241
+ end
242
+
243
+ # Custom attribute writer method with validation
244
+ # @param [Object] last_name Value to be assigned
245
+ def last_name=(last_name)
246
+ if last_name.nil?
247
+ fail ArgumentError, 'last_name cannot be nil'
248
+ end
249
+
250
+ if last_name.to_s.length > 255
251
+ fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 255.'
252
+ end
253
+
254
+ if last_name.to_s.length < 1
255
+ fail ArgumentError, 'invalid value for "last_name", the character length must be great than or equal to 1.'
256
+ end
257
+
258
+ @last_name = last_name
259
+ end
260
+
261
+ # Custom attribute writer method with validation
262
+ # @param [Object] middle_name Value to be assigned
263
+ def middle_name=(middle_name)
264
+ if !middle_name.nil? && middle_name.to_s.length > 255
265
+ fail ArgumentError, 'invalid value for "middle_name", the character length must be smaller than or equal to 255.'
266
+ end
267
+
268
+ @middle_name = middle_name
269
+ end
270
+
271
+ # Custom attribute writer method checking allowed values (enum).
272
+ # @param [Object] role Object to be assigned
273
+ def role=(role)
274
+ validator = EnumAttributeValidator.new('String', ['superadmin', 'admin', 'teacher', 'student'])
275
+ unless validator.valid?(role)
276
+ fail ArgumentError, 'invalid value for "role", must be one of #{validator.allowable_values}.'
277
+ end
278
+ @role = role
279
+ end
280
+
281
+ # Custom attribute writer method with validation
282
+ # @param [Object] photo_url Value to be assigned
283
+ def photo_url=(photo_url)
284
+ if !photo_url.nil? && photo_url.to_s.length > 200
285
+ fail ArgumentError, 'invalid value for "photo_url", the character length must be smaller than or equal to 200.'
286
+ end
287
+
288
+ @photo_url = photo_url
289
+ end
290
+
291
+ # Checks equality by comparing each attribute.
292
+ # @param [Object] Object to be compared
293
+ def ==(o)
294
+ return true if self.equal?(o)
295
+ self.class == o.class &&
296
+ id == o.id &&
297
+ email == o.email &&
298
+ first_name == o.first_name &&
299
+ last_name == o.last_name &&
300
+ middle_name == o.middle_name &&
301
+ role == o.role &&
302
+ student_group == o.student_group &&
303
+ institute == o.institute &&
304
+ photo_url == o.photo_url &&
305
+ gitlab_auth_time == o.gitlab_auth_time
306
+ end
307
+
308
+ # @see the `==` method
309
+ # @param [Object] Object to be compared
310
+ def eql?(o)
311
+ self == o
312
+ end
313
+
314
+ # Calculates hash code according to all attributes.
315
+ # @return [Fixnum] Hash code
316
+ def hash
317
+ [id, email, first_name, last_name, middle_name, role, student_group, institute, photo_url, gitlab_auth_time].hash
318
+ end
319
+
320
+ # Builds the object from hash
321
+ # @param [Hash] attributes Model attributes in the form of hash
322
+ # @return [Object] Returns the model itself
323
+ def build_from_hash(attributes)
324
+ return nil unless attributes.is_a?(Hash)
325
+ self.class.swagger_types.each_pair do |key, type|
326
+ if type =~ /\AArray<(.*)>/i
327
+ # check to ensure the input is an array given that the attribute
328
+ # is documented as an array but the input is not
329
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
330
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
331
+ end
332
+ elsif !attributes[self.class.attribute_map[key]].nil?
333
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
334
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
335
+ end
336
+
337
+ self
338
+ end
339
+
340
+ # Deserializes the data based on type
341
+ # @param string type Data type
342
+ # @param string value Value to be deserialized
343
+ # @return [Object] Deserialized data
344
+ def _deserialize(type, value)
345
+ case type.to_sym
346
+ when :DateTime
347
+ DateTime.parse(value)
348
+ when :Date
349
+ Date.parse(value)
350
+ when :String
351
+ value.to_s
352
+ when :Integer
353
+ value.to_i
354
+ when :Float
355
+ value.to_f
356
+ when :BOOLEAN
357
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
358
+ true
359
+ else
360
+ false
361
+ end
362
+ when :Object
363
+ # generic object (usually a Hash), return directly
364
+ value
365
+ when /\AArray<(?<inner_type>.+)>\z/
366
+ inner_type = Regexp.last_match[:inner_type]
367
+ value.map { |v| _deserialize(inner_type, v) }
368
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
369
+ k_type = Regexp.last_match[:k_type]
370
+ v_type = Regexp.last_match[:v_type]
371
+ {}.tap do |hash|
372
+ value.each do |k, v|
373
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
374
+ end
375
+ end
376
+ else # model
377
+ temp_model = SwaggerClient.const_get(type).new
378
+ temp_model.build_from_hash(value)
379
+ end
380
+ end
381
+
382
+ # Returns the string representation of the object
383
+ # @return [String] String presentation of the object
384
+ def to_s
385
+ to_hash.to_s
386
+ end
387
+
388
+ # to_body is an alias to to_hash (backward compatibility)
389
+ # @return [Hash] Returns the object in the form of hash
390
+ def to_body
391
+ to_hash
392
+ end
393
+
394
+ # Returns the object in the form of hash
395
+ # @return [Hash] Returns the object in the form of hash
396
+ def to_hash
397
+ hash = {}
398
+ self.class.attribute_map.each_pair do |attr, param|
399
+ value = self.send(attr)
400
+ next if value.nil?
401
+ hash[param] = _to_hash(value)
402
+ end
403
+ hash
404
+ end
405
+
406
+ # Outputs non-array value in the form of hash
407
+ # For object, use to_hash. Otherwise, just return the value
408
+ # @param [Object] value Any valid value
409
+ # @return [Hash] Returns the value in the form of hash
410
+ def _to_hash(value)
411
+ if value.is_a?(Array)
412
+ value.compact.map { |v| _to_hash(v) }
413
+ elsif value.is_a?(Hash)
414
+ {}.tap do |hash|
415
+ value.each { |k, v| hash[k] = _to_hash(v) }
416
+ end
417
+ elsif value.respond_to? :to_hash
418
+ value.to_hash
419
+ else
420
+ value
421
+ end
422
+ end
423
+
424
+ end
425
+ end
@@ -0,0 +1,15 @@
1
+ =begin
2
+ #UniEnv Core API
3
+
4
+ #Документация по API UniEnv
5
+
6
+ OpenAPI spec version: v1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.24-SNAPSHOT
10
+
11
+ =end
12
+
13
+ module SwaggerClient
14
+ VERSION = '1.0.0'
15
+ end
@@ -0,0 +1,43 @@
1
+ =begin
2
+ #UniEnv Core API
3
+
4
+ #Документация по API UniEnv
5
+
6
+ OpenAPI spec version: v1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.24-SNAPSHOT
10
+
11
+ =end
12
+
13
+ # Common files
14
+ require 'swagger_client/api_client'
15
+ require 'swagger_client/api_error'
16
+ require 'swagger_client/version'
17
+ require 'swagger_client/configuration'
18
+
19
+ # Models
20
+ require 'swagger_client/models/group'
21
+ require 'swagger_client/models/institute'
22
+ require 'swagger_client/models/profile'
23
+
24
+ # APIs
25
+ require 'swagger_client/api/profile_api'
26
+
27
+ module SwaggerClient
28
+ class << self
29
+ # Customize default settings for the SDK using block.
30
+ # SwaggerClient.configure do |config|
31
+ # config.username = "xxx"
32
+ # config.password = "xxx"
33
+ # end
34
+ # If no block given, return the default Configuration object.
35
+ def configure
36
+ if block_given?
37
+ yield(Configuration.default)
38
+ else
39
+ Configuration.default
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,48 @@
1
+ =begin
2
+ #UniEnv Core API
3
+
4
+ #Документация по API UniEnv
5
+
6
+ OpenAPI spec version: v1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.24-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for SwaggerClient::ProfileApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'ProfileApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = SwaggerClient::ProfileApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of ProfileApi' do
30
+ it 'should create an instance of ProfileApi' do
31
+ expect(@instance).to be_instance_of(SwaggerClient::ProfileApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for profile_get
36
+ # Получение профиля
37
+ #
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [Integer] :limit Number of results to return per page.
40
+ # @option opts [Integer] :offset The initial index from which to return the results.
41
+ # @return [Profile]
42
+ describe 'profile_get test' do
43
+ it 'should work' do
44
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
45
+ end
46
+ end
47
+
48
+ end