Class: StackOneHRIS::Employee
- Inherits:
-
Object
- Object
- StackOneHRIS::Employee
- Defined in:
- lib/stackone_hris_client/models/employee.rb
Instance Attribute Summary collapse
-
#avatar ⇒ Object
Returns the value of attribute avatar.
-
#birthday ⇒ Object
Returns the value of attribute birthday.
-
#company ⇒ Object
Returns the value of attribute company.
-
#company_name ⇒ Object
Returns the value of attribute company_name.
-
#date_of_birth ⇒ Object
Returns the value of attribute date_of_birth.
-
#department ⇒ Object
Returns the value of attribute department.
-
#display_name ⇒ Object
Returns the value of attribute display_name.
-
#employment_status ⇒ Object
Returns the value of attribute employment_status.
-
#employment_type ⇒ Object
Returns the value of attribute employment_type.
-
#employments ⇒ Object
Returns the value of attribute employments.
-
#ethnicity ⇒ Object
Returns the value of attribute ethnicity.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#hire_date ⇒ Object
Returns the value of attribute hire_date.
-
#home_location ⇒ Object
Returns the value of attribute home_location.
-
#id ⇒ Object
Returns the value of attribute id.
-
#job_title ⇒ Object
Returns the value of attribute job_title.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#manager_id ⇒ Object
Returns the value of attribute manager_id.
-
#marital_status ⇒ Object
Returns the value of attribute marital_status.
-
#name ⇒ Object
Returns the value of attribute name.
-
#personal_email ⇒ Object
Returns the value of attribute personal_email.
-
#personal_phone_number ⇒ Object
Returns the value of attribute personal_phone_number.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#tenure ⇒ Object
Returns the value of attribute tenure.
-
#termination_date ⇒ Object
Returns the value of attribute termination_date.
-
#work_anniversary ⇒ Object
Returns the value of attribute work_anniversary.
-
#work_email ⇒ Object
Returns the value of attribute work_email.
-
#work_location ⇒ Object
Returns the value of attribute work_location.
-
#work_phone_number ⇒ Object
Returns the value of attribute work_phone_number.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_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 ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Employee
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 = {}) ⇒ Employee
Initializes the object
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 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/stackone_hris_client/models/employee.rb', line 163 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `StackOneHRIS::Employee` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `StackOneHRIS::Employee`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'first_name') self.first_name = attributes[:'first_name'] end if attributes.key?(:'last_name') self.last_name = attributes[:'last_name'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'display_name') self.display_name = attributes[:'display_name'] end if attributes.key?(:'gender') self.gender = attributes[:'gender'] end if attributes.key?(:'ethnicity') self.ethnicity = attributes[:'ethnicity'] end if attributes.key?(:'date_of_birth') self.date_of_birth = attributes[:'date_of_birth'] end if attributes.key?(:'birthday') self.birthday = attributes[:'birthday'] end if attributes.key?(:'marital_status') self.marital_status = attributes[:'marital_status'] end if attributes.key?(:'avatar') self.avatar = attributes[:'avatar'] end if attributes.key?(:'personal_email') self.personal_email = attributes[:'personal_email'] end if attributes.key?(:'personal_phone_number') self.personal_phone_number = attributes[:'personal_phone_number'] end if attributes.key?(:'work_email') self.work_email = attributes[:'work_email'] end if attributes.key?(:'work_phone_number') self.work_phone_number = attributes[:'work_phone_number'] end if attributes.key?(:'job_title') self.job_title = attributes[:'job_title'] end if attributes.key?(:'department') self.department = attributes[:'department'] end if attributes.key?(:'manager_id') self.manager_id = attributes[:'manager_id'] end if attributes.key?(:'hire_date') self.hire_date = attributes[:'hire_date'] end if attributes.key?(:'start_date') self.start_date = attributes[:'start_date'] end if attributes.key?(:'tenure') self.tenure = attributes[:'tenure'] end if attributes.key?(:'work_anniversary') self.work_anniversary = attributes[:'work_anniversary'] end if attributes.key?(:'employment_type') self.employment_type = attributes[:'employment_type'] end if attributes.key?(:'employment_status') self.employment_status = attributes[:'employment_status'] end if attributes.key?(:'termination_date') self.termination_date = attributes[:'termination_date'] end if attributes.key?(:'company_name') self.company_name = attributes[:'company_name'] end if attributes.key?(:'home_location') self.home_location = attributes[:'home_location'] end if attributes.key?(:'work_location') self.work_location = attributes[:'work_location'] end if attributes.key?(:'company') self.company = attributes[:'company'] end if attributes.key?(:'employments') if (value = attributes[:'employments']).is_a?(Array) self.employments = value end end end |
Instance Attribute Details
#avatar ⇒ Object
Returns the value of attribute avatar.
38 39 40 |
# File 'lib/stackone_hris_client/models/employee.rb', line 38 def avatar @avatar end |
#birthday ⇒ Object
Returns the value of attribute birthday.
34 35 36 |
# File 'lib/stackone_hris_client/models/employee.rb', line 34 def birthday @birthday end |
#company ⇒ Object
Returns the value of attribute company.
74 75 76 |
# File 'lib/stackone_hris_client/models/employee.rb', line 74 def company @company end |
#company_name ⇒ Object
Returns the value of attribute company_name.
68 69 70 |
# File 'lib/stackone_hris_client/models/employee.rb', line 68 def company_name @company_name end |
#date_of_birth ⇒ Object
Returns the value of attribute date_of_birth.
32 33 34 |
# File 'lib/stackone_hris_client/models/employee.rb', line 32 def date_of_birth @date_of_birth end |
#department ⇒ Object
Returns the value of attribute department.
50 51 52 |
# File 'lib/stackone_hris_client/models/employee.rb', line 50 def department @department end |
#display_name ⇒ Object
Returns the value of attribute display_name.
26 27 28 |
# File 'lib/stackone_hris_client/models/employee.rb', line 26 def display_name @display_name end |
#employment_status ⇒ Object
Returns the value of attribute employment_status.
64 65 66 |
# File 'lib/stackone_hris_client/models/employee.rb', line 64 def employment_status @employment_status end |
#employment_type ⇒ Object
Returns the value of attribute employment_type.
62 63 64 |
# File 'lib/stackone_hris_client/models/employee.rb', line 62 def employment_type @employment_type end |
#employments ⇒ Object
Returns the value of attribute employments.
76 77 78 |
# File 'lib/stackone_hris_client/models/employee.rb', line 76 def employments @employments end |
#ethnicity ⇒ Object
Returns the value of attribute ethnicity.
30 31 32 |
# File 'lib/stackone_hris_client/models/employee.rb', line 30 def ethnicity @ethnicity end |
#first_name ⇒ Object
Returns the value of attribute first_name.
20 21 22 |
# File 'lib/stackone_hris_client/models/employee.rb', line 20 def first_name @first_name end |
#gender ⇒ Object
Returns the value of attribute gender.
28 29 30 |
# File 'lib/stackone_hris_client/models/employee.rb', line 28 def gender @gender end |
#hire_date ⇒ Object
Returns the value of attribute hire_date.
54 55 56 |
# File 'lib/stackone_hris_client/models/employee.rb', line 54 def hire_date @hire_date end |
#home_location ⇒ Object
Returns the value of attribute home_location.
70 71 72 |
# File 'lib/stackone_hris_client/models/employee.rb', line 70 def home_location @home_location end |
#id ⇒ Object
Returns the value of attribute id.
18 19 20 |
# File 'lib/stackone_hris_client/models/employee.rb', line 18 def id @id end |
#job_title ⇒ Object
Returns the value of attribute job_title.
48 49 50 |
# File 'lib/stackone_hris_client/models/employee.rb', line 48 def job_title @job_title end |
#last_name ⇒ Object
Returns the value of attribute last_name.
22 23 24 |
# File 'lib/stackone_hris_client/models/employee.rb', line 22 def last_name @last_name end |
#manager_id ⇒ Object
Returns the value of attribute manager_id.
52 53 54 |
# File 'lib/stackone_hris_client/models/employee.rb', line 52 def manager_id @manager_id end |
#marital_status ⇒ Object
Returns the value of attribute marital_status.
36 37 38 |
# File 'lib/stackone_hris_client/models/employee.rb', line 36 def marital_status @marital_status end |
#name ⇒ Object
Returns the value of attribute name.
24 25 26 |
# File 'lib/stackone_hris_client/models/employee.rb', line 24 def name @name end |
#personal_email ⇒ Object
Returns the value of attribute personal_email.
40 41 42 |
# File 'lib/stackone_hris_client/models/employee.rb', line 40 def personal_email @personal_email end |
#personal_phone_number ⇒ Object
Returns the value of attribute personal_phone_number.
42 43 44 |
# File 'lib/stackone_hris_client/models/employee.rb', line 42 def personal_phone_number @personal_phone_number end |
#start_date ⇒ Object
Returns the value of attribute start_date.
56 57 58 |
# File 'lib/stackone_hris_client/models/employee.rb', line 56 def start_date @start_date end |
#tenure ⇒ Object
Returns the value of attribute tenure.
58 59 60 |
# File 'lib/stackone_hris_client/models/employee.rb', line 58 def tenure @tenure end |
#termination_date ⇒ Object
Returns the value of attribute termination_date.
66 67 68 |
# File 'lib/stackone_hris_client/models/employee.rb', line 66 def termination_date @termination_date end |
#work_anniversary ⇒ Object
Returns the value of attribute work_anniversary.
60 61 62 |
# File 'lib/stackone_hris_client/models/employee.rb', line 60 def work_anniversary @work_anniversary end |
#work_email ⇒ Object
Returns the value of attribute work_email.
44 45 46 |
# File 'lib/stackone_hris_client/models/employee.rb', line 44 def work_email @work_email end |
#work_location ⇒ Object
Returns the value of attribute work_location.
72 73 74 |
# File 'lib/stackone_hris_client/models/employee.rb', line 72 def work_location @work_location end |
#work_phone_number ⇒ Object
Returns the value of attribute work_phone_number.
46 47 48 |
# File 'lib/stackone_hris_client/models/employee.rb', line 46 def work_phone_number @work_phone_number end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
115 116 117 |
# File 'lib/stackone_hris_client/models/employee.rb', line 115 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/stackone_hris_client/models/employee.rb', line 79 def self.attribute_map { :'id' => :'id', :'first_name' => :'first_name', :'last_name' => :'last_name', :'name' => :'name', :'display_name' => :'display_name', :'gender' => :'gender', :'ethnicity' => :'ethnicity', :'date_of_birth' => :'date_of_birth', :'birthday' => :'birthday', :'marital_status' => :'marital_status', :'avatar' => :'avatar', :'personal_email' => :'personal_email', :'personal_phone_number' => :'personal_phone_number', :'work_email' => :'work_email', :'work_phone_number' => :'work_phone_number', :'job_title' => :'job_title', :'department' => :'department', :'manager_id' => :'manager_id', :'hire_date' => :'hire_date', :'start_date' => :'start_date', :'tenure' => :'tenure', :'work_anniversary' => :'work_anniversary', :'employment_type' => :'employment_type', :'employment_status' => :'employment_status', :'termination_date' => :'termination_date', :'company_name' => :'company_name', :'home_location' => :'home_location', :'work_location' => :'work_location', :'company' => :'company', :'employments' => :'employments' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
414 415 416 |
# File 'lib/stackone_hris_client/models/employee.rb', line 414 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
156 157 158 159 |
# File 'lib/stackone_hris_client/models/employee.rb', line 156 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/stackone_hris_client/models/employee.rb', line 120 def self.openapi_types { :'id' => :'String', :'first_name' => :'String', :'last_name' => :'String', :'name' => :'String', :'display_name' => :'String', :'gender' => :'GenderEnum', :'ethnicity' => :'EthnicityEnum', :'date_of_birth' => :'Time', :'birthday' => :'Time', :'marital_status' => :'MaritalStatusEnum', :'avatar' => :'Image', :'personal_email' => :'String', :'personal_phone_number' => :'String', :'work_email' => :'String', :'work_phone_number' => :'String', :'job_title' => :'String', :'department' => :'String', :'manager_id' => :'String', :'hire_date' => :'Time', :'start_date' => :'Time', :'tenure' => :'Float', :'work_anniversary' => :'Time', :'employment_type' => :'EmploymentTypeEnum', :'employment_status' => :'EmploymentStatusEnum', :'termination_date' => :'Time', :'company_name' => :'String', :'home_location' => :'Location', :'work_location' => :'Location', :'company' => :'String', :'employments' => :'Array<Employment>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
# File 'lib/stackone_hris_client/models/employee.rb', line 364 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && first_name == o.first_name && last_name == o.last_name && name == o.name && display_name == o.display_name && gender == o.gender && ethnicity == o.ethnicity && date_of_birth == o.date_of_birth && birthday == o.birthday && marital_status == o.marital_status && avatar == o.avatar && personal_email == o.personal_email && personal_phone_number == o.personal_phone_number && work_email == o.work_email && work_phone_number == o.work_phone_number && job_title == o.job_title && department == o.department && manager_id == o.manager_id && hire_date == o.hire_date && start_date == o.start_date && tenure == o.tenure && work_anniversary == o.work_anniversary && employment_type == o.employment_type && employment_status == o.employment_status && termination_date == o.termination_date && company_name == o.company_name && home_location == o.home_location && work_location == o.work_location && company == o.company && employments == o.employments end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File 'lib/stackone_hris_client/models/employee.rb', line 445 def _deserialize(type, value) case type.to_sym when :Time Time.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 # models (e.g. Pet) or oneOf klass = StackOneHRIS.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
516 517 518 519 520 521 522 523 524 525 526 527 528 |
# File 'lib/stackone_hris_client/models/employee.rb', line 516 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
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/stackone_hris_client/models/employee.rb', line 421 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif 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 end self end |
#eql?(o) ⇒ Boolean
401 402 403 |
# File 'lib/stackone_hris_client/models/employee.rb', line 401 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
407 408 409 |
# File 'lib/stackone_hris_client/models/employee.rb', line 407 def hash [id, first_name, last_name, name, display_name, gender, ethnicity, date_of_birth, birthday, marital_status, avatar, personal_email, personal_phone_number, work_email, work_phone_number, job_title, department, manager_id, hire_date, start_date, tenure, work_anniversary, employment_type, employment_status, termination_date, company_name, home_location, work_location, company, employments].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/stackone_hris_client/models/employee.rb', line 301 def list_invalid_properties invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @first_name.nil? invalid_properties.push('invalid value for "first_name", first_name cannot be nil.') end if @last_name.nil? invalid_properties.push('invalid value for "last_name", last_name cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @display_name.nil? invalid_properties.push('invalid value for "display_name", display_name cannot be nil.') end if @gender.nil? invalid_properties.push('invalid value for "gender", gender cannot be nil.') end if @personal_phone_number.nil? invalid_properties.push('invalid value for "personal_phone_number", personal_phone_number cannot be nil.') end if @work_email.nil? invalid_properties.push('invalid value for "work_email", work_email cannot be nil.') end if @work_phone_number.nil? invalid_properties.push('invalid value for "work_phone_number", work_phone_number cannot be nil.') end if @department.nil? invalid_properties.push('invalid value for "department", department cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
492 493 494 |
# File 'lib/stackone_hris_client/models/employee.rb', line 492 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
498 499 500 501 502 503 504 505 506 507 508 509 510 |
# File 'lib/stackone_hris_client/models/employee.rb', line 498 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
486 487 488 |
# File 'lib/stackone_hris_client/models/employee.rb', line 486 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/stackone_hris_client/models/employee.rb', line 348 def valid? return false if @id.nil? return false if @first_name.nil? return false if @last_name.nil? return false if @name.nil? return false if @display_name.nil? return false if @gender.nil? return false if @personal_phone_number.nil? return false if @work_email.nil? return false if @work_phone_number.nil? return false if @department.nil? true end |