Class: OpenapiClient::CreateEmployeeRequest
- Inherits:
-
Object
- Object
- OpenapiClient::CreateEmployeeRequest
- Defined in:
- lib/openapi_client/models/create_employee_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#avatar ⇒ Object
Returns the value of attribute avatar.
-
#bank_account ⇒ Object
Returns the value of attribute bank_account.
-
#custom_fields ⇒ Object
Returns the value of attribute custom_fields.
-
#date_of_birth ⇒ Object
Returns the value of attribute date_of_birth.
-
#dependents ⇒ Object
Returns the value of attribute dependents.
-
#display_full_name ⇒ Object
Returns the value of attribute display_full_name.
-
#emergency_contacts ⇒ Object
Returns the value of attribute emergency_contacts.
-
#employee_number ⇒ Object
Returns the value of attribute employee_number.
-
#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
the first name of the individual.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#groups ⇒ Object
Returns the value of attribute groups.
-
#home_location ⇒ Object
Returns the value of attribute home_location.
-
#job_title ⇒ Object
Returns the value of attribute job_title.
-
#last_name ⇒ Object
the last name of the individual.
-
#manager ⇒ Object
Returns the value of attribute manager.
-
#marital_status ⇒ Object
Returns the value of attribute marital_status.
-
#mobile_phone_number ⇒ Object
+1234567890.
-
#nationality ⇒ Object
Returns the value of attribute nationality.
-
#personal_email ⇒ Object
the personal email of the individual.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#tax_id ⇒ Object
Returns the value of attribute tax_id.
-
#termination_date ⇒ Object
Returns the value of attribute termination_date.
-
#work_email ⇒ Object
the work email of the individual.
-
#work_location ⇒ Object
Returns the value of attribute work_location.
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 = {}) ⇒ CreateEmployeeRequest
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 = {}) ⇒ CreateEmployeeRequest
Initializes the object
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 298 299 300 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 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 208 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::CreateEmployeeRequest` 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 `OpenapiClient::CreateEmployeeRequest`. 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?(:'employee_number') self.employee_number = attributes[:'employee_number'] 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?(:'display_full_name') self.display_full_name = attributes[:'display_full_name'] end if attributes.key?(:'nationality') self.nationality = attributes[:'nationality'] end if attributes.key?(:'job_title') self.job_title = attributes[:'job_title'] end if attributes.key?(:'work_email') self.work_email = attributes[:'work_email'] end if attributes.key?(:'personal_email') self.personal_email = attributes[:'personal_email'] end if attributes.key?(:'mobile_phone_number') self.mobile_phone_number = attributes[:'mobile_phone_number'] end if attributes.key?(:'tax_id') self.tax_id = attributes[:'tax_id'] end if attributes.key?(:'gender') self.gender = attributes[:'gender'] end if attributes.key?(:'ethnicity') self.ethnicity = attributes[:'ethnicity'] end if attributes.key?(:'marital_status') self.marital_status = attributes[:'marital_status'] end if attributes.key?(:'date_of_birth') self.date_of_birth = attributes[:'date_of_birth'] end if attributes.key?(:'employment_status') self.employment_status = attributes[:'employment_status'] end if attributes.key?(:'employment_type') self.employment_type = attributes[:'employment_type'] end if attributes.key?(:'start_date') self.start_date = attributes[:'start_date'] end if attributes.key?(:'termination_date') self.termination_date = attributes[:'termination_date'] end if attributes.key?(:'avatar') self.avatar = attributes[:'avatar'] 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?(:'manager') self.manager = attributes[:'manager'] end if attributes.key?(:'bank_account') self.bank_account = attributes[:'bank_account'] end if attributes.key?(:'employments') if (value = attributes[:'employments']).is_a?(Array) self.employments = value end end if attributes.key?(:'custom_fields') self.custom_fields = attributes[:'custom_fields'] end if attributes.key?(:'groups') if (value = attributes[:'groups']).is_a?(Array) self.groups = value end end if attributes.key?(:'dependents') if (value = attributes[:'dependents']).is_a?(Array) self.dependents = value end end if attributes.key?(:'emergency_contacts') if (value = attributes[:'emergency_contacts']).is_a?(Array) self.emergency_contacts = value end end end |
Instance Attribute Details
#avatar ⇒ Object
Returns the value of attribute avatar.
59 60 61 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 59 def avatar @avatar end |
#bank_account ⇒ Object
Returns the value of attribute bank_account.
67 68 69 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 67 def bank_account @bank_account end |
#custom_fields ⇒ Object
Returns the value of attribute custom_fields.
71 72 73 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 71 def custom_fields @custom_fields end |
#date_of_birth ⇒ Object
Returns the value of attribute date_of_birth.
49 50 51 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 49 def date_of_birth @date_of_birth end |
#dependents ⇒ Object
Returns the value of attribute dependents.
75 76 77 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 75 def dependents @dependents end |
#display_full_name ⇒ Object
Returns the value of attribute display_full_name.
26 27 28 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 26 def display_full_name @display_full_name end |
#emergency_contacts ⇒ Object
Returns the value of attribute emergency_contacts.
77 78 79 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 77 def emergency_contacts @emergency_contacts end |
#employee_number ⇒ Object
Returns the value of attribute employee_number.
18 19 20 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 18 def employee_number @employee_number end |
#employment_status ⇒ Object
Returns the value of attribute employment_status.
51 52 53 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 51 def employment_status @employment_status end |
#employment_type ⇒ Object
Returns the value of attribute employment_type.
53 54 55 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 53 def employment_type @employment_type end |
#employments ⇒ Object
Returns the value of attribute employments.
69 70 71 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 69 def employments @employments end |
#ethnicity ⇒ Object
Returns the value of attribute ethnicity.
45 46 47 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 45 def ethnicity @ethnicity end |
#first_name ⇒ Object
the first name of the individual
21 22 23 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 21 def first_name @first_name end |
#gender ⇒ Object
Returns the value of attribute gender.
43 44 45 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 43 def gender @gender end |
#groups ⇒ Object
Returns the value of attribute groups.
73 74 75 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 73 def groups @groups end |
#home_location ⇒ Object
Returns the value of attribute home_location.
61 62 63 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 61 def home_location @home_location end |
#job_title ⇒ Object
Returns the value of attribute job_title.
30 31 32 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 30 def job_title @job_title end |
#last_name ⇒ Object
the last name of the individual
24 25 26 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 24 def last_name @last_name end |
#manager ⇒ Object
Returns the value of attribute manager.
65 66 67 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 65 def manager @manager end |
#marital_status ⇒ Object
Returns the value of attribute marital_status.
47 48 49 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 47 def marital_status @marital_status end |
#mobile_phone_number ⇒ Object
+1234567890
39 40 41 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 39 def mobile_phone_number @mobile_phone_number end |
#nationality ⇒ Object
Returns the value of attribute nationality.
28 29 30 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 28 def nationality @nationality end |
#personal_email ⇒ Object
the personal email of the individual
36 37 38 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 36 def personal_email @personal_email end |
#start_date ⇒ Object
Returns the value of attribute start_date.
55 56 57 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 55 def start_date @start_date end |
#tax_id ⇒ Object
Returns the value of attribute tax_id.
41 42 43 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 41 def tax_id @tax_id end |
#termination_date ⇒ Object
Returns the value of attribute termination_date.
57 58 59 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 57 def termination_date @termination_date end |
#work_email ⇒ Object
the work email of the individual
33 34 35 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 33 def work_email @work_email end |
#work_location ⇒ Object
Returns the value of attribute work_location.
63 64 65 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 63 def work_location @work_location end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
136 137 138 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 136 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 102 def self.attribute_map { :'employee_number' => :'employee_number', :'first_name' => :'first_name', :'last_name' => :'last_name', :'display_full_name' => :'display_full_name', :'nationality' => :'nationality', :'job_title' => :'job_title', :'work_email' => :'work_email', :'personal_email' => :'personal_email', :'mobile_phone_number' => :'mobile_phone_number', :'tax_id' => :'tax_id', :'gender' => :'gender', :'ethnicity' => :'ethnicity', :'marital_status' => :'marital_status', :'date_of_birth' => :'date_of_birth', :'employment_status' => :'employment_status', :'employment_type' => :'employment_type', :'start_date' => :'start_date', :'termination_date' => :'termination_date', :'avatar' => :'avatar', :'home_location' => :'home_location', :'work_location' => :'work_location', :'manager' => :'manager', :'bank_account' => :'bank_account', :'employments' => :'employments', :'custom_fields' => :'custom_fields', :'groups' => :'groups', :'dependents' => :'dependents', :'emergency_contacts' => :'emergency_contacts' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
463 464 465 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 463 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
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 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 175 def self.openapi_nullable Set.new([ :'employee_number', :'display_full_name', :'nationality', :'job_title', :'work_email', :'personal_email', :'mobile_phone_number', :'tax_id', :'gender', :'ethnicity', :'marital_status', :'date_of_birth', :'employment_status', :'employment_type', :'start_date', :'termination_date', :'avatar', :'home_location', :'work_location', :'manager', :'bank_account', :'employments', :'custom_fields', :'groups', :'dependents', :'emergency_contacts' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
141 142 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 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 141 def self.openapi_types { :'employee_number' => :'String', :'first_name' => :'String', :'last_name' => :'String', :'display_full_name' => :'String', :'nationality' => :'String', :'job_title' => :'String', :'work_email' => :'String', :'personal_email' => :'String', :'mobile_phone_number' => :'String', :'tax_id' => :'String', :'gender' => :'String', :'ethnicity' => :'String', :'marital_status' => :'String', :'date_of_birth' => :'Date', :'employment_status' => :'EmploymentStatusNotNullRequest', :'employment_type' => :'String', :'start_date' => :'Date', :'termination_date' => :'Date', :'avatar' => :'String', :'home_location' => :'AddressNoNonNullRequest', :'work_location' => :'LocationNoNonNullRequest', :'manager' => :'CreateEmployeeRequestManager', :'bank_account' => :'CreateEmployeeRequestBankAccount', :'employments' => :'Array<EmploymentNoNullEnumRequest>', :'custom_fields' => :'Object', :'groups' => :'Array<GroupNoNullEnumRequest>', :'dependents' => :'Array<CreateEmployeeRequestDependents>', :'emergency_contacts' => :'Array<CreateEmployeeRequestEmergencyContacts>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 415 def ==(o) return true if self.equal?(o) self.class == o.class && employee_number == o.employee_number && first_name == o.first_name && last_name == o.last_name && display_full_name == o.display_full_name && nationality == o.nationality && job_title == o.job_title && work_email == o.work_email && personal_email == o.personal_email && mobile_phone_number == o.mobile_phone_number && tax_id == o.tax_id && gender == o.gender && ethnicity == o.ethnicity && marital_status == o.marital_status && date_of_birth == o.date_of_birth && employment_status == o.employment_status && employment_type == o.employment_type && start_date == o.start_date && termination_date == o.termination_date && avatar == o.avatar && home_location == o.home_location && work_location == o.work_location && manager == o.manager && bank_account == o.bank_account && employments == o.employments && custom_fields == o.custom_fields && groups == o.groups && dependents == o.dependents && emergency_contacts == o.emergency_contacts end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 493 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 = OpenapiClient.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
564 565 566 567 568 569 570 571 572 573 574 575 576 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 564 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
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 470 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) 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
450 451 452 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 450 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
456 457 458 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 456 def hash [employee_number, first_name, last_name, display_full_name, nationality, job_title, work_email, personal_email, mobile_phone_number, tax_id, gender, ethnicity, marital_status, date_of_birth, employment_status, employment_type, start_date, termination_date, avatar, home_location, work_location, manager, bank_account, employments, custom_fields, groups, dependents, emergency_contacts].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 344 def list_invalid_properties invalid_properties = Array.new 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 invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
540 541 542 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 540 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
546 547 548 549 550 551 552 553 554 555 556 557 558 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 546 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
534 535 536 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 534 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/openapi_client/models/create_employee_request.rb', line 359 def valid? return false if @first_name.nil? return false if @last_name.nil? gender_validator = EnumAttributeValidator.new('String', ["male", "female", "not_specified"]) return false unless gender_validator.valid?(@gender) ethnicity_validator = EnumAttributeValidator.new('String', ["asian", "black", "hispanic", "mixed", "not_specified", "other", "white"]) return false unless ethnicity_validator.valid?(@ethnicity) marital_status_validator = EnumAttributeValidator.new('String', ["single", "married", "not_specified"]) return false unless marital_status_validator.valid?(@marital_status) employment_type_validator = EnumAttributeValidator.new('String', ["full_time", "part_time", "contractor", "other"]) return false unless employment_type_validator.valid?(@employment_type) true end |