Class: OpenapiClient::CreateEmployeeRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_client/models/create_employee_request.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateEmployeeRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/openapi_client/models/create_employee_request.rb', line 213

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. = attributes[:'bank_account']
  end

  if attributes.key?(:'employment_history')
    if (value = attributes[:'employment_history']).is_a?(Array)
      self.employment_history = value
    end
  end

  if attributes.key?(:'compensation_history')
    if (value = attributes[:'compensation_history']).is_a?(Array)
      self.compensation_history = 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

#avatarObject

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_accountObject

Returns the value of attribute bank_account.



67
68
69
# File 'lib/openapi_client/models/create_employee_request.rb', line 67

def 
  @bank_account
end

#compensation_historyObject

Returns the value of attribute compensation_history.



71
72
73
# File 'lib/openapi_client/models/create_employee_request.rb', line 71

def compensation_history
  @compensation_history
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



73
74
75
# File 'lib/openapi_client/models/create_employee_request.rb', line 73

def custom_fields
  @custom_fields
end

#date_of_birthObject

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

#dependentsObject

Returns the value of attribute dependents.



77
78
79
# File 'lib/openapi_client/models/create_employee_request.rb', line 77

def dependents
  @dependents
end

#display_full_nameObject

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_contactsObject

Returns the value of attribute emergency_contacts.



79
80
81
# File 'lib/openapi_client/models/create_employee_request.rb', line 79

def emergency_contacts
  @emergency_contacts
end

#employee_numberObject

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_historyObject

Returns the value of attribute employment_history.



69
70
71
# File 'lib/openapi_client/models/create_employee_request.rb', line 69

def employment_history
  @employment_history
end

#employment_statusObject

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_typeObject

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

#ethnicityObject

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_nameObject

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

#genderObject

Returns the value of attribute gender.



43
44
45
# File 'lib/openapi_client/models/create_employee_request.rb', line 43

def gender
  @gender
end

#groupsObject

Returns the value of attribute groups.



75
76
77
# File 'lib/openapi_client/models/create_employee_request.rb', line 75

def groups
  @groups
end

#home_locationObject

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_titleObject

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_nameObject

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

#managerObject

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_statusObject

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_numberObject

+1234567890



39
40
41
# File 'lib/openapi_client/models/create_employee_request.rb', line 39

def mobile_phone_number
  @mobile_phone_number
end

#nationalityObject

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_emailObject

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_dateObject

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_idObject

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_dateObject

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_emailObject

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_locationObject

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_attributesObject

Returns all the JSON keys this model knows about



139
140
141
# File 'lib/openapi_client/models/create_employee_request.rb', line 139

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
# File 'lib/openapi_client/models/create_employee_request.rb', line 104

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',
    :'employment_history' => :'employment_history',
    :'compensation_history' => :'compensation_history',
    :'custom_fields' => :'custom_fields',
    :'groups' => :'groups',
    :'dependents' => :'dependents',
    :'emergency_contacts' => :'emergency_contacts'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



475
476
477
# File 'lib/openapi_client/models/create_employee_request.rb', line 475

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



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
# File 'lib/openapi_client/models/create_employee_request.rb', line 179

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',
    :'employment_history',
    :'compensation_history',
    :'custom_fields',
    :'groups',
    :'dependents',
    :'emergency_contacts'
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/openapi_client/models/create_employee_request.rb', line 144

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',
    :'employment_history' => :'Array<EmploymentHistoryNoNonNullRequest>',
    :'compensation_history' => :'Array<CompensationHistoryNoNonNullRequest>',
    :'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.

Parameters:

  • Object (Object)

    to be compared



426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/openapi_client/models/create_employee_request.rb', line 426

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 &&
       == o. &&
      employment_history == o.employment_history &&
      compensation_history == o.compensation_history &&
      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

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



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
531
532
533
534
535
536
537
538
539
540
541
542
# File 'lib/openapi_client/models/create_employee_request.rb', line 505

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



576
577
578
579
580
581
582
583
584
585
586
587
588
# File 'lib/openapi_client/models/create_employee_request.rb', line 576

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/openapi_client/models/create_employee_request.rb', line 482

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


462
463
464
# File 'lib/openapi_client/models/create_employee_request.rb', line 462

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



468
469
470
# File 'lib/openapi_client/models/create_employee_request.rb', line 468

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, , employment_history, compensation_history, custom_fields, groups, dependents, emergency_contacts].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/openapi_client/models/create_employee_request.rb', line 355

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_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



552
553
554
# File 'lib/openapi_client/models/create_employee_request.rb', line 552

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



558
559
560
561
562
563
564
565
566
567
568
569
570
# File 'lib/openapi_client/models/create_employee_request.rb', line 558

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



546
547
548
# File 'lib/openapi_client/models/create_employee_request.rb', line 546

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/openapi_client/models/create_employee_request.rb', line 370

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