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,249 @@
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 AvailableActions Object ### Description The `Activity` object is used to see all available model/operation combinations for an integration. ### Usage Example Fetch all the actions available for the `Zenefits` integration.
18
+ class AvailableActions
19
+ attr_accessor :integration
20
+
21
+ attr_accessor :passthrough_available
22
+
23
+ attr_accessor :available_model_operations
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'integration' => :'integration',
29
+ :'passthrough_available' => :'passthrough_available',
30
+ :'available_model_operations' => :'available_model_operations'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'integration' => :'AccountIntegration',
43
+ :'passthrough_available' => :'Boolean',
44
+ :'available_model_operations' => :'Array<ModelOperation>'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeHRISClient::AvailableActions` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeHRISClient::AvailableActions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'integration')
70
+ self.integration = attributes[:'integration']
71
+ end
72
+
73
+ if attributes.key?(:'passthrough_available')
74
+ self.passthrough_available = attributes[:'passthrough_available']
75
+ end
76
+
77
+ if attributes.key?(:'available_model_operations')
78
+ if (value = attributes[:'available_model_operations']).is_a?(Array)
79
+ self.available_model_operations = value
80
+ end
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if @integration.nil?
89
+ invalid_properties.push('invalid value for "integration", integration cannot be nil.')
90
+ end
91
+
92
+ if @passthrough_available.nil?
93
+ invalid_properties.push('invalid value for "passthrough_available", passthrough_available cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ return false if @integration.nil?
103
+ return false if @passthrough_available.nil?
104
+ true
105
+ end
106
+
107
+ # Checks equality by comparing each attribute.
108
+ # @param [Object] Object to be compared
109
+ def ==(o)
110
+ return true if self.equal?(o)
111
+ self.class == o.class &&
112
+ integration == o.integration &&
113
+ passthrough_available == o.passthrough_available &&
114
+ available_model_operations == o.available_model_operations
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Integer] Hash code
125
+ def hash
126
+ [integration, passthrough_available, available_model_operations].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def self.build_from_hash(attributes)
133
+ new.build_from_hash(attributes)
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ self.class.openapi_types.each_pair do |key, type|
142
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
143
+ self.send("#{key}=", nil)
144
+ elsif type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
148
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ end
150
+ elsif !attributes[self.class.attribute_map[key]].nil?
151
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ end
153
+ end
154
+
155
+ self
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def _deserialize(type, value)
163
+ case type.to_sym
164
+ when :Time
165
+ Time.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :Boolean
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ # models (e.g. Pet) or oneOf
196
+ klass = MergeHRISClient.const_get(type)
197
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+
247
+ end
248
+
249
+ end
@@ -0,0 +1,297 @@
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 Benefit Object ### Description The `Benefit` object is used to represent a Benefit for an employee. ### Usage Example Fetch from the `LIST Benefits` endpoint and filter by `ID` to show all benefits.
18
+ class Benefit
19
+ attr_accessor :id
20
+
21
+ # The third-party API ID of the matching object.
22
+ attr_accessor :remote_id
23
+
24
+ # The employee on the plan.
25
+ attr_accessor :employee
26
+
27
+ # The name of the benefit provider.
28
+ attr_accessor :provider_name
29
+
30
+ # The type of benefit plan
31
+ attr_accessor :benefit_plan_type
32
+
33
+ # The employee's contribution.
34
+ attr_accessor :employee_contribution
35
+
36
+ # The company's contribution.
37
+ attr_accessor :company_contribution
38
+
39
+ attr_accessor :remote_data
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'id' => :'id',
45
+ :'remote_id' => :'remote_id',
46
+ :'employee' => :'employee',
47
+ :'provider_name' => :'provider_name',
48
+ :'benefit_plan_type' => :'benefit_plan_type',
49
+ :'employee_contribution' => :'employee_contribution',
50
+ :'company_contribution' => :'company_contribution',
51
+ :'remote_data' => :'remote_data'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'id' => :'String',
64
+ :'remote_id' => :'String',
65
+ :'employee' => :'String',
66
+ :'provider_name' => :'String',
67
+ :'benefit_plan_type' => :'BenefitPlanTypeEnum',
68
+ :'employee_contribution' => :'Float',
69
+ :'company_contribution' => :'Float',
70
+ :'remote_data' => :'Array<RemoteData>'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ :'remote_id',
78
+ :'employee',
79
+ :'provider_name',
80
+ :'benefit_plan_type',
81
+ :'employee_contribution',
82
+ :'company_contribution',
83
+ :'remote_data'
84
+ ])
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ if (!attributes.is_a?(Hash))
91
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeHRISClient::Benefit` initialize method"
92
+ end
93
+
94
+ # check to see if the attribute exists and convert string to symbol for hash key
95
+ attributes = attributes.each_with_object({}) { |(k, v), h|
96
+ if (!self.class.attribute_map.key?(k.to_sym))
97
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeHRISClient::Benefit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
98
+ end
99
+ h[k.to_sym] = v
100
+ }
101
+
102
+ if attributes.key?(:'id')
103
+ self.id = attributes[:'id']
104
+ end
105
+
106
+ if attributes.key?(:'remote_id')
107
+ self.remote_id = attributes[:'remote_id']
108
+ end
109
+
110
+ if attributes.key?(:'employee')
111
+ self.employee = attributes[:'employee']
112
+ end
113
+
114
+ if attributes.key?(:'provider_name')
115
+ self.provider_name = attributes[:'provider_name']
116
+ end
117
+
118
+ if attributes.key?(:'benefit_plan_type')
119
+ self.benefit_plan_type = attributes[:'benefit_plan_type']
120
+ end
121
+
122
+ if attributes.key?(:'employee_contribution')
123
+ self.employee_contribution = attributes[:'employee_contribution']
124
+ end
125
+
126
+ if attributes.key?(:'company_contribution')
127
+ self.company_contribution = attributes[:'company_contribution']
128
+ end
129
+
130
+ if attributes.key?(:'remote_data')
131
+ if (value = attributes[:'remote_data']).is_a?(Array)
132
+ self.remote_data = value
133
+ end
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ invalid_properties = Array.new
141
+ invalid_properties
142
+ end
143
+
144
+ # Check to see if the all the properties in the model are valid
145
+ # @return true if the model is valid
146
+ def valid?
147
+ true
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ id == o.id &&
156
+ remote_id == o.remote_id &&
157
+ employee == o.employee &&
158
+ provider_name == o.provider_name &&
159
+ benefit_plan_type == o.benefit_plan_type &&
160
+ employee_contribution == o.employee_contribution &&
161
+ company_contribution == o.company_contribution &&
162
+ remote_data == o.remote_data
163
+ end
164
+
165
+ # @see the `==` method
166
+ # @param [Object] Object to be compared
167
+ def eql?(o)
168
+ self == o
169
+ end
170
+
171
+ # Calculates hash code according to all attributes.
172
+ # @return [Integer] Hash code
173
+ def hash
174
+ [id, remote_id, employee, provider_name, benefit_plan_type, employee_contribution, company_contribution, remote_data].hash
175
+ end
176
+
177
+ # Builds the object from hash
178
+ # @param [Hash] attributes Model attributes in the form of hash
179
+ # @return [Object] Returns the model itself
180
+ def self.build_from_hash(attributes)
181
+ new.build_from_hash(attributes)
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ self.class.openapi_types.each_pair do |key, type|
190
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
191
+ self.send("#{key}=", nil)
192
+ elsif type =~ /\AArray<(.*)>/i
193
+ # check to ensure the input is an array given that the attribute
194
+ # is documented as an array but the input is not
195
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
196
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
197
+ end
198
+ elsif !attributes[self.class.attribute_map[key]].nil?
199
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
200
+ end
201
+ end
202
+
203
+ self
204
+ end
205
+
206
+ # Deserializes the data based on type
207
+ # @param string type Data type
208
+ # @param string value Value to be deserialized
209
+ # @return [Object] Deserialized data
210
+ def _deserialize(type, value)
211
+ case type.to_sym
212
+ when :Time
213
+ Time.parse(value)
214
+ when :Date
215
+ Date.parse(value)
216
+ when :String
217
+ value.to_s
218
+ when :Integer
219
+ value.to_i
220
+ when :Float
221
+ value.to_f
222
+ when :Boolean
223
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
224
+ true
225
+ else
226
+ false
227
+ end
228
+ when :Object
229
+ # generic object (usually a Hash), return directly
230
+ value
231
+ when /\AArray<(?<inner_type>.+)>\z/
232
+ inner_type = Regexp.last_match[:inner_type]
233
+ value.map { |v| _deserialize(inner_type, v) }
234
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
235
+ k_type = Regexp.last_match[:k_type]
236
+ v_type = Regexp.last_match[:v_type]
237
+ {}.tap do |hash|
238
+ value.each do |k, v|
239
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
240
+ end
241
+ end
242
+ else # model
243
+ # models (e.g. Pet) or oneOf
244
+ klass = MergeHRISClient.const_get(type)
245
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
246
+ end
247
+ end
248
+
249
+ # Returns the string representation of the object
250
+ # @return [String] String presentation of the object
251
+ def to_s
252
+ to_hash.to_s
253
+ end
254
+
255
+ # to_body is an alias to to_hash (backward compatibility)
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_body
258
+ to_hash
259
+ end
260
+
261
+ # Returns the object in the form of hash
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_hash
264
+ hash = {}
265
+ self.class.attribute_map.each_pair do |attr, param|
266
+ value = self.send(attr)
267
+ if value.nil?
268
+ is_nullable = self.class.openapi_nullable.include?(attr)
269
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
270
+ end
271
+
272
+ hash[param] = _to_hash(value)
273
+ end
274
+ hash
275
+ end
276
+
277
+ # Outputs non-array value in the form of hash
278
+ # For object, use to_hash. Otherwise, just return the value
279
+ # @param [Object] value Any valid value
280
+ # @return [Hash] Returns the value in the form of hash
281
+ def _to_hash(value)
282
+ if value.is_a?(Array)
283
+ value.compact.map { |v| _to_hash(v) }
284
+ elsif value.is_a?(Hash)
285
+ {}.tap do |hash|
286
+ value.each { |k, v| hash[k] = _to_hash(v) }
287
+ end
288
+ elsif value.respond_to? :to_hash
289
+ value.to_hash
290
+ else
291
+ value
292
+ end
293
+ end
294
+
295
+ end
296
+
297
+ end