Class: Merge::Hris::Dependent
- Inherits:
-
Object
- Object
- Merge::Hris::Dependent
- Defined in:
- lib/merge_ruby_client/hris/types/dependent.rb
Overview
# The Dependent Object
### Description
The `Dependent` object is used to represent a dependent (e.g. child, spouse,
domestic partner, etc) of an `Employee`
### Usage Example
Fetch from the `LIST Dependents` endpoint and filter by `ID` to show all
dependents.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#created_at ⇒ DateTime
readonly
The datetime that this object was created by Merge.
-
#date_of_birth ⇒ DateTime
readonly
The dependent’s date of birth.
-
#employee ⇒ String
readonly
The employee this person is a dependent of.
- #field_mappings ⇒ Hash{String => Object} readonly
-
#first_name ⇒ String
readonly
The dependents’s first name.
-
#gender ⇒ Merge::Hris::GenderEnum
readonly
The dependent’s gender.
-
#home_location ⇒ String
readonly
The dependents’s home address.
- #id ⇒ String readonly
-
#is_student ⇒ Boolean
readonly
Whether or not the dependent is a student.
-
#last_name ⇒ String
readonly
The dependents’s last name.
-
#middle_name ⇒ String
readonly
The dependents’s middle name.
-
#modified_at ⇒ DateTime
readonly
The datetime that this object was modified by Merge.
-
#phone_number ⇒ String
readonly
The dependent’s phone number.
-
#relationship ⇒ Merge::Hris::RelationshipEnum
readonly
The dependent’s relationship to the employee.
- #remote_data ⇒ Array<Merge::Hris::RemoteData> readonly
-
#remote_id ⇒ String
readonly
The third-party API ID of the matching object.
-
#remote_was_deleted ⇒ Boolean
readonly
Indicates whether or not this object has been deleted in the third party platform.
-
#ssn ⇒ String
readonly
The dependents’s social security number.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Hris::Dependent
Deserialize a JSON object to an instance of Dependent.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, first_name: OMIT, middle_name: OMIT, last_name: OMIT, relationship: OMIT, employee: OMIT, date_of_birth: OMIT, gender: OMIT, phone_number: OMIT, home_location: OMIT, is_student: OMIT, ssn: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) ⇒ Merge::Hris::Dependent constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Dependent to a JSON object.
Constructor Details
#initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, first_name: OMIT, middle_name: OMIT, last_name: OMIT, relationship: OMIT, employee: OMIT, date_of_birth: OMIT, gender: OMIT, phone_number: OMIT, home_location: OMIT, is_student: OMIT, ssn: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) ⇒ Merge::Hris::Dependent
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 140 141 142 143 144 145 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 102 def initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, first_name: OMIT, middle_name: OMIT, last_name: OMIT, relationship: OMIT, employee: OMIT, date_of_birth: OMIT, gender: OMIT, phone_number: OMIT, home_location: OMIT, is_student: OMIT, ssn: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) @id = id if id != OMIT @remote_id = remote_id if remote_id != OMIT @created_at = created_at if created_at != OMIT @modified_at = modified_at if modified_at != OMIT @first_name = first_name if first_name != OMIT @middle_name = middle_name if middle_name != OMIT @last_name = last_name if last_name != OMIT @relationship = relationship if relationship != OMIT @employee = employee if employee != OMIT @date_of_birth = date_of_birth if date_of_birth != OMIT @gender = gender if gender != OMIT @phone_number = phone_number if phone_number != OMIT @home_location = home_location if home_location != OMIT @is_student = is_student if is_student != OMIT @ssn = ssn if ssn != OMIT @remote_was_deleted = remote_was_deleted if remote_was_deleted != OMIT @field_mappings = field_mappings if field_mappings != OMIT @remote_data = remote_data if remote_data != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "remote_id": remote_id, "created_at": created_at, "modified_at": modified_at, "first_name": first_name, "middle_name": middle_name, "last_name": last_name, "relationship": relationship, "employee": employee, "date_of_birth": date_of_birth, "gender": gender, "phone_number": phone_number, "home_location": home_location, "is_student": is_student, "ssn": ssn, "remote_was_deleted": remote_was_deleted, "field_mappings": field_mappings, "remote_data": remote_data }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
66 67 68 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 66 def additional_properties @additional_properties end |
#created_at ⇒ DateTime (readonly)
Returns The datetime that this object was created by Merge.
25 26 27 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 25 def created_at @created_at end |
#date_of_birth ⇒ DateTime (readonly)
Returns The dependent’s date of birth.
42 43 44 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 42 def date_of_birth @date_of_birth end |
#employee ⇒ String (readonly)
Returns The employee this person is a dependent of.
40 41 42 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 40 def employee @employee end |
#field_mappings ⇒ Hash{String => Object} (readonly)
62 63 64 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 62 def field_mappings @field_mappings end |
#first_name ⇒ String (readonly)
Returns The dependents’s first name.
29 30 31 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 29 def first_name @first_name end |
#gender ⇒ Merge::Hris::GenderEnum (readonly)
Returns The dependent’s gender.
-
‘MALE` - MALE
-
‘FEMALE` - FEMALE
-
‘NON-BINARY` - NON-BINARY
-
‘OTHER` - OTHER
-
‘PREFER_NOT_TO_DISCLOSE` - PREFER_NOT_TO_DISCLOSE.
49 50 51 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 49 def gender @gender end |
#home_location ⇒ String (readonly)
Returns The dependents’s home address.
53 54 55 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 53 def home_location @home_location end |
#id ⇒ String (readonly)
21 22 23 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 21 def id @id end |
#is_student ⇒ Boolean (readonly)
Returns Whether or not the dependent is a student.
55 56 57 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 55 def is_student @is_student end |
#last_name ⇒ String (readonly)
Returns The dependents’s last name.
33 34 35 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 33 def last_name @last_name end |
#middle_name ⇒ String (readonly)
Returns The dependents’s middle name.
31 32 33 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 31 def middle_name @middle_name end |
#modified_at ⇒ DateTime (readonly)
Returns The datetime that this object was modified by Merge.
27 28 29 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 27 def modified_at @modified_at end |
#phone_number ⇒ String (readonly)
Returns The dependent’s phone number.
51 52 53 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 51 def phone_number @phone_number end |
#relationship ⇒ Merge::Hris::RelationshipEnum (readonly)
Returns The dependent’s relationship to the employee.
-
‘CHILD` - CHILD
-
‘SPOUSE` - SPOUSE
-
‘DOMESTIC_PARTNER` - DOMESTIC_PARTNER.
38 39 40 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 38 def relationship @relationship end |
#remote_data ⇒ Array<Merge::Hris::RemoteData> (readonly)
64 65 66 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 64 def remote_data @remote_data end |
#remote_id ⇒ String (readonly)
Returns The third-party API ID of the matching object.
23 24 25 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 23 def remote_id @remote_id end |
#remote_was_deleted ⇒ Boolean (readonly)
Returns Indicates whether or not this object has been deleted in the third party platform.
60 61 62 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 60 def remote_was_deleted @remote_was_deleted end |
#ssn ⇒ String (readonly)
Returns The dependents’s social security number.
57 58 59 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 57 def ssn @ssn end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Hris::Dependent
Deserialize a JSON object to an instance of Dependent
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 191 192 193 194 195 196 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 151 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] remote_id = parsed_json["remote_id"] created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?) modified_at = (DateTime.parse(parsed_json["modified_at"]) unless parsed_json["modified_at"].nil?) first_name = parsed_json["first_name"] middle_name = parsed_json["middle_name"] last_name = parsed_json["last_name"] relationship = parsed_json["relationship"] employee = parsed_json["employee"] date_of_birth = (DateTime.parse(parsed_json["date_of_birth"]) unless parsed_json["date_of_birth"].nil?) gender = parsed_json["gender"] phone_number = parsed_json["phone_number"] home_location = parsed_json["home_location"] is_student = parsed_json["is_student"] ssn = parsed_json["ssn"] remote_was_deleted = parsed_json["remote_was_deleted"] field_mappings = parsed_json["field_mappings"] remote_data = parsed_json["remote_data"]&.map do |item| item = item.to_json Merge::Hris::RemoteData.from_json(json_object: item) end new( id: id, remote_id: remote_id, created_at: created_at, modified_at: modified_at, first_name: first_name, middle_name: middle_name, last_name: last_name, relationship: relationship, employee: employee, date_of_birth: date_of_birth, gender: gender, phone_number: phone_number, home_location: home_location, is_student: is_student, ssn: ssn, remote_was_deleted: remote_was_deleted, field_mappings: field_mappings, remote_data: remote_data, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 211 def self.validate_raw(obj:) obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.remote_id&.is_a?(String) != false || raise("Passed value for field obj.remote_id is not the expected type, validation failed.") obj.created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.modified_at&.is_a?(DateTime) != false || raise("Passed value for field obj.modified_at is not the expected type, validation failed.") obj.first_name&.is_a?(String) != false || raise("Passed value for field obj.first_name is not the expected type, validation failed.") obj.middle_name&.is_a?(String) != false || raise("Passed value for field obj.middle_name is not the expected type, validation failed.") obj.last_name&.is_a?(String) != false || raise("Passed value for field obj.last_name is not the expected type, validation failed.") obj.relationship&.is_a?(Merge::Hris::RelationshipEnum) != false || raise("Passed value for field obj.relationship is not the expected type, validation failed.") obj.employee&.is_a?(String) != false || raise("Passed value for field obj.employee is not the expected type, validation failed.") obj.date_of_birth&.is_a?(DateTime) != false || raise("Passed value for field obj.date_of_birth is not the expected type, validation failed.") obj.gender&.is_a?(Merge::Hris::GenderEnum) != false || raise("Passed value for field obj.gender is not the expected type, validation failed.") obj.phone_number&.is_a?(String) != false || raise("Passed value for field obj.phone_number is not the expected type, validation failed.") obj.home_location&.is_a?(String) != false || raise("Passed value for field obj.home_location is not the expected type, validation failed.") obj.is_student&.is_a?(Boolean) != false || raise("Passed value for field obj.is_student is not the expected type, validation failed.") obj.ssn&.is_a?(String) != false || raise("Passed value for field obj.ssn is not the expected type, validation failed.") obj.remote_was_deleted&.is_a?(Boolean) != false || raise("Passed value for field obj.remote_was_deleted is not the expected type, validation failed.") obj.field_mappings&.is_a?(Hash) != false || raise("Passed value for field obj.field_mappings is not the expected type, validation failed.") obj.remote_data&.is_a?(Array) != false || raise("Passed value for field obj.remote_data is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Dependent to a JSON object
201 202 203 |
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 201 def to_json(*_args) @_field_set&.to_json end |