merge_hris_client 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +179 -0
  4. data/Rakefile +10 -0
  5. data/config.json +1 -0
  6. data/docs/AccountIntegration.md +28 -0
  7. data/docs/AccountToken.md +18 -0
  8. data/docs/AccountTokenApi.md +79 -0
  9. data/docs/AvailableActions.md +22 -0
  10. data/docs/AvailableActionsApi.md +79 -0
  11. data/docs/Benefit.md +32 -0
  12. data/docs/BenefitPlanTypeEnum.md +15 -0
  13. data/docs/BenefitsApi.md +181 -0
  14. data/docs/CompaniesApi.md +175 -0
  15. data/docs/Company.md +28 -0
  16. data/docs/CountryEnum.md +15 -0
  17. data/docs/DataPassthrough.md +24 -0
  18. data/docs/DataPassthroughRequest.md +26 -0
  19. data/docs/Deduction.md +28 -0
  20. data/docs/Earning.md +26 -0
  21. data/docs/Employee.md +66 -0
  22. data/docs/EmployeePayrollRun.md +42 -0
  23. data/docs/EmployeePayrollRunsApi.md +183 -0
  24. data/docs/EmployeesApi.md +187 -0
  25. data/docs/Employment.md +38 -0
  26. data/docs/EmploymentStatusEnum.md +15 -0
  27. data/docs/EmploymentTypeEnum.md +15 -0
  28. data/docs/EmploymentsApi.md +177 -0
  29. data/docs/EndUserDetails.md +24 -0
  30. data/docs/EndUserDetailsRequest.md +26 -0
  31. data/docs/EthnicityEnum.md +15 -0
  32. data/docs/FlsaStatusEnum.md +15 -0
  33. data/docs/GenderEnum.md +15 -0
  34. data/docs/GenerateKeyApi.md +79 -0
  35. data/docs/GenerateRemoteKeyRequest.md +18 -0
  36. data/docs/LinkToken.md +20 -0
  37. data/docs/LinkTokenApi.md +79 -0
  38. data/docs/Location.md +36 -0
  39. data/docs/LocationsApi.md +175 -0
  40. data/docs/MaritalStatusEnum.md +15 -0
  41. data/docs/MethodEnum.md +15 -0
  42. data/docs/ModelOperation.md +22 -0
  43. data/docs/NullEnum.md +15 -0
  44. data/docs/PaginatedBenefitList.md +22 -0
  45. data/docs/PaginatedCompanyList.md +22 -0
  46. data/docs/PaginatedEmployeeList.md +22 -0
  47. data/docs/PaginatedEmployeePayrollRunList.md +22 -0
  48. data/docs/PaginatedEmploymentList.md +22 -0
  49. data/docs/PaginatedLocationList.md +22 -0
  50. data/docs/PaginatedPayrollRunList.md +22 -0
  51. data/docs/PaginatedTeamList.md +22 -0
  52. data/docs/PaginatedTimeOffList.md +22 -0
  53. data/docs/PassthroughApi.md +81 -0
  54. data/docs/PayCurrencyEnum.md +15 -0
  55. data/docs/PayFrequencyEnum.md +15 -0
  56. data/docs/PayPeriodEnum.md +15 -0
  57. data/docs/PayrollRun.md +32 -0
  58. data/docs/PayrollRunsApi.md +175 -0
  59. data/docs/RegenerateKeyApi.md +79 -0
  60. data/docs/RemoteData.md +20 -0
  61. data/docs/RemoteKey.md +20 -0
  62. data/docs/RemoteKeyForRegeneration.md +18 -0
  63. data/docs/RemoteKeyForRegenerationRequest.md +18 -0
  64. data/docs/RemoteResponse.md +26 -0
  65. data/docs/RequestTypeEnum.md +15 -0
  66. data/docs/RunStateEnum.md +15 -0
  67. data/docs/RunTypeEnum.md +15 -0
  68. data/docs/StateEnum.md +15 -0
  69. data/docs/SyncStatus.md +28 -0
  70. data/docs/SyncStatusApi.md +79 -0
  71. data/docs/Tax.md +28 -0
  72. data/docs/Team.md +24 -0
  73. data/docs/TeamsApi.md +175 -0
  74. data/docs/TimeOff.md +36 -0
  75. data/docs/TimeOffApi.md +183 -0
  76. data/docs/TimeOffStatusEnum.md +15 -0
  77. data/docs/TypeEnum.md +15 -0
  78. data/docs/UnitsEnum.md +15 -0
  79. data/git_push.sh +58 -0
  80. data/lib/merge_hris_client.rb +110 -0
  81. data/lib/merge_hris_client/api/account_token_api.rb +83 -0
  82. data/lib/merge_hris_client/api/available_actions_api.rb +84 -0
  83. data/lib/merge_hris_client/api/benefits_api.rb +196 -0
  84. data/lib/merge_hris_client/api/companies_api.rb +179 -0
  85. data/lib/merge_hris_client/api/employee_payroll_runs_api.rb +199 -0
  86. data/lib/merge_hris_client/api/employees_api.rb +205 -0
  87. data/lib/merge_hris_client/api/employments_api.rb +182 -0
  88. data/lib/merge_hris_client/api/generate_key_api.rb +85 -0
  89. data/lib/merge_hris_client/api/link_token_api.rb +85 -0
  90. data/lib/merge_hris_client/api/locations_api.rb +179 -0
  91. data/lib/merge_hris_client/api/passthrough_api.rb +92 -0
  92. data/lib/merge_hris_client/api/payroll_runs_api.rb +179 -0
  93. data/lib/merge_hris_client/api/regenerate_key_api.rb +85 -0
  94. data/lib/merge_hris_client/api/sync_status_api.rb +84 -0
  95. data/lib/merge_hris_client/api/teams_api.rb +179 -0
  96. data/lib/merge_hris_client/api/time_off_api.rb +199 -0
  97. data/lib/merge_hris_client/api_client.rb +390 -0
  98. data/lib/merge_hris_client/api_error.rb +57 -0
  99. data/lib/merge_hris_client/configuration.rb +279 -0
  100. data/lib/merge_hris_client/models/account_integration.rb +325 -0
  101. data/lib/merge_hris_client/models/account_token.rb +223 -0
  102. data/lib/merge_hris_client/models/available_actions.rb +249 -0
  103. data/lib/merge_hris_client/models/benefit.rb +297 -0
  104. data/lib/merge_hris_client/models/benefit_plan_type_enum.rb +56 -0
  105. data/lib/merge_hris_client/models/company.rb +277 -0
  106. data/lib/merge_hris_client/models/country_enum.rb +282 -0
  107. data/lib/merge_hris_client/models/data_passthrough.rb +262 -0
  108. data/lib/merge_hris_client/models/data_passthrough_request.rb +271 -0
  109. data/lib/merge_hris_client/models/deduction.rb +275 -0
  110. data/lib/merge_hris_client/models/earning.rb +264 -0
  111. data/lib/merge_hris_client/models/employee.rb +544 -0
  112. data/lib/merge_hris_client/models/employee_payroll_run.rb +352 -0
  113. data/lib/merge_hris_client/models/employment.rb +330 -0
  114. data/lib/merge_hris_client/models/employment_status_enum.rb +37 -0
  115. data/lib/merge_hris_client/models/employment_type_enum.rb +39 -0
  116. data/lib/merge_hris_client/models/end_user_details.rb +289 -0
  117. data/lib/merge_hris_client/models/end_user_details_request.rb +298 -0
  118. data/lib/merge_hris_client/models/ethnicity_enum.rb +42 -0
  119. data/lib/merge_hris_client/models/flsa_status_enum.rb +38 -0
  120. data/lib/merge_hris_client/models/gender_enum.rb +39 -0
  121. data/lib/merge_hris_client/models/generate_remote_key_request.rb +224 -0
  122. data/lib/merge_hris_client/models/link_token.rb +237 -0
  123. data/lib/merge_hris_client/models/location.rb +319 -0
  124. data/lib/merge_hris_client/models/marital_status_enum.rb +39 -0
  125. data/lib/merge_hris_client/models/method_enum.rb +41 -0
  126. data/lib/merge_hris_client/models/model_operation.rb +256 -0
  127. data/lib/merge_hris_client/models/paginated_benefit_list.rb +240 -0
  128. data/lib/merge_hris_client/models/paginated_company_list.rb +240 -0
  129. data/lib/merge_hris_client/models/paginated_employee_list.rb +240 -0
  130. data/lib/merge_hris_client/models/paginated_employee_payroll_run_list.rb +240 -0
  131. data/lib/merge_hris_client/models/paginated_employment_list.rb +240 -0
  132. data/lib/merge_hris_client/models/paginated_location_list.rb +240 -0
  133. data/lib/merge_hris_client/models/paginated_payroll_run_list.rb +240 -0
  134. data/lib/merge_hris_client/models/paginated_team_list.rb +240 -0
  135. data/lib/merge_hris_client/models/paginated_time_off_list.rb +240 -0
  136. data/lib/merge_hris_client/models/pay_currency_enum.rb +340 -0
  137. data/lib/merge_hris_client/models/pay_frequency_enum.rb +43 -0
  138. data/lib/merge_hris_client/models/pay_period_enum.rb +42 -0
  139. data/lib/merge_hris_client/models/payroll_run.rb +297 -0
  140. data/lib/merge_hris_client/models/remote_data.rb +234 -0
  141. data/lib/merge_hris_client/models/remote_key.rb +238 -0
  142. data/lib/merge_hris_client/models/remote_key_for_regeneration.rb +224 -0
  143. data/lib/merge_hris_client/models/remote_key_for_regeneration_request.rb +224 -0
  144. data/lib/merge_hris_client/models/remote_response.rb +279 -0
  145. data/lib/merge_hris_client/models/request_type_enum.rb +38 -0
  146. data/lib/merge_hris_client/models/run_state_enum.rb +39 -0
  147. data/lib/merge_hris_client/models/run_type_enum.rb +49 -0
  148. data/lib/merge_hris_client/models/state_enum.rb +93 -0
  149. data/lib/merge_hris_client/models/sync_status.rb +294 -0
  150. data/lib/merge_hris_client/models/tax.rb +275 -0
  151. data/lib/merge_hris_client/models/team.rb +253 -0
  152. data/lib/merge_hris_client/models/time_off.rb +319 -0
  153. data/lib/merge_hris_client/models/time_off_status_enum.rb +39 -0
  154. data/lib/merge_hris_client/models/type_enum.rb +38 -0
  155. data/lib/merge_hris_client/models/units_enum.rb +36 -0
  156. data/lib/merge_hris_client/version.rb +15 -0
  157. data/merge_hris_client-1.0.0.gem +0 -0
  158. data/merge_hris_client.gemspec +38 -0
  159. data/pull_request_template.md +20 -0
  160. data/spec/api/account_token_api_spec.rb +46 -0
  161. data/spec/api/available_actions_api_spec.rb +46 -0
  162. data/spec/api/benefits_api_spec.rb +68 -0
  163. data/spec/api/companies_api_spec.rb +65 -0
  164. data/spec/api/employee_payroll_runs_api_spec.rb +69 -0
  165. data/spec/api/employees_api_spec.rb +71 -0
  166. data/spec/api/employments_api_spec.rb +66 -0
  167. data/spec/api/link_token_api_spec.rb +46 -0
  168. data/spec/api/locations_api_spec.rb +65 -0
  169. data/spec/api/passthrough_api_spec.rb +48 -0
  170. data/spec/api/payroll_runs_api_spec.rb +65 -0
  171. data/spec/api/regenerate_key_api_spec.rb +46 -0
  172. data/spec/api/teams_api_spec.rb +65 -0
  173. data/spec/api/time_off_api_spec.rb +69 -0
  174. data/spec/api_client_spec.rb +226 -0
  175. data/spec/configuration_spec.rb +42 -0
  176. data/spec/models/account_integration_spec.rb +58 -0
  177. data/spec/models/account_token_spec.rb +34 -0
  178. data/spec/models/available_actions_spec.rb +34 -0
  179. data/spec/models/benefit_plan_type_enum_spec.rb +28 -0
  180. data/spec/models/benefit_spec.rb +70 -0
  181. data/spec/models/company_spec.rb +58 -0
  182. data/spec/models/country_enum_spec.rb +28 -0
  183. data/spec/models/data_passthrough_request_spec.rb +58 -0
  184. data/spec/models/data_passthrough_spec.rb +52 -0
  185. data/spec/models/deduction_spec.rb +58 -0
  186. data/spec/models/earning_spec.rb +52 -0
  187. data/spec/models/employee_payroll_run_spec.rb +100 -0
  188. data/spec/models/employee_spec.rb +166 -0
  189. data/spec/models/employment_spec.rb +88 -0
  190. data/spec/models/employment_status_enum_spec.rb +28 -0
  191. data/spec/models/employment_type_enum_spec.rb +28 -0
  192. data/spec/models/end_user_details_request_spec.rb +56 -0
  193. data/spec/models/end_user_details_spec.rb +56 -0
  194. data/spec/models/ethnicity_enum_spec.rb +28 -0
  195. data/spec/models/flsa_status_enum_spec.rb +28 -0
  196. data/spec/models/gender_enum_spec.rb +28 -0
  197. data/spec/models/link_token_spec.rb +40 -0
  198. data/spec/models/location_spec.rb +82 -0
  199. data/spec/models/marital_status_enum_spec.rb +28 -0
  200. data/spec/models/method_enum_spec.rb +28 -0
  201. data/spec/models/model_operation_spec.rb +40 -0
  202. data/spec/models/paginated_benefit_list_spec.rb +46 -0
  203. data/spec/models/paginated_company_list_spec.rb +46 -0
  204. data/spec/models/paginated_employee_list_spec.rb +46 -0
  205. data/spec/models/paginated_employee_payroll_run_list_spec.rb +46 -0
  206. data/spec/models/paginated_employment_list_spec.rb +46 -0
  207. data/spec/models/paginated_location_list_spec.rb +46 -0
  208. data/spec/models/paginated_payroll_run_list_spec.rb +46 -0
  209. data/spec/models/paginated_team_list_spec.rb +46 -0
  210. data/spec/models/paginated_time_off_list_spec.rb +46 -0
  211. data/spec/models/pay_currency_enum_spec.rb +28 -0
  212. data/spec/models/pay_frequency_enum_spec.rb +28 -0
  213. data/spec/models/pay_period_enum_spec.rb +28 -0
  214. data/spec/models/payroll_run_spec.rb +70 -0
  215. data/spec/models/remote_data_spec.rb +40 -0
  216. data/spec/models/remote_key_for_regeneration_request_spec.rb +34 -0
  217. data/spec/models/remote_key_for_regeneration_spec.rb +34 -0
  218. data/spec/models/remote_key_spec.rb +40 -0
  219. data/spec/models/remote_response_spec.rb +58 -0
  220. data/spec/models/request_type_enum_spec.rb +28 -0
  221. data/spec/models/run_state_enum_spec.rb +28 -0
  222. data/spec/models/run_type_enum_spec.rb +28 -0
  223. data/spec/models/state_enum_spec.rb +28 -0
  224. data/spec/models/tax_spec.rb +58 -0
  225. data/spec/models/team_spec.rb +46 -0
  226. data/spec/models/time_off_spec.rb +82 -0
  227. data/spec/models/time_off_status_enum_spec.rb +28 -0
  228. data/spec/models/type_enum_spec.rb +28 -0
  229. data/spec/models/units_enum_spec.rb +28 -0
  230. data/spec/spec_helper.rb +111 -0
  231. data/test_ruby.rb +30 -0
  232. metadata +385 -0
@@ -0,0 +1,275 @@
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.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MergeHRISClient
17
+ # # The Tax Object ### Description The `Tax` object is used to represent a tax for a given employee's payroll run. One run could include several taxes. ### Usage Example Fetch from the `LIST Taxes` endpoint and filter by `ID` to show all taxes.
18
+ class Tax
19
+ attr_accessor :id
20
+
21
+ # The tax's employee payroll run.
22
+ attr_accessor :employee_payroll_run
23
+
24
+ # The tax's name.
25
+ attr_accessor :name
26
+
27
+ # The tax amount.
28
+ attr_accessor :amount
29
+
30
+ # Whether or not the employer is responsible for paying the tax.
31
+ attr_accessor :employer_tax
32
+
33
+ attr_accessor :remote_data
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'id' => :'id',
39
+ :'employee_payroll_run' => :'employee_payroll_run',
40
+ :'name' => :'name',
41
+ :'amount' => :'amount',
42
+ :'employer_tax' => :'employer_tax',
43
+ :'remote_data' => :'remote_data'
44
+ }
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'id' => :'String',
56
+ :'employee_payroll_run' => :'String',
57
+ :'name' => :'String',
58
+ :'amount' => :'Float',
59
+ :'employer_tax' => :'Boolean',
60
+ :'remote_data' => :'Array<RemoteData>'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ :'employee_payroll_run',
68
+ :'name',
69
+ :'amount',
70
+ :'employer_tax',
71
+ :'remote_data'
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeHRISClient::Tax` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeHRISClient::Tax`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'id')
91
+ self.id = attributes[:'id']
92
+ end
93
+
94
+ if attributes.key?(:'employee_payroll_run')
95
+ self.employee_payroll_run = attributes[:'employee_payroll_run']
96
+ end
97
+
98
+ if attributes.key?(:'name')
99
+ self.name = attributes[:'name']
100
+ end
101
+
102
+ if attributes.key?(:'amount')
103
+ self.amount = attributes[:'amount']
104
+ end
105
+
106
+ if attributes.key?(:'employer_tax')
107
+ self.employer_tax = attributes[:'employer_tax']
108
+ end
109
+
110
+ if attributes.key?(:'remote_data')
111
+ if (value = attributes[:'remote_data']).is_a?(Array)
112
+ self.remote_data = value
113
+ end
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ invalid_properties = Array.new
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ true
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ id == o.id &&
136
+ employee_payroll_run == o.employee_payroll_run &&
137
+ name == o.name &&
138
+ amount == o.amount &&
139
+ employer_tax == o.employer_tax &&
140
+ remote_data == o.remote_data
141
+ end
142
+
143
+ # @see the `==` method
144
+ # @param [Object] Object to be compared
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Integer] Hash code
151
+ def hash
152
+ [id, employee_payroll_run, name, amount, employer_tax, remote_data].hash
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def self.build_from_hash(attributes)
159
+ new.build_from_hash(attributes)
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def build_from_hash(attributes)
166
+ return nil unless attributes.is_a?(Hash)
167
+ self.class.openapi_types.each_pair do |key, type|
168
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
169
+ self.send("#{key}=", nil)
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ end
179
+ end
180
+
181
+ self
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def _deserialize(type, value)
189
+ case type.to_sym
190
+ when :Time
191
+ Time.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :Boolean
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ # models (e.g. Pet) or oneOf
222
+ klass = MergeHRISClient.const_get(type)
223
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
+ end
225
+ end
226
+
227
+ # Returns the string representation of the object
228
+ # @return [String] String presentation of the object
229
+ def to_s
230
+ to_hash.to_s
231
+ end
232
+
233
+ # to_body is an alias to to_hash (backward compatibility)
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_body
236
+ to_hash
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+
273
+ end
274
+
275
+ end
@@ -0,0 +1,253 @@
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.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MergeHRISClient
17
+ # # The Team Object ### Description The `Team` object is used to represent a Team within a company. `Employee` objects are often grouped this way. Note that in the Merge HRIS API, company subdivisions are all represented with `Teams`, rather than `Teams` and `Departments`. ### Usage Example If you're building a way to filter by `Team`, you'd hit the `GET Teams` endpoint to fetch the `Teams`, and then use the `ID` of the team your user selects to filter the `GET Employees` endpoint.
18
+ class Team
19
+ attr_accessor :id
20
+
21
+ # The third-party API ID of the matching object.
22
+ attr_accessor :remote_id
23
+
24
+ # The team's name.
25
+ attr_accessor :name
26
+
27
+ attr_accessor :remote_data
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'id' => :'id',
33
+ :'remote_id' => :'remote_id',
34
+ :'name' => :'name',
35
+ :'remote_data' => :'remote_data'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'id' => :'String',
48
+ :'remote_id' => :'String',
49
+ :'name' => :'String',
50
+ :'remote_data' => :'Array<RemoteData>'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ :'remote_id',
58
+ :'name',
59
+ :'remote_data'
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeHRISClient::Team` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeHRISClient::Team`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'id')
79
+ self.id = attributes[:'id']
80
+ end
81
+
82
+ if attributes.key?(:'remote_id')
83
+ self.remote_id = attributes[:'remote_id']
84
+ end
85
+
86
+ if attributes.key?(:'name')
87
+ self.name = attributes[:'name']
88
+ end
89
+
90
+ if attributes.key?(:'remote_data')
91
+ if (value = attributes[:'remote_data']).is_a?(Array)
92
+ self.remote_data = value
93
+ end
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ id == o.id &&
116
+ remote_id == o.remote_id &&
117
+ name == o.name &&
118
+ remote_data == o.remote_data
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Integer] Hash code
129
+ def hash
130
+ [id, remote_id, name, remote_data].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def self.build_from_hash(attributes)
137
+ new.build_from_hash(attributes)
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ self.class.openapi_types.each_pair do |key, type|
146
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
147
+ self.send("#{key}=", nil)
148
+ elsif type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ end
157
+ end
158
+
159
+ self
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def _deserialize(type, value)
167
+ case type.to_sym
168
+ when :Time
169
+ Time.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :Boolean
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ # models (e.g. Pet) or oneOf
200
+ klass = MergeHRISClient.const_get(type)
201
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ if value.nil?
224
+ is_nullable = self.class.openapi_nullable.include?(attr)
225
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
226
+ end
227
+
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+
251
+ end
252
+
253
+ end