merge_hris_client 3.2.1 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +49 -16
  3. data/docs/AccountDetails.md +3 -1
  4. data/docs/AccountDetailsAndActions.md +7 -3
  5. data/docs/AccountIntegration.md +8 -4
  6. data/docs/AdvancedMetadata.md +28 -0
  7. data/docs/AuditLogEvent.md +32 -0
  8. data/docs/AuditTrailApi.md +91 -0
  9. data/docs/BankInfo.md +6 -4
  10. data/docs/BankInfoApi.md +4 -4
  11. data/docs/Benefit.md +6 -4
  12. data/docs/CommonModelScopeAPI.md +18 -0
  13. data/docs/Company.md +6 -4
  14. data/docs/CreateFieldMappingRequest.md +28 -0
  15. data/docs/DataPassthroughRequest.md +4 -4
  16. data/docs/DebugModelLogSummary.md +1 -1
  17. data/docs/Deduction.md +6 -4
  18. data/docs/Dependent.md +6 -4
  19. data/docs/Earning.md +6 -4
  20. data/docs/Employee.md +7 -3
  21. data/docs/EmployeePayrollRun.md +6 -4
  22. data/docs/EmployeeRequest.md +2 -0
  23. data/docs/EmployeesApi.md +10 -4
  24. data/docs/EmployerBenefit.md +6 -4
  25. data/docs/Employment.md +6 -4
  26. data/docs/EmploymentsApi.md +4 -4
  27. data/docs/EndUserDetailsRequest.md +13 -7
  28. data/docs/EventTypeEnum.md +15 -0
  29. data/docs/ExternalTargetFieldAPI.md +22 -0
  30. data/docs/ExternalTargetFieldAPIResponse.md +48 -0
  31. data/docs/FieldMappingApi.md +455 -0
  32. data/docs/FieldMappingApiInstance.md +24 -0
  33. data/docs/FieldMappingApiInstanceRemoteField.md +22 -0
  34. data/docs/FieldMappingApiInstanceRemoteFieldRemoteEndpointInfo.md +22 -0
  35. data/docs/FieldMappingApiInstanceResponse.md +48 -0
  36. data/docs/FieldMappingApiInstanceTargetField.md +22 -0
  37. data/docs/FieldMappingInstanceResponse.md +24 -0
  38. data/docs/FieldPermissionDeserializer.md +20 -0
  39. data/docs/FieldPermissionDeserializerRequest.md +20 -0
  40. data/docs/ForceResyncApi.md +1 -1
  41. data/docs/GenerateRemoteKeyRequest.md +1 -1
  42. data/docs/Group.md +9 -5
  43. data/docs/GroupsApi.md +8 -4
  44. data/docs/IndividualCommonModelScopeDeserializer.md +22 -0
  45. data/docs/IndividualCommonModelScopeDeserializerRequest.md +22 -0
  46. data/docs/Issue.md +1 -1
  47. data/docs/IssuesApi.md +5 -3
  48. data/docs/LinkTokenApi.md +1 -1
  49. data/docs/LinkedAccountCommonModelScopeDeserializerRequest.md +18 -0
  50. data/docs/LinkedAccountsApi.md +2 -2
  51. data/docs/Location.md +6 -4
  52. data/docs/LocationsApi.md +6 -4
  53. data/docs/MetaResponse.md +1 -1
  54. data/docs/ModelPermissionDeserializer.md +18 -0
  55. data/docs/ModelPermissionDeserializerRequest.md +18 -0
  56. data/docs/PaginatedAuditLogEventList.md +22 -0
  57. data/docs/PaginatedTimesheetEntryList.md +22 -0
  58. data/docs/PatchedEditFieldMappingRequest.md +22 -0
  59. data/docs/PayGroup.md +6 -4
  60. data/docs/PayrollRun.md +6 -4
  61. data/docs/PayrollRunsApi.md +4 -4
  62. data/docs/RemoteEndpointInfo.md +22 -0
  63. data/docs/RemoteFieldAPI.md +28 -0
  64. data/docs/RemoteFieldAPIResponse.md +48 -0
  65. data/docs/RemoteKeyForRegenerationRequest.md +1 -1
  66. data/docs/RoleEnum.md +15 -0
  67. data/docs/ScopesApi.md +222 -0
  68. data/docs/SyncStatusApi.md +1 -1
  69. data/docs/Tax.md +6 -4
  70. data/docs/Team.md +6 -4
  71. data/docs/TimeOff.md +5 -3
  72. data/docs/TimeOffApi.md +12 -4
  73. data/docs/TimeOffBalance.md +6 -4
  74. data/docs/TimeOffBalancesApi.md +4 -4
  75. data/docs/TimesheetEntriesApi.md +341 -0
  76. data/docs/TimesheetEntry.md +38 -0
  77. data/docs/TimesheetEntryEndpointRequest.md +18 -0
  78. data/docs/TimesheetEntryRequest.md +28 -0
  79. data/docs/TimesheetEntryResponse.md +24 -0
  80. data/lib/merge_hris_client/api/audit_trail_api.rb +95 -0
  81. data/lib/merge_hris_client/api/bank_info_api.rb +4 -4
  82. data/lib/merge_hris_client/api/employees_api.rb +13 -4
  83. data/lib/merge_hris_client/api/employments_api.rb +4 -4
  84. data/lib/merge_hris_client/api/field_mapping_api.rb +424 -0
  85. data/lib/merge_hris_client/api/force_resync_api.rb +2 -2
  86. data/lib/merge_hris_client/api/groups_api.rb +10 -4
  87. data/lib/merge_hris_client/api/issues_api.rb +7 -4
  88. data/lib/merge_hris_client/api/linked_accounts_api.rb +3 -3
  89. data/lib/merge_hris_client/api/locations_api.rb +11 -4
  90. data/lib/merge_hris_client/api/payroll_runs_api.rb +4 -4
  91. data/lib/merge_hris_client/api/scopes_api.rb +209 -0
  92. data/lib/merge_hris_client/api/sync_status_api.rb +2 -2
  93. data/lib/merge_hris_client/api/time_off_api.rb +16 -4
  94. data/lib/merge_hris_client/api/time_off_balances_api.rb +4 -4
  95. data/lib/merge_hris_client/api/timesheet_entries_api.rb +342 -0
  96. data/lib/merge_hris_client/configuration.rb +4 -0
  97. data/lib/merge_hris_client/models/account_details.rb +14 -5
  98. data/lib/merge_hris_client/models/account_details_and_actions.rb +28 -4
  99. data/lib/merge_hris_client/models/account_integration.rb +36 -14
  100. data/lib/merge_hris_client/models/advanced_metadata.rb +270 -0
  101. data/lib/merge_hris_client/models/audit_log_event.rb +356 -0
  102. data/lib/merge_hris_client/models/bank_info.rb +24 -16
  103. data/lib/merge_hris_client/models/benefit.rb +24 -16
  104. data/lib/merge_hris_client/models/common_model_scope_api.rb +226 -0
  105. data/lib/merge_hris_client/models/company.rb +24 -16
  106. data/lib/merge_hris_client/models/create_field_mapping_request.rb +396 -0
  107. data/lib/merge_hris_client/models/data_passthrough_request.rb +3 -0
  108. data/lib/merge_hris_client/models/deduction.rb +24 -16
  109. data/lib/merge_hris_client/models/dependent.rb +24 -16
  110. data/lib/merge_hris_client/models/earning.rb +24 -16
  111. data/lib/merge_hris_client/models/employee.rb +34 -15
  112. data/lib/merge_hris_client/models/employee_payroll_run.rb +24 -16
  113. data/lib/merge_hris_client/models/employee_request.rb +12 -1
  114. data/lib/merge_hris_client/models/employer_benefit.rb +24 -16
  115. data/lib/merge_hris_client/models/employment.rb +24 -16
  116. data/lib/merge_hris_client/models/end_user_details_request.rb +67 -6
  117. data/lib/merge_hris_client/models/event_type_enum.rb +81 -0
  118. data/lib/merge_hris_client/models/external_target_field_api.rb +239 -0
  119. data/lib/merge_hris_client/models/external_target_field_api_response.rb +385 -0
  120. data/lib/merge_hris_client/models/field_mapping_api_instance.rb +247 -0
  121. data/lib/merge_hris_client/models/field_mapping_api_instance_remote_field.rb +253 -0
  122. data/lib/merge_hris_client/models/field_mapping_api_instance_remote_field_remote_endpoint_info.rb +241 -0
  123. data/lib/merge_hris_client/models/field_mapping_api_instance_response.rb +385 -0
  124. data/lib/merge_hris_client/models/field_mapping_api_instance_target_field.rb +251 -0
  125. data/lib/merge_hris_client/models/field_mapping_instance_response.rb +266 -0
  126. data/lib/merge_hris_client/models/field_permission_deserializer.rb +231 -0
  127. data/lib/merge_hris_client/models/field_permission_deserializer_request.rb +231 -0
  128. data/lib/merge_hris_client/models/generate_remote_key_request.rb +1 -0
  129. data/lib/merge_hris_client/models/group.rb +34 -15
  130. data/lib/merge_hris_client/models/individual_common_model_scope_deserializer.rb +243 -0
  131. data/lib/merge_hris_client/models/individual_common_model_scope_deserializer_request.rb +262 -0
  132. data/lib/merge_hris_client/models/linked_account_common_model_scope_deserializer_request.rb +226 -0
  133. data/lib/merge_hris_client/models/location.rb +24 -16
  134. data/lib/merge_hris_client/models/model_permission_deserializer.rb +218 -0
  135. data/lib/merge_hris_client/models/model_permission_deserializer_request.rb +218 -0
  136. data/lib/merge_hris_client/models/paginated_audit_log_event_list.rb +240 -0
  137. data/lib/merge_hris_client/models/paginated_timesheet_entry_list.rb +240 -0
  138. data/lib/merge_hris_client/models/patched_edit_field_mapping_request.rb +271 -0
  139. data/lib/merge_hris_client/models/pay_group.rb +24 -16
  140. data/lib/merge_hris_client/models/payroll_run.rb +24 -16
  141. data/lib/merge_hris_client/models/remote_endpoint_info.rb +253 -0
  142. data/lib/merge_hris_client/models/remote_field_api.rb +285 -0
  143. data/lib/merge_hris_client/models/remote_field_api_response.rb +385 -0
  144. data/lib/merge_hris_client/models/remote_key_for_regeneration_request.rb +1 -0
  145. data/lib/merge_hris_client/models/role_enum.rb +49 -0
  146. data/lib/merge_hris_client/models/tax.rb +24 -16
  147. data/lib/merge_hris_client/models/team.rb +24 -16
  148. data/lib/merge_hris_client/models/time_off.rb +23 -15
  149. data/lib/merge_hris_client/models/time_off_balance.rb +24 -16
  150. data/lib/merge_hris_client/models/timesheet_entry.rb +326 -0
  151. data/lib/merge_hris_client/models/timesheet_entry_endpoint_request.rb +223 -0
  152. data/lib/merge_hris_client/models/timesheet_entry_request.rb +278 -0
  153. data/lib/merge_hris_client/models/timesheet_entry_response.rb +266 -0
  154. data/lib/merge_hris_client/version.rb +1 -1
  155. data/lib/merge_hris_client.rb +35 -21
  156. data/spec/api/audit_trail_api_spec.rb +51 -0
  157. data/spec/api/bank_info_api_spec.rb +2 -2
  158. data/spec/api/employees_api_spec.rb +5 -2
  159. data/spec/api/employments_api_spec.rb +2 -2
  160. data/spec/api/field_mapping_api_spec.rb +107 -0
  161. data/spec/api/force_resync_api_spec.rb +1 -1
  162. data/spec/api/groups_api_spec.rb +4 -2
  163. data/spec/api/issues_api_spec.rb +3 -2
  164. data/spec/api/linked_accounts_api_spec.rb +1 -1
  165. data/spec/api/locations_api_spec.rb +3 -2
  166. data/spec/api/payroll_runs_api_spec.rb +2 -2
  167. data/spec/api/scopes_api_spec.rb +68 -0
  168. data/spec/api/sync_status_api_spec.rb +1 -1
  169. data/spec/api/time_off_api_spec.rb +6 -2
  170. data/spec/api/time_off_balances_api_spec.rb +2 -2
  171. data/spec/api/timesheet_entries_api_spec.rb +99 -0
  172. data/spec/models/account_details_and_actions_spec.rb +12 -0
  173. data/spec/models/account_details_spec.rb +6 -0
  174. data/spec/models/account_integration_spec.rb +14 -2
  175. data/spec/models/advanced_metadata_spec.rb +64 -0
  176. data/spec/models/audit_log_event_spec.rb +76 -0
  177. data/spec/models/bank_info_spec.rb +12 -6
  178. data/spec/models/benefit_spec.rb +12 -6
  179. data/spec/models/common_model_scope_api_spec.rb +34 -0
  180. data/spec/models/company_spec.rb +11 -5
  181. data/spec/models/create_field_mapping_request_spec.rb +64 -0
  182. data/spec/models/deduction_spec.rb +12 -6
  183. data/spec/models/dependent_spec.rb +12 -6
  184. data/spec/models/earning_spec.rb +11 -5
  185. data/spec/models/employee_payroll_run_spec.rb +12 -6
  186. data/spec/models/employee_request_spec.rb +6 -0
  187. data/spec/models/employee_spec.rb +18 -6
  188. data/spec/models/employer_benefit_spec.rb +12 -6
  189. data/spec/models/employment_spec.rb +12 -6
  190. data/spec/models/end_user_details_request_spec.rb +18 -0
  191. data/spec/models/event_type_enum_spec.rb +28 -0
  192. data/spec/models/external_target_field_api_response_spec.rb +124 -0
  193. data/spec/models/external_target_field_api_spec.rb +46 -0
  194. data/spec/models/field_mapping_api_instance_remote_field_remote_endpoint_info_spec.rb +46 -0
  195. data/spec/models/field_mapping_api_instance_remote_field_spec.rb +46 -0
  196. data/spec/models/field_mapping_api_instance_response_spec.rb +124 -0
  197. data/spec/models/field_mapping_api_instance_spec.rb +52 -0
  198. data/spec/models/field_mapping_api_instance_target_field_spec.rb +46 -0
  199. data/spec/models/field_mapping_instance_response_spec.rb +52 -0
  200. data/spec/models/field_permission_deserializer_request_spec.rb +40 -0
  201. data/spec/models/field_permission_deserializer_spec.rb +40 -0
  202. data/spec/models/group_spec.rb +13 -1
  203. data/spec/models/individual_common_model_scope_deserializer_request_spec.rb +46 -0
  204. data/spec/models/individual_common_model_scope_deserializer_spec.rb +46 -0
  205. data/spec/models/linked_account_common_model_scope_deserializer_request_spec.rb +34 -0
  206. data/spec/models/location_spec.rb +12 -6
  207. data/spec/models/model_permission_deserializer_request_spec.rb +34 -0
  208. data/spec/models/model_permission_deserializer_spec.rb +34 -0
  209. data/spec/models/paginated_audit_log_event_list_spec.rb +46 -0
  210. data/spec/models/paginated_timesheet_entry_list_spec.rb +46 -0
  211. data/spec/models/patched_edit_field_mapping_request_spec.rb +46 -0
  212. data/spec/models/pay_group_spec.rb +9 -3
  213. data/spec/models/payroll_run_spec.rb +12 -6
  214. data/spec/models/remote_endpoint_info_spec.rb +46 -0
  215. data/spec/models/remote_field_api_response_spec.rb +124 -0
  216. data/spec/models/remote_field_api_spec.rb +64 -0
  217. data/spec/models/role_enum_spec.rb +28 -0
  218. data/spec/models/tax_spec.rb +12 -6
  219. data/spec/models/team_spec.rb +10 -4
  220. data/spec/models/time_off_balance_spec.rb +12 -6
  221. data/spec/models/time_off_spec.rb +12 -6
  222. data/spec/models/timesheet_entry_endpoint_request_spec.rb +34 -0
  223. data/spec/models/timesheet_entry_request_spec.rb +64 -0
  224. data/spec/models/timesheet_entry_response_spec.rb +52 -0
  225. data/spec/models/timesheet_entry_spec.rb +94 -0
  226. metadata +266 -126
@@ -0,0 +1,266 @@
1
+ =begin
2
+ #Merge HRIS API
3
+
4
+ #The unified API for building rich integrations with multiple HR Information System platforms.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: hello@merge.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MergeHRISClient
17
+ class FieldMappingInstanceResponse
18
+ attr_accessor :model
19
+
20
+ attr_accessor :warnings
21
+
22
+ attr_accessor :errors
23
+
24
+ attr_accessor :logs
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'model' => :'model',
30
+ :'warnings' => :'warnings',
31
+ :'errors' => :'errors',
32
+ :'logs' => :'logs'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'model' => :'FieldMappingApiInstance',
45
+ :'warnings' => :'Array<WarningValidationProblem>',
46
+ :'errors' => :'Array<ErrorValidationProblem>',
47
+ :'logs' => :'Array<DebugModeLog>'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeHRISClient::FieldMappingInstanceResponse` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeHRISClient::FieldMappingInstanceResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'model')
73
+ self.model = attributes[:'model']
74
+ end
75
+
76
+ if attributes.key?(:'warnings')
77
+ if (value = attributes[:'warnings']).is_a?(Array)
78
+ self.warnings = value
79
+ end
80
+ end
81
+
82
+ if attributes.key?(:'errors')
83
+ if (value = attributes[:'errors']).is_a?(Array)
84
+ self.errors = value
85
+ end
86
+ end
87
+
88
+ if attributes.key?(:'logs')
89
+ if (value = attributes[:'logs']).is_a?(Array)
90
+ self.logs = value
91
+ end
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ if @model.nil?
100
+ invalid_properties.push('invalid value for "model", model cannot be nil.')
101
+ end
102
+
103
+ if @warnings.nil?
104
+ invalid_properties.push('invalid value for "warnings", warnings cannot be nil.')
105
+ end
106
+
107
+ if @errors.nil?
108
+ invalid_properties.push('invalid value for "errors", errors cannot be nil.')
109
+ end
110
+
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
117
+ return false if @model.nil?
118
+ return false if @warnings.nil?
119
+ return false if @errors.nil?
120
+ true
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] Object to be compared
125
+ def ==(o)
126
+ return true if self.equal?(o)
127
+ self.class == o.class &&
128
+ model == o.model &&
129
+ warnings == o.warnings &&
130
+ errors == o.errors &&
131
+ logs == o.logs
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Integer] Hash code
142
+ def hash
143
+ [model, warnings, errors, logs].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def self.build_from_hash(attributes)
150
+ new.build_from_hash(attributes)
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ self.class.openapi_types.each_pair do |key, type|
159
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
160
+ self.send("#{key}=", nil)
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
165
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
166
+ end
167
+ elsif !attributes[self.class.attribute_map[key]].nil?
168
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
169
+ end
170
+ end
171
+
172
+ self
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def _deserialize(type, value)
180
+ case type.to_sym
181
+ when :Time
182
+ Time.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ # models (e.g. Pet) or oneOf
213
+ klass = MergeHRISClient.const_get(type)
214
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+
264
+ end
265
+
266
+ end
@@ -0,0 +1,231 @@
1
+ =begin
2
+ #Merge HRIS API
3
+
4
+ #The unified API for building rich integrations with multiple HR Information System platforms.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: hello@merge.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MergeHRISClient
17
+ class FieldPermissionDeserializer
18
+ attr_accessor :enabled
19
+
20
+ attr_accessor :disabled
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'enabled' => :'enabled',
26
+ :'disabled' => :'disabled'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'enabled' => :'Array<Object>',
39
+ :'disabled' => :'Array<Object>'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeHRISClient::FieldPermissionDeserializer` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeHRISClient::FieldPermissionDeserializer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'enabled')
65
+ if (value = attributes[:'enabled']).is_a?(Array)
66
+ self.enabled = value
67
+ end
68
+ end
69
+
70
+ if attributes.key?(:'disabled')
71
+ if (value = attributes[:'disabled']).is_a?(Array)
72
+ self.disabled = value
73
+ end
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ enabled == o.enabled &&
96
+ disabled == o.disabled
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [enabled, disabled].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ new.build_from_hash(attributes)
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.openapi_types.each_pair do |key, type|
124
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
125
+ self.send("#{key}=", nil)
126
+ elsif type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ end
135
+ end
136
+
137
+ self
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def _deserialize(type, value)
145
+ case type.to_sym
146
+ when :Time
147
+ Time.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ # models (e.g. Pet) or oneOf
178
+ klass = MergeHRISClient.const_get(type)
179
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.compact.map { |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to? :to_hash
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end
228
+
229
+ end
230
+
231
+ end