Class: SwaggerClient::Profile
- Inherits:
-
Object
- Object
- SwaggerClient::Profile
- Defined in:
- lib/api_gen/lib/swagger_client/models/profile.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#gitlab_auth_time ⇒ Object
Авторизация в Gitlab: дата последней авторизации или null, если авторизации еще не было.
-
#id ⇒ Object
Returns the value of attribute id.
-
#institute ⇒ Object
Returns the value of attribute institute.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#middle_name ⇒ Object
Returns the value of attribute middle_name.
-
#photo_url ⇒ Object
Returns the value of attribute photo_url.
-
#role ⇒ Object
Returns the value of attribute role.
-
#student_group ⇒ Object
Returns the value of attribute student_group.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Profile
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Profile
Initializes the object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 94 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'email') self.email = attributes[:'email'] end if attributes.has_key?(:'first_name') self.first_name = attributes[:'first_name'] end if attributes.has_key?(:'last_name') self.last_name = attributes[:'last_name'] end if attributes.has_key?(:'middle_name') self.middle_name = attributes[:'middle_name'] end if attributes.has_key?(:'role') self.role = attributes[:'role'] end if attributes.has_key?(:'student_group') self.student_group = attributes[:'student_group'] end if attributes.has_key?(:'institute') self.institute = attributes[:'institute'] end if attributes.has_key?(:'photo_url') self.photo_url = attributes[:'photo_url'] end if attributes.has_key?(:'gitlab_auth_time') self.gitlab_auth_time = attributes[:'gitlab_auth_time'] end end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
19 20 21 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 19 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
21 22 23 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 21 def first_name @first_name end |
#gitlab_auth_time ⇒ Object
Авторизация в Gitlab: дата последней авторизации или null, если авторизации еще не было
36 37 38 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 36 def gitlab_auth_time @gitlab_auth_time end |
#id ⇒ Object
Returns the value of attribute id.
17 18 19 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 17 def id @id end |
#institute ⇒ Object
Returns the value of attribute institute.
31 32 33 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 31 def institute @institute end |
#last_name ⇒ Object
Returns the value of attribute last_name.
23 24 25 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 23 def last_name @last_name end |
#middle_name ⇒ Object
Returns the value of attribute middle_name.
25 26 27 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 25 def middle_name @middle_name end |
#photo_url ⇒ Object
Returns the value of attribute photo_url.
33 34 35 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 33 def photo_url @photo_url end |
#role ⇒ Object
Returns the value of attribute role.
27 28 29 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 27 def role @role end |
#student_group ⇒ Object
Returns the value of attribute student_group.
29 30 31 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 29 def student_group @student_group end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 61 def self.attribute_map { :'id' => :'id', :'email' => :'email', :'first_name' => :'first_name', :'last_name' => :'last_name', :'middle_name' => :'middle_name', :'role' => :'role', :'student_group' => :'student_group', :'institute' => :'institute', :'photo_url' => :'photo_url', :'gitlab_auth_time' => :'gitlab_auth_time' } end |
.swagger_types ⇒ Object
Attribute type mapping.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 77 def self.swagger_types { :'id' => :'Integer', :'email' => :'String', :'first_name' => :'String', :'last_name' => :'String', :'middle_name' => :'String', :'role' => :'String', :'student_group' => :'Group', :'institute' => :'Institute', :'photo_url' => :'String', :'gitlab_auth_time' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 293 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && email == o.email && first_name == o.first_name && last_name == o.last_name && middle_name == o.middle_name && role == o.role && student_group == o.student_group && institute == o.institute && photo_url == o.photo_url && gitlab_auth_time == o.gitlab_auth_time end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 344 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = SwaggerClient.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 410 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 323 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
310 311 312 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 310 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
316 317 318 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 316 def hash [id, email, first_name, last_name, middle_name, role, student_group, institute, photo_url, gitlab_auth_time].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 143 def list_invalid_properties invalid_properties = Array.new if !@email.nil? && @email.to_s.length > 254 invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 254.') end if !@email.nil? && @email.to_s.length < 1 invalid_properties.push('invalid value for "email", the character length must be great than or equal to 1.') end if @first_name.nil? invalid_properties.push('invalid value for "first_name", first_name cannot be nil.') end if @first_name.to_s.length > 255 invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 255.') end if @first_name.to_s.length < 1 invalid_properties.push('invalid value for "first_name", the character length must be great than or equal to 1.') end if @last_name.nil? invalid_properties.push('invalid value for "last_name", last_name cannot be nil.') end if @last_name.to_s.length > 255 invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 255.') end if @last_name.to_s.length < 1 invalid_properties.push('invalid value for "last_name", the character length must be great than or equal to 1.') end if !@middle_name.nil? && @middle_name.to_s.length > 255 invalid_properties.push('invalid value for "middle_name", the character length must be smaller than or equal to 255.') end if @institute.nil? invalid_properties.push('invalid value for "institute", institute cannot be nil.') end if !@photo_url.nil? && @photo_url.to_s.length > 200 invalid_properties.push('invalid value for "photo_url", the character length must be smaller than or equal to 200.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
390 391 392 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 390 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
396 397 398 399 400 401 402 403 404 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 396 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
384 385 386 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 384 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/api_gen/lib/swagger_client/models/profile.rb', line 194 def valid? return false if !@email.nil? && @email.to_s.length > 254 return false if !@email.nil? && @email.to_s.length < 1 return false if @first_name.nil? return false if @first_name.to_s.length > 255 return false if @first_name.to_s.length < 1 return false if @last_name.nil? return false if @last_name.to_s.length > 255 return false if @last_name.to_s.length < 1 return false if !@middle_name.nil? && @middle_name.to_s.length > 255 role_validator = EnumAttributeValidator.new('String', ['superadmin', 'admin', 'teacher', 'student']) return false unless role_validator.valid?(@role) return false if @institute.nil? return false if !@photo_url.nil? && @photo_url.to_s.length > 200 true end |