stackone_hris_client 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +31 -5
  4. data/docs/Account.md +1 -1
  5. data/docs/AccountMeta.md +22 -0
  6. data/docs/AccountsApi.md +70 -2
  7. data/docs/CompaniesApi.md +1 -1
  8. data/docs/ConnectSessionsApi.md +1 -1
  9. data/docs/CreateEmployeeResult.md +22 -0
  10. data/docs/Employee.md +56 -54
  11. data/docs/EmployeeApiModel.md +80 -0
  12. data/docs/EmployeeApiModelAvatar.md +20 -0
  13. data/docs/EmployeeApiModelEmploymentStatus.md +20 -0
  14. data/docs/EmployeeApiModelEmploymentType.md +20 -0
  15. data/docs/EmployeeApiModelEthnicity.md +20 -0
  16. data/docs/EmployeeApiModelGender.md +20 -0
  17. data/docs/EmployeeApiModelHomeLocation.md +38 -0
  18. data/docs/EmployeeApiModelMaritalStatus.md +20 -0
  19. data/docs/EmployeeApiModelWorkLocation.md +38 -0
  20. data/docs/EmployeeCustomFieldTypeEnum.md +20 -0
  21. data/docs/EmployeeCustomFields.md +30 -0
  22. data/docs/EmployeeCustomFieldsType.md +20 -0
  23. data/docs/EmployeeResult.md +1 -1
  24. data/docs/EmployeesApi.md +219 -5
  25. data/docs/EmployeesPaginated.md +1 -1
  26. data/docs/Employment.md +17 -15
  27. data/docs/EmploymentEmploymentContractType.md +20 -0
  28. data/docs/EmploymentEmploymentType.md +20 -0
  29. data/docs/EmploymentPayFrequency.md +20 -0
  30. data/docs/EmploymentPayPeriod.md +20 -0
  31. data/docs/EmploymentScheduleTypeEnum.md +20 -0
  32. data/docs/EmploymentsApi.md +3 -3
  33. data/docs/HrisCreateEmployeeRequestDto.md +80 -0
  34. data/docs/Location.md +20 -20
  35. data/docs/LocationCountry.md +20 -0
  36. data/docs/LocationLocationType.md +20 -0
  37. data/docs/LocationsApi.md +1 -1
  38. data/gem-config.yml +2 -2
  39. data/generate_gem.sh +0 -0
  40. data/lib/stackone_hris_client/api/accounts_api.rb +61 -0
  41. data/lib/stackone_hris_client/api/employees_api.rb +231 -0
  42. data/lib/stackone_hris_client/models/account.rb +0 -5
  43. data/lib/stackone_hris_client/models/account_meta.rb +284 -0
  44. data/lib/stackone_hris_client/models/country_code_enum.rb +0 -6
  45. data/lib/stackone_hris_client/models/create_employee_result.rb +250 -0
  46. data/lib/stackone_hris_client/models/employee.rb +110 -126
  47. data/lib/stackone_hris_client/models/employee_api_model.rb +523 -0
  48. data/lib/stackone_hris_client/models/employee_api_model_avatar.rb +234 -0
  49. data/lib/stackone_hris_client/models/employee_api_model_employment_status.rb +272 -0
  50. data/lib/stackone_hris_client/models/employee_api_model_employment_type.rb +272 -0
  51. data/lib/stackone_hris_client/models/employee_api_model_ethnicity.rb +272 -0
  52. data/lib/stackone_hris_client/models/employee_api_model_gender.rb +272 -0
  53. data/lib/stackone_hris_client/models/employee_api_model_home_location.rb +324 -0
  54. data/lib/stackone_hris_client/models/employee_api_model_marital_status.rb +272 -0
  55. data/lib/stackone_hris_client/models/employee_api_model_work_location.rb +324 -0
  56. data/lib/stackone_hris_client/models/employee_custom_field_type_enum.rb +264 -0
  57. data/lib/stackone_hris_client/models/employee_custom_fields.rb +279 -0
  58. data/lib/stackone_hris_client/models/employee_custom_fields_type.rb +272 -0
  59. data/lib/stackone_hris_client/models/employment.rb +21 -6
  60. data/lib/stackone_hris_client/models/employment_employment_contract_type.rb +272 -0
  61. data/lib/stackone_hris_client/models/employment_employment_type.rb +272 -0
  62. data/lib/stackone_hris_client/models/employment_pay_frequency.rb +272 -0
  63. data/lib/stackone_hris_client/models/employment_pay_period.rb +272 -0
  64. data/lib/stackone_hris_client/models/employment_schedule_type_enum.rb +264 -0
  65. data/lib/stackone_hris_client/models/employment_status_enum.rb +0 -6
  66. data/lib/stackone_hris_client/models/employment_type_enum.rb +0 -6
  67. data/lib/stackone_hris_client/models/ethnicity_enum.rb +0 -6
  68. data/lib/stackone_hris_client/models/gender_enum.rb +0 -6
  69. data/lib/stackone_hris_client/models/hris_create_employee_request_dto.rb +523 -0
  70. data/lib/stackone_hris_client/models/location.rb +11 -7
  71. data/lib/stackone_hris_client/models/location_country.rb +272 -0
  72. data/lib/stackone_hris_client/models/location_location_type.rb +272 -0
  73. data/lib/stackone_hris_client/models/location_type_enum.rb +0 -6
  74. data/lib/stackone_hris_client/models/marital_status_enum.rb +0 -6
  75. data/lib/stackone_hris_client/models/pay_frequency_enum.rb +0 -6
  76. data/lib/stackone_hris_client/models/pay_period_enum.rb +0 -6
  77. data/lib/stackone_hris_client/version.rb +1 -1
  78. data/lib/stackone_hris_client.rb +22 -0
  79. data/spec/api/accounts_api_spec.rb +30 -8
  80. data/spec/api/companies_api_spec.rb +13 -13
  81. data/spec/api/connect_sessions_api_spec.rb +8 -8
  82. data/spec/api/employees_api_spec.rb +60 -18
  83. data/spec/api/employments_api_spec.rb +13 -13
  84. data/spec/api/locations_api_spec.rb +9 -9
  85. data/spec/models/account_meta_spec.rb +50 -0
  86. data/spec/models/account_spec.rb +18 -12
  87. data/spec/models/companies_paginated_spec.rb +4 -4
  88. data/spec/models/company_result_spec.rb +3 -3
  89. data/spec/models/company_spec.rb +4 -4
  90. data/spec/models/connect_session_authenticate_spec.rb +5 -5
  91. data/spec/models/connect_session_create_spec.rb +17 -11
  92. data/spec/models/connect_session_spec.rb +14 -14
  93. data/spec/models/connect_session_token_spec.rb +15 -15
  94. data/spec/models/country_code_enum_spec.rb +4 -4
  95. data/spec/models/create_employee_result_spec.rb +46 -0
  96. data/spec/models/employee.rb +220 -0
  97. data/spec/models/employee_api_model_avatar_spec.rb +40 -0
  98. data/spec/models/employee_api_model_employment_status_spec.rb +44 -0
  99. data/spec/models/employee_api_model_employment_type_spec.rb +44 -0
  100. data/spec/models/employee_api_model_ethnicity_spec.rb +44 -0
  101. data/spec/models/employee_api_model_gender_spec.rb +44 -0
  102. data/spec/models/employee_api_model_home_location_spec.rb +94 -0
  103. data/spec/models/employee_api_model_marital_status_spec.rb +44 -0
  104. data/spec/models/employee_api_model_spec.rb +220 -0
  105. data/spec/models/employee_api_model_work_location_spec.rb +94 -0
  106. data/spec/models/employee_custom_field_type_enum_spec.rb +44 -0
  107. data/spec/models/employee_custom_fields_spec.rb +70 -0
  108. data/spec/models/employee_custom_fields_type_spec.rb +44 -0
  109. data/spec/models/employee_result_spec.rb +6 -6
  110. data/spec/models/employees_paginated_spec.rb +7 -7
  111. data/spec/models/employment_employment_contract_type_spec.rb +44 -0
  112. data/spec/models/employment_employment_type_spec.rb +44 -0
  113. data/spec/models/employment_pay_frequency_spec.rb +44 -0
  114. data/spec/models/employment_pay_period_spec.rb +44 -0
  115. data/spec/models/employment_result_spec.rb +3 -3
  116. data/spec/models/employment_schedule_type_enum_spec.rb +44 -0
  117. data/spec/models/employment_spec.rb +16 -10
  118. data/spec/models/employment_status_enum_spec.rb +4 -4
  119. data/spec/models/employment_type_enum_spec.rb +4 -4
  120. data/spec/models/employments_paginated_spec.rb +4 -4
  121. data/spec/models/ethnicity_enum_spec.rb +4 -4
  122. data/spec/models/gender_enum_spec.rb +4 -4
  123. data/spec/models/hris_create_employee_request_dto_spec.rb +220 -0
  124. data/spec/models/image_spec.rb +3 -3
  125. data/spec/models/location_country_spec.rb +44 -0
  126. data/spec/models/location_location_type_spec.rb +44 -0
  127. data/spec/models/location_result_spec.rb +3 -3
  128. data/spec/models/location_spec.rb +12 -12
  129. data/spec/models/location_type_enum_spec.rb +3 -3
  130. data/spec/models/locations_paginated_spec.rb +4 -4
  131. data/spec/models/marital_status_enum_spec.rb +4 -4
  132. data/spec/models/pay_frequency_enum_spec.rb +4 -4
  133. data/spec/models/pay_period_enum_spec.rb +3 -3
  134. metadata +92 -4
  135. data/spec/models/employee_spec.rb +0 -124
@@ -0,0 +1,234 @@
1
+ =begin
2
+ #StackOne Unified API - HRIS
3
+
4
+ #The documentation for the StackOne Unified API - HRIS
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module StackOneHRIS
17
+ # The employee avatar
18
+ class EmployeeApiModelAvatar
19
+ attr_accessor :url
20
+
21
+ attr_accessor :base64
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'url' => :'url',
27
+ :'base64' => :'base64'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'url' => :'String',
40
+ :'base64' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # List of class defined in allOf (OpenAPI v3)
51
+ def self.openapi_all_of
52
+ [
53
+ :'Image'
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 `StackOneHRIS::EmployeeApiModelAvatar` 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 `StackOneHRIS::EmployeeApiModelAvatar`. 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?(:'url')
73
+ self.url = attributes[:'url']
74
+ end
75
+
76
+ if attributes.key?(:'base64')
77
+ self.base64 = attributes[:'base64']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ url == o.url &&
100
+ base64 == o.base64
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Integer] Hash code
111
+ def hash
112
+ [url, base64].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def self.build_from_hash(attributes)
119
+ new.build_from_hash(attributes)
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ attributes = attributes.transform_keys(&:to_sym)
128
+ self.class.openapi_types.each_pair do |key, type|
129
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
130
+ self.send("#{key}=", nil)
131
+ elsif type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
135
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
+ end
137
+ elsif !attributes[self.class.attribute_map[key]].nil?
138
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
+ end
140
+ end
141
+
142
+ self
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def _deserialize(type, value)
150
+ case type.to_sym
151
+ when :Time
152
+ Time.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ # models (e.g. Pet) or oneOf
183
+ klass = StackOneHRIS.const_get(type)
184
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
185
+ end
186
+ end
187
+
188
+ # Returns the string representation of the object
189
+ # @return [String] String presentation of the object
190
+ def to_s
191
+ to_hash.to_s
192
+ end
193
+
194
+ # to_body is an alias to to_hash (backward compatibility)
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_body
197
+ to_hash
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = self.send(attr)
206
+ if value.nil?
207
+ is_nullable = self.class.openapi_nullable.include?(attr)
208
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
+ end
210
+
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+ end
234
+ end
@@ -0,0 +1,272 @@
1
+ =begin
2
+ #StackOne Unified API - HRIS
3
+
4
+ #The documentation for the StackOne Unified API - HRIS
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module StackOneHRIS
17
+ # The employee employment status
18
+ class EmployeeApiModelEmploymentStatus
19
+ attr_accessor :value
20
+
21
+ attr_accessor :source_value
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'value' => :'value',
49
+ :'source_value' => :'source_value'
50
+ }
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'value' => :'String',
62
+ :'source_value' => :'String'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # List of class defined in allOf (OpenAPI v3)
73
+ def self.openapi_all_of
74
+ [
75
+ :'EmploymentStatusEnum'
76
+ ]
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `StackOneHRIS::EmployeeApiModelEmploymentStatus` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `StackOneHRIS::EmployeeApiModelEmploymentStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'value')
95
+ self.value = attributes[:'value']
96
+ end
97
+
98
+ if attributes.key?(:'source_value')
99
+ self.source_value = attributes[:'source_value']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ if @value.nil?
108
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
109
+ end
110
+
111
+ if @source_value.nil?
112
+ invalid_properties.push('invalid value for "source_value", source_value cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ return false if @value.nil?
122
+ return false if @source_value.nil?
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method checking allowed values (enum).
127
+ # @param [Object] value Object to be assigned
128
+ def value=(value)
129
+ @value = value
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
+ value == o.value &&
138
+ source_value == o.source_value
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Integer] Hash code
149
+ def hash
150
+ [value, source_value].hash
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 self.build_from_hash(attributes)
157
+ new.build_from_hash(attributes)
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ attributes = attributes.transform_keys(&:to_sym)
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.to_s
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 = StackOneHRIS.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
+ end
272
+ end