Class: Merge::Hris::Dependent

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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

Parameters:

  • id (String) (defaults to: OMIT)
  • remote_id (String) (defaults to: OMIT)

    The third-party API ID of the matching object.

  • created_at (DateTime) (defaults to: OMIT)

    The datetime that this object was created by Merge.

  • modified_at (DateTime) (defaults to: OMIT)

    The datetime that this object was modified by Merge.

  • first_name (String) (defaults to: OMIT)

    The dependents’s first name.

  • middle_name (String) (defaults to: OMIT)

    The dependents’s middle name.

  • last_name (String) (defaults to: OMIT)

    The dependents’s last name.

  • relationship (Merge::Hris::RelationshipEnum) (defaults to: OMIT)

    The dependent’s relationship to the employee.

    • ‘CHILD` - CHILD

    • ‘SPOUSE` - SPOUSE

    • ‘DOMESTIC_PARTNER` - DOMESTIC_PARTNER

  • employee (String) (defaults to: OMIT)

    The employee this person is a dependent of.

  • date_of_birth (DateTime) (defaults to: OMIT)

    The dependent’s date of birth.

  • gender (Merge::Hris::GenderEnum) (defaults to: OMIT)

    The dependent’s gender.

    • ‘MALE` - MALE

    • ‘FEMALE` - FEMALE

    • ‘NON-BINARY` - NON-BINARY

    • ‘OTHER` - OTHER

    • ‘PREFER_NOT_TO_DISCLOSE` - PREFER_NOT_TO_DISCLOSE

  • phone_number (String) (defaults to: OMIT)

    The dependent’s phone number.

  • home_location (String) (defaults to: OMIT)

    The dependents’s home address.

  • is_student (Boolean) (defaults to: OMIT)

    Whether or not the dependent is a student

  • ssn (String) (defaults to: OMIT)

    The dependents’s social security number.

  • remote_was_deleted (Boolean) (defaults to: OMIT)

    Indicates whether or not this object has been deleted in the third party platform.

  • field_mappings (Hash{String => Object}) (defaults to: OMIT)
  • remote_data (Array<Merge::Hris::RemoteData>) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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_atDateTime (readonly)

Returns The datetime that this object was created by Merge.

Returns:

  • (DateTime)

    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_birthDateTime (readonly)

Returns The dependent’s date of birth.

Returns:

  • (DateTime)

    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

#employeeString (readonly)

Returns The employee this person is a dependent of.

Returns:

  • (String)

    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_mappingsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


62
63
64
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 62

def field_mappings
  @field_mappings
end

#first_nameString (readonly)

Returns The dependents’s first name.

Returns:

  • (String)

    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

#genderMerge::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.

Returns:

  • (Merge::Hris::GenderEnum)

    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_locationString (readonly)

Returns The dependents’s home address.

Returns:

  • (String)

    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

#idString (readonly)

Returns:

  • (String)


21
22
23
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 21

def id
  @id
end

#is_studentBoolean (readonly)

Returns Whether or not the dependent is a student.

Returns:

  • (Boolean)

    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_nameString (readonly)

Returns The dependents’s last name.

Returns:

  • (String)

    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_nameString (readonly)

Returns The dependents’s middle name.

Returns:

  • (String)

    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_atDateTime (readonly)

Returns The datetime that this object was modified by Merge.

Returns:

  • (DateTime)

    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_numberString (readonly)

Returns The dependent’s phone number.

Returns:

  • (String)

    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

#relationshipMerge::Hris::RelationshipEnum (readonly)

Returns The dependent’s relationship to the employee.

  • ‘CHILD` - CHILD

  • ‘SPOUSE` - SPOUSE

  • ‘DOMESTIC_PARTNER` - DOMESTIC_PARTNER.

Returns:

  • (Merge::Hris::RelationshipEnum)

    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_dataArray<Merge::Hris::RemoteData> (readonly)

Returns:



64
65
66
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 64

def remote_data
  @remote_data
end

#remote_idString (readonly)

Returns The third-party API ID of the matching object.

Returns:

  • (String)

    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_deletedBoolean (readonly)

Returns Indicates whether or not this object has been deleted in the third party platform.

Returns:

  • (Boolean)

    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

#ssnString (readonly)

Returns The dependents’s social security number.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


201
202
203
# File 'lib/merge_ruby_client/hris/types/dependent.rb', line 201

def to_json(*_args)
  @_field_set&.to_json
end