class MergeHRISClient::Employee
The Employee
Object ### Description The `Employee` object is used to represent an Employee
for a company. ### Usage Example Fetch from the `LIST Employee` endpoint and filter by `ID` to show all employees.
Attributes
The URL of the employee's avatar image.
The ID of the employee's company.
The employee's date of birth.
The employee's full name, to use for display purposes.
The employee's number that appears in the remote UI. Note: This is distinct from the remote_id
field, which is a unique identifier for the employee set by the remote API, and is not exposed to the user.
The employment status of the employee.
Array of `Employment` IDs for this Employee
.
The employee's ethnicity.
The employee's first name.
The employee's gender.
The employee's hire date. If an employee has multiple hire dates from previous employments, this represents the most recent hire date.
The employee's home address.
The employee's last name.
The employee ID of the employee's manager.
The employee's marital status.
The employee's mobile phone number.
The employee's personal email.
The third-party API ID of the matching object.
The employee's social security number.
The employee's start date.
The employee's team.
The employee's termination date.
The employee's work email.
The employee's work address.
Public Class Methods
Returns all the JSON keys this model knows about
# File lib/merge_hris_client/models/employee.rb, line 128 def self.acceptable_attributes attribute_map.values end
Attribute mapping from ruby-style variable name to JSON key.
# File lib/merge_hris_client/models/employee.rb, line 96 def self.attribute_map { :'id' => :'id', :'remote_id' => :'remote_id', :'employee_number' => :'employee_number', :'company' => :'company', :'first_name' => :'first_name', :'last_name' => :'last_name', :'display_full_name' => :'display_full_name', :'work_email' => :'work_email', :'personal_email' => :'personal_email', :'mobile_phone_number' => :'mobile_phone_number', :'employments' => :'employments', :'home_location' => :'home_location', :'work_location' => :'work_location', :'manager' => :'manager', :'team' => :'team', :'ssn' => :'ssn', :'gender' => :'gender', :'ethnicity' => :'ethnicity', :'marital_status' => :'marital_status', :'date_of_birth' => :'date_of_birth', :'hire_date' => :'hire_date', :'start_date' => :'start_date', :'employment_status' => :'employment_status', :'termination_date' => :'termination_date', :'avatar' => :'avatar', :'remote_data' => :'remote_data' } end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/merge_hris_client/models/employee.rb, line 439 def self.build_from_hash(attributes) new.build_from_hash(attributes) end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/merge_hris_client/models/employee.rb, line 196 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `MergeHRISClient::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 `MergeHRISClient::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?(:'remote_id') self.remote_id = attributes[:'remote_id'] end if attributes.key?(:'employee_number') self.employee_number = attributes[:'employee_number'] end if attributes.key?(:'company') self.company = attributes[:'company'] 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?(:'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?(:'employments') if (value = attributes[:'employments']).is_a?(Array) self.employments = value end 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?(:'team') self.team = attributes[:'team'] end if attributes.key?(:'ssn') self.ssn = attributes[:'ssn'] 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?(:'hire_date') self.hire_date = attributes[:'hire_date'] end if attributes.key?(:'start_date') self.start_date = attributes[:'start_date'] 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?(:'avatar') self.avatar = attributes[:'avatar'] end if attributes.key?(:'remote_data') if (value = attributes[:'remote_data']).is_a?(Array) self.remote_data = value end end end
List of attributes with nullable: true
# File lib/merge_hris_client/models/employee.rb, line 165 def self.openapi_nullable Set.new([ :'remote_id', :'employee_number', :'company', :'first_name', :'last_name', :'display_full_name', :'work_email', :'personal_email', :'mobile_phone_number', :'home_location', :'work_location', :'manager', :'team', :'ssn', :'gender', :'ethnicity', :'marital_status', :'date_of_birth', :'hire_date', :'start_date', :'employment_status', :'termination_date', :'avatar', :'remote_data' ]) end
Attribute type mapping.
# File lib/merge_hris_client/models/employee.rb, line 133 def self.openapi_types { :'id' => :'String', :'remote_id' => :'String', :'employee_number' => :'String', :'company' => :'String', :'first_name' => :'String', :'last_name' => :'String', :'display_full_name' => :'String', :'work_email' => :'String', :'personal_email' => :'String', :'mobile_phone_number' => :'String', :'employments' => :'Array<String>', :'home_location' => :'String', :'work_location' => :'String', :'manager' => :'String', :'team' => :'String', :'ssn' => :'String', :'gender' => :'GenderEnum', :'ethnicity' => :'EthnicityEnum', :'marital_status' => :'MaritalStatusEnum', :'date_of_birth' => :'Time', :'hire_date' => :'Time', :'start_date' => :'Time', :'employment_status' => :'EmploymentStatusEnum', :'termination_date' => :'Time', :'avatar' => :'String', :'remote_data' => :'Array<RemoteData>' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/merge_hris_client/models/employee.rb, line 393 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && remote_id == o.remote_id && employee_number == o.employee_number && company == o.company && first_name == o.first_name && last_name == o.last_name && display_full_name == o.display_full_name && work_email == o.work_email && personal_email == o.personal_email && mobile_phone_number == o.mobile_phone_number && employments == o.employments && home_location == o.home_location && work_location == o.work_location && manager == o.manager && team == o.team && ssn == o.ssn && gender == o.gender && ethnicity == o.ethnicity && marital_status == o.marital_status && date_of_birth == o.date_of_birth && hire_date == o.hire_date && start_date == o.start_date && employment_status == o.employment_status && termination_date == o.termination_date && avatar == o.avatar && remote_data == o.remote_data end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/merge_hris_client/models/employee.rb, line 469 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 = MergeHRISClient.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/merge_hris_client/models/employee.rb, line 540 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
Custom attribute writer method with validation @param [Object] avatar Value to be assigned
# File lib/merge_hris_client/models/employee.rb, line 383 def avatar=(avatar) if !avatar.nil? && avatar.to_s.length > 2000 fail ArgumentError, 'invalid value for "avatar", the character length must be smaller than or equal to 2000.' end @avatar = avatar end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/merge_hris_client/models/employee.rb, line 446 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
@see the `==` method @param [Object] Object to be compared
# File lib/merge_hris_client/models/employee.rb, line 426 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Integer] Hash code
# File lib/merge_hris_client/models/employee.rb, line 432 def hash [id, remote_id, employee_number, company, first_name, last_name, display_full_name, work_email, personal_email, mobile_phone_number, employments, home_location, work_location, manager, team, ssn, gender, ethnicity, marital_status, date_of_birth, hire_date, start_date, employment_status, termination_date, avatar, remote_data].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/merge_hris_client/models/employee.rb, line 320 def list_invalid_properties invalid_properties = Array.new if !@work_email.nil? && @work_email.to_s.length > 254 invalid_properties.push('invalid value for "work_email", the character length must be smaller than or equal to 254.') end if !@personal_email.nil? && @personal_email.to_s.length > 254 invalid_properties.push('invalid value for "personal_email", the character length must be smaller than or equal to 254.') end if !@ssn.nil? && @ssn.to_s.length > 100 invalid_properties.push('invalid value for "ssn", the character length must be smaller than or equal to 100.') end if !@avatar.nil? && @avatar.to_s.length > 2000 invalid_properties.push('invalid value for "avatar", the character length must be smaller than or equal to 2000.') end invalid_properties end
Custom attribute writer method with validation @param [Object] personal_email
Value to be assigned
# File lib/merge_hris_client/models/employee.rb, line 363 def personal_email=(personal_email) if !personal_email.nil? && personal_email.to_s.length > 254 fail ArgumentError, 'invalid value for "personal_email", the character length must be smaller than or equal to 254.' end @personal_email = personal_email end
Custom attribute writer method with validation @param [Object] ssn Value to be assigned
# File lib/merge_hris_client/models/employee.rb, line 373 def ssn=(ssn) if !ssn.nil? && ssn.to_s.length > 100 fail ArgumentError, 'invalid value for "ssn", the character length must be smaller than or equal to 100.' end @ssn = ssn end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/merge_hris_client/models/employee.rb, line 522 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
Returns the string representation of the object @return [String] String presentation of the object
# File lib/merge_hris_client/models/employee.rb, line 510 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/merge_hris_client/models/employee.rb, line 343 def valid? return false if !@work_email.nil? && @work_email.to_s.length > 254 return false if !@personal_email.nil? && @personal_email.to_s.length > 254 return false if !@ssn.nil? && @ssn.to_s.length > 100 return false if !@avatar.nil? && @avatar.to_s.length > 2000 true end
Custom attribute writer method with validation @param [Object] work_email
Value to be assigned
# File lib/merge_hris_client/models/employee.rb, line 353 def work_email=(work_email) if !work_email.nil? && work_email.to_s.length > 254 fail ArgumentError, 'invalid value for "work_email", the character length must be smaller than or equal to 254.' end @work_email = work_email end