merge_hris_client 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -8
  3. data/docs/AccountIntegration.md +6 -2
  4. data/docs/BankInfo.md +9 -5
  5. data/docs/BankInfoApi.md +15 -11
  6. data/docs/Benefit.md +8 -4
  7. data/docs/BenefitsApi.md +6 -6
  8. data/docs/CommonModelScopeData.md +20 -0
  9. data/docs/CommonModelScopes.md +20 -0
  10. data/docs/CommonModelScopesApi.md +157 -0
  11. data/docs/CommonModelScopesBodyRequest.md +22 -0
  12. data/docs/CommonModelScopesDisabledModels.md +26 -0
  13. data/docs/CommonModelScopesDisabledModelsEnabledActionsEnum.md +15 -0
  14. data/docs/CommonModelScopesPostInnerDeserializerRequest.md +22 -0
  15. data/docs/CommonModelScopesUpdateSerializer.md +18 -0
  16. data/docs/CompaniesApi.md +4 -4
  17. data/docs/Company.md +7 -3
  18. data/docs/ConditionSchema.md +30 -0
  19. data/docs/ConditionTypeEnum.md +15 -0
  20. data/docs/DataPassthroughRequest.md +1 -1
  21. data/docs/Deduction.md +11 -5
  22. data/docs/Earning.md +10 -2
  23. data/docs/Employee.md +19 -15
  24. data/docs/EmployeePayrollRun.md +11 -7
  25. data/docs/EmployeePayrollRunsApi.md +4 -4
  26. data/docs/EmployeeRequest.md +16 -18
  27. data/docs/EmployeesApi.md +31 -18
  28. data/docs/Employment.md +14 -10
  29. data/docs/EmploymentsApi.md +13 -9
  30. data/docs/EnabledActionsEnum.md +15 -0
  31. data/docs/EndUserDetailsRequest.md +5 -3
  32. data/docs/ForceResyncApi.md +1 -1
  33. data/docs/Group.md +8 -4
  34. data/docs/GroupsApi.md +15 -9
  35. data/docs/Issue.md +10 -8
  36. data/docs/IssuesApi.md +6 -6
  37. data/docs/LinkToken.md +1 -1
  38. data/docs/LinkedAccountCondition.md +28 -0
  39. data/docs/LinkedAccountConditionRequest.md +22 -0
  40. data/docs/LinkedAccountSelectiveSyncConfiguration.md +18 -0
  41. data/docs/LinkedAccountSelectiveSyncConfigurationListRequest.md +18 -0
  42. data/docs/LinkedAccountSelectiveSyncConfigurationRequest.md +18 -0
  43. data/docs/LinkedAccountsApi.md +2 -2
  44. data/docs/Location.md +9 -5
  45. data/docs/LocationsApi.md +13 -9
  46. data/docs/MetaResponse.md +2 -0
  47. data/docs/MultipartFormFieldRequest.md +1 -1
  48. data/docs/OperatorSchema.md +20 -0
  49. data/docs/PaginatedConditionSchemaList.md +22 -0
  50. data/docs/PayGroup.md +7 -3
  51. data/docs/PayGroupsApi.md +4 -4
  52. data/docs/PayrollRun.md +9 -5
  53. data/docs/PayrollRunsApi.md +14 -10
  54. data/docs/SelectiveSyncApi.md +233 -0
  55. data/docs/SelectiveSyncConfigurationsUsageEnum.md +15 -0
  56. data/docs/SyncStatus.md +5 -3
  57. data/docs/Tax.md +9 -1
  58. data/docs/Team.md +8 -4
  59. data/docs/TeamsApi.md +4 -4
  60. data/docs/TimeOff.md +13 -9
  61. data/docs/TimeOffApi.md +16 -12
  62. data/docs/TimeOffBalance.md +10 -6
  63. data/docs/TimeOffBalancesApi.md +15 -11
  64. data/docs/TimeOffRequest.md +11 -9
  65. data/lib/merge_hris_client/api/bank_info_api.rb +24 -10
  66. data/lib/merge_hris_client/api/benefits_api.rb +6 -6
  67. data/lib/merge_hris_client/api/common_model_scopes_api.rb +146 -0
  68. data/lib/merge_hris_client/api/companies_api.rb +4 -4
  69. data/lib/merge_hris_client/api/employee_payroll_runs_api.rb +4 -4
  70. data/lib/merge_hris_client/api/employees_api.rb +44 -17
  71. data/lib/merge_hris_client/api/employments_api.rb +22 -8
  72. data/lib/merge_hris_client/api/force_resync_api.rb +2 -2
  73. data/lib/merge_hris_client/api/groups_api.rb +25 -8
  74. data/lib/merge_hris_client/api/issues_api.rb +6 -6
  75. data/lib/merge_hris_client/api/linked_accounts_api.rb +3 -3
  76. data/lib/merge_hris_client/api/locations_api.rb +22 -8
  77. data/lib/merge_hris_client/api/pay_groups_api.rb +4 -4
  78. data/lib/merge_hris_client/api/payroll_runs_api.rb +24 -10
  79. data/lib/merge_hris_client/api/selective_sync_api.rb +225 -0
  80. data/lib/merge_hris_client/api/teams_api.rb +4 -4
  81. data/lib/merge_hris_client/api/time_off_api.rb +26 -12
  82. data/lib/merge_hris_client/api/time_off_balances_api.rb +24 -10
  83. data/lib/merge_hris_client/models/account_integration.rb +30 -8
  84. data/lib/merge_hris_client/models/bank_info.rb +39 -16
  85. data/lib/merge_hris_client/models/benefit.rb +38 -15
  86. data/lib/merge_hris_client/models/categories_enum.rb +3 -1
  87. data/lib/merge_hris_client/models/category_enum.rb +3 -1
  88. data/lib/merge_hris_client/models/common_model_scope_data.rb +234 -0
  89. data/lib/merge_hris_client/models/common_model_scopes.rb +234 -0
  90. data/lib/merge_hris_client/models/common_model_scopes_body_request.rb +274 -0
  91. data/lib/merge_hris_client/models/common_model_scopes_disabled_models.rb +283 -0
  92. data/lib/merge_hris_client/models/common_model_scopes_disabled_models_enabled_actions_enum.rb +45 -0
  93. data/lib/merge_hris_client/models/common_model_scopes_post_inner_deserializer_request.rb +274 -0
  94. data/lib/merge_hris_client/models/common_model_scopes_update_serializer.rb +226 -0
  95. data/lib/merge_hris_client/models/company.rb +37 -15
  96. data/lib/merge_hris_client/models/condition_schema.rb +298 -0
  97. data/lib/merge_hris_client/models/condition_type_enum.rb +50 -0
  98. data/lib/merge_hris_client/models/data_passthrough_request.rb +1 -0
  99. data/lib/merge_hris_client/models/deduction.rb +50 -17
  100. data/lib/merge_hris_client/models/earning.rb +51 -6
  101. data/lib/merge_hris_client/models/employee.rb +51 -23
  102. data/lib/merge_hris_client/models/employee_payroll_run.rb +41 -17
  103. data/lib/merge_hris_client/models/employee_request.rb +34 -39
  104. data/lib/merge_hris_client/models/employment.rb +44 -20
  105. data/lib/merge_hris_client/models/enabled_actions_enum.rb +45 -0
  106. data/lib/merge_hris_client/models/end_user_details_request.rb +20 -7
  107. data/lib/merge_hris_client/models/group.rb +38 -16
  108. data/lib/merge_hris_client/models/group_type_enum.rb +2 -1
  109. data/lib/merge_hris_client/models/issue.rb +16 -4
  110. data/lib/merge_hris_client/models/link_token.rb +0 -5
  111. data/lib/merge_hris_client/models/linked_account_condition.rb +282 -0
  112. data/lib/merge_hris_client/models/linked_account_condition_request.rb +269 -0
  113. data/lib/merge_hris_client/models/linked_account_selective_sync_configuration.rb +221 -0
  114. data/lib/merge_hris_client/models/linked_account_selective_sync_configuration_list_request.rb +226 -0
  115. data/lib/merge_hris_client/models/linked_account_selective_sync_configuration_request.rb +226 -0
  116. data/lib/merge_hris_client/models/location.rb +39 -17
  117. data/lib/merge_hris_client/models/meta_response.rb +12 -1
  118. data/lib/merge_hris_client/models/multipart_form_field_request.rb +1 -1
  119. data/lib/merge_hris_client/models/operator_schema.rb +229 -0
  120. data/lib/merge_hris_client/models/paginated_condition_schema_list.rb +240 -0
  121. data/lib/merge_hris_client/models/pay_frequency_enum.rb +2 -1
  122. data/lib/merge_hris_client/models/pay_group.rb +37 -15
  123. data/lib/merge_hris_client/models/pay_period_enum.rb +2 -1
  124. data/lib/merge_hris_client/models/payroll_run.rb +39 -17
  125. data/lib/merge_hris_client/models/selective_sync_configurations_usage_enum.rb +45 -0
  126. data/lib/merge_hris_client/models/sync_status.rb +13 -4
  127. data/lib/merge_hris_client/models/tax.rb +50 -5
  128. data/lib/merge_hris_client/models/team.rb +38 -15
  129. data/lib/merge_hris_client/models/time_off.rb +43 -19
  130. data/lib/merge_hris_client/models/time_off_balance.rb +40 -17
  131. data/lib/merge_hris_client/models/time_off_request.rb +36 -21
  132. data/lib/merge_hris_client/version.rb +1 -1
  133. data/lib/merge_hris_client.rb +20 -3
  134. data/spec/api/bank_info_api_spec.rb +7 -5
  135. data/spec/api/benefits_api_spec.rb +3 -3
  136. data/spec/api/common_model_scopes_api_spec.rb +58 -0
  137. data/spec/api/companies_api_spec.rb +2 -2
  138. data/spec/api/employee_payroll_runs_api_spec.rb +2 -2
  139. data/spec/api/employees_api_spec.rb +13 -6
  140. data/spec/api/employments_api_spec.rb +6 -4
  141. data/spec/api/force_resync_api_spec.rb +1 -1
  142. data/spec/api/groups_api_spec.rb +7 -4
  143. data/spec/api/issues_api_spec.rb +3 -3
  144. data/spec/api/linked_accounts_api_spec.rb +1 -1
  145. data/spec/api/locations_api_spec.rb +6 -4
  146. data/spec/api/pay_groups_api_spec.rb +2 -2
  147. data/spec/api/payroll_runs_api_spec.rb +7 -5
  148. data/spec/api/selective_sync_api_spec.rb +72 -0
  149. data/spec/api/teams_api_spec.rb +2 -2
  150. data/spec/api/time_off_api_spec.rb +8 -6
  151. data/spec/api/time_off_balances_api_spec.rb +7 -5
  152. data/spec/models/account_integration_spec.rb +12 -0
  153. data/spec/models/bank_info_spec.rb +14 -2
  154. data/spec/models/benefit_spec.rb +14 -2
  155. data/spec/models/common_model_scope_data_spec.rb +40 -0
  156. data/spec/models/common_model_scopes_body_request_spec.rb +46 -0
  157. data/spec/models/common_model_scopes_disabled_models_enabled_actions_enum_spec.rb +28 -0
  158. data/spec/models/common_model_scopes_disabled_models_spec.rb +58 -0
  159. data/spec/models/common_model_scopes_post_inner_deserializer_request_spec.rb +46 -0
  160. data/spec/models/common_model_scopes_spec.rb +40 -0
  161. data/spec/models/common_model_scopes_update_serializer_spec.rb +34 -0
  162. data/spec/models/company_spec.rb +14 -2
  163. data/spec/models/condition_schema_spec.rb +70 -0
  164. data/spec/models/condition_type_enum_spec.rb +28 -0
  165. data/spec/models/deduction_spec.rb +20 -2
  166. data/spec/models/earning_spec.rb +24 -0
  167. data/spec/models/employee_payroll_run_spec.rb +14 -2
  168. data/spec/models/employee_request_spec.rb +5 -11
  169. data/spec/models/employee_spec.rb +15 -3
  170. data/spec/models/employment_spec.rb +14 -2
  171. data/spec/models/enabled_actions_enum_spec.rb +28 -0
  172. data/spec/models/end_user_details_request_spec.rb +6 -0
  173. data/spec/models/group_spec.rb +14 -2
  174. data/spec/models/issue_spec.rb +6 -0
  175. data/spec/models/linked_account_condition_request_spec.rb +46 -0
  176. data/spec/models/linked_account_condition_spec.rb +64 -0
  177. data/spec/models/linked_account_selective_sync_configuration_list_request_spec.rb +34 -0
  178. data/spec/models/linked_account_selective_sync_configuration_request_spec.rb +34 -0
  179. data/spec/models/linked_account_selective_sync_configuration_spec.rb +34 -0
  180. data/spec/models/location_spec.rb +14 -2
  181. data/spec/models/meta_response_spec.rb +6 -0
  182. data/spec/models/operator_schema_spec.rb +40 -0
  183. data/spec/models/paginated_condition_schema_list_spec.rb +46 -0
  184. data/spec/models/pay_group_spec.rb +14 -2
  185. data/spec/models/payroll_run_spec.rb +14 -2
  186. data/spec/models/selective_sync_configurations_usage_enum_spec.rb +28 -0
  187. data/spec/models/sync_status_spec.rb +6 -0
  188. data/spec/models/tax_spec.rb +24 -0
  189. data/spec/models/team_spec.rb +14 -2
  190. data/spec/models/time_off_balance_spec.rb +14 -2
  191. data/spec/models/time_off_request_spec.rb +12 -6
  192. data/spec/models/time_off_spec.rb +14 -2
  193. metadata +183 -103
@@ -0,0 +1,234 @@
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 CommonModelScopes
18
+ attr_accessor :organization_level_scopes
19
+
20
+ attr_accessor :scope_overrides
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'organization_level_scopes' => :'organization_level_scopes',
26
+ :'scope_overrides' => :'scope_overrides'
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
+ :'organization_level_scopes' => :'CommonModelScopeData',
39
+ :'scope_overrides' => :'Array<CommonModelScopeData>'
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::CommonModelScopes` 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::CommonModelScopes`. 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?(:'organization_level_scopes')
65
+ self.organization_level_scopes = attributes[:'organization_level_scopes']
66
+ end
67
+
68
+ if attributes.key?(:'scope_overrides')
69
+ if (value = attributes[:'scope_overrides']).is_a?(Array)
70
+ self.scope_overrides = value
71
+ end
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if @scope_overrides.nil?
80
+ invalid_properties.push('invalid value for "scope_overrides", scope_overrides cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ return false if @scope_overrides.nil?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ organization_level_scopes == o.organization_level_scopes &&
99
+ scope_overrides == o.scope_overrides
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [organization_level_scopes, scope_overrides].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
128
+ self.send("#{key}=", nil)
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :Time
150
+ Time.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ # models (e.g. Pet) or oneOf
181
+ klass = MergeHRISClient.const_get(type)
182
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end
@@ -0,0 +1,274 @@
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 CommonModelScopesBodyRequest
18
+ attr_accessor :model_id
19
+
20
+ attr_accessor :enabled_actions
21
+
22
+ attr_accessor :disabled_fields
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'model_id' => :'model_id',
28
+ :'enabled_actions' => :'enabled_actions',
29
+ :'disabled_fields' => :'disabled_fields'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'model_id' => :'String',
42
+ :'enabled_actions' => :'Array<EnabledActionsEnum>',
43
+ :'disabled_fields' => :'Array<String>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeHRISClient::CommonModelScopesBodyRequest` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeHRISClient::CommonModelScopesBodyRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'model_id')
69
+ self.model_id = attributes[:'model_id']
70
+ end
71
+
72
+ if attributes.key?(:'enabled_actions')
73
+ if (value = attributes[:'enabled_actions']).is_a?(Array)
74
+ self.enabled_actions = value
75
+ end
76
+ end
77
+
78
+ if attributes.key?(:'disabled_fields')
79
+ if (value = attributes[:'disabled_fields']).is_a?(Array)
80
+ self.disabled_fields = value
81
+ end
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ if @model_id.nil?
90
+ invalid_properties.push('invalid value for "model_id", model_id cannot be nil.')
91
+ end
92
+
93
+ if @model_id.to_s.length < 1
94
+ invalid_properties.push('invalid value for "model_id", the character length must be great than or equal to 1.')
95
+ end
96
+
97
+ if @enabled_actions.nil?
98
+ invalid_properties.push('invalid value for "enabled_actions", enabled_actions cannot be nil.')
99
+ end
100
+
101
+ if @disabled_fields.nil?
102
+ invalid_properties.push('invalid value for "disabled_fields", disabled_fields cannot be nil.')
103
+ end
104
+
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ return false if @model_id.nil?
112
+ return false if @model_id.to_s.length < 1
113
+ return false if @enabled_actions.nil?
114
+ return false if @disabled_fields.nil?
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method with validation
119
+ # @param [Object] model_id Value to be assigned
120
+ def model_id=(model_id)
121
+ if model_id.nil?
122
+ fail ArgumentError, 'model_id cannot be nil'
123
+ end
124
+
125
+ if model_id.to_s.length < 1
126
+ fail ArgumentError, 'invalid value for "model_id", the character length must be great than or equal to 1.'
127
+ end
128
+
129
+ @model_id = model_id
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ model_id == o.model_id &&
138
+ enabled_actions == o.enabled_actions &&
139
+ disabled_fields == o.disabled_fields
140
+ end
141
+
142
+ # @see the `==` method
143
+ # @param [Object] Object to be compared
144
+ def eql?(o)
145
+ self == o
146
+ end
147
+
148
+ # Calculates hash code according to all attributes.
149
+ # @return [Integer] Hash code
150
+ def hash
151
+ [model_id, enabled_actions, disabled_fields].hash
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def self.build_from_hash(attributes)
158
+ new.build_from_hash(attributes)
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ self.class.openapi_types.each_pair do |key, type|
167
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
168
+ self.send("#{key}=", nil)
169
+ elsif type =~ /\AArray<(.*)>/i
170
+ # check to ensure the input is an array given that the attribute
171
+ # is documented as an array but the input is not
172
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
173
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
174
+ end
175
+ elsif !attributes[self.class.attribute_map[key]].nil?
176
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
177
+ end
178
+ end
179
+
180
+ self
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def _deserialize(type, value)
188
+ case type.to_sym
189
+ when :Time
190
+ Time.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ # models (e.g. Pet) or oneOf
221
+ klass = MergeHRISClient.const_get(type)
222
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ if value.nil?
245
+ is_nullable = self.class.openapi_nullable.include?(attr)
246
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
247
+ end
248
+
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+
272
+ end
273
+
274
+ end