stackone_hris_client 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +42 -15
  4. data/docs/Account.md +32 -0
  5. data/docs/AccountsApi.md +218 -0
  6. data/docs/CompaniesApi.md +175 -0
  7. data/docs/CompaniesPaginated.md +22 -0
  8. data/docs/Company.md +22 -0
  9. data/docs/CompanyResult.md +20 -0
  10. data/docs/ConnectSession.md +34 -0
  11. data/docs/ConnectSessionAuthenticate.md +18 -0
  12. data/docs/ConnectSessionCreate.md +28 -0
  13. data/docs/ConnectSessionToken.md +36 -0
  14. data/docs/ConnectSessionsApi.md +145 -0
  15. data/docs/Employee.md +36 -12
  16. data/docs/EmployeeResult.md +2 -2
  17. data/docs/EmployeesApi.md +19 -13
  18. data/docs/EmployeesPaginated.md +2 -2
  19. data/docs/Employment.md +34 -0
  20. data/docs/EmploymentResult.md +20 -0
  21. data/docs/EmploymentsApi.md +175 -0
  22. data/docs/EmploymentsPaginated.md +22 -0
  23. data/docs/Location.md +38 -0
  24. data/docs/LocationResult.md +20 -0
  25. data/docs/LocationsApi.md +175 -0
  26. data/docs/LocationsPaginated.md +22 -0
  27. data/gem-config.yml +4 -4
  28. data/lib/stackone_hris_client/api/accounts_api.rb +205 -0
  29. data/lib/stackone_hris_client/api/companies_api.rb +188 -0
  30. data/lib/stackone_hris_client/api/connect_sessions_api.rb +154 -0
  31. data/lib/stackone_hris_client/api/employees_api.rb +10 -4
  32. data/lib/stackone_hris_client/api/employments_api.rb +188 -0
  33. data/lib/stackone_hris_client/api/locations_api.rb +188 -0
  34. data/lib/stackone_hris_client/api_client.rb +5 -5
  35. data/lib/stackone_hris_client/api_error.rb +4 -4
  36. data/lib/stackone_hris_client/configuration.rb +13 -12
  37. data/lib/stackone_hris_client/models/account.rb +322 -0
  38. data/lib/stackone_hris_client/models/companies_paginated.rb +249 -0
  39. data/lib/stackone_hris_client/models/company.rb +237 -0
  40. data/lib/stackone_hris_client/models/company_result.rb +233 -0
  41. data/lib/stackone_hris_client/models/connect_session.rb +350 -0
  42. data/lib/stackone_hris_client/models/connect_session_authenticate.rb +225 -0
  43. data/lib/stackone_hris_client/models/connect_session_create.rb +304 -0
  44. data/lib/stackone_hris_client/models/connect_session_token.rb +364 -0
  45. data/lib/stackone_hris_client/models/employee.rb +145 -60
  46. data/lib/stackone_hris_client/models/employee_result.rb +9 -7
  47. data/lib/stackone_hris_client/models/employees_paginated.rb +9 -7
  48. data/lib/stackone_hris_client/models/employment.rb +296 -0
  49. data/lib/stackone_hris_client/models/employment_result.rb +233 -0
  50. data/lib/stackone_hris_client/models/employments_paginated.rb +249 -0
  51. data/lib/stackone_hris_client/models/location.rb +314 -0
  52. data/lib/stackone_hris_client/models/location_result.rb +233 -0
  53. data/lib/stackone_hris_client/models/locations_paginated.rb +249 -0
  54. data/lib/stackone_hris_client/version.rb +5 -5
  55. data/lib/stackone_hris_client.rb +23 -4
  56. data/spec/api/accounts_api_spec.rb +58 -0
  57. data/spec/api/companies_api_spec.rb +70 -0
  58. data/spec/api/connect_sessions_api_spec.rb +57 -0
  59. data/spec/api/employments_api_spec.rb +70 -0
  60. data/spec/api/locations_api_spec.rb +70 -0
  61. data/spec/api_client_spec.rb +32 -32
  62. data/spec/configuration_spec.rb +6 -6
  63. data/spec/models/account_spec.rb +76 -0
  64. data/spec/models/companies_paginated_spec.rb +46 -0
  65. data/spec/models/company_result_spec.rb +40 -0
  66. data/spec/models/company_spec.rb +46 -0
  67. data/spec/models/connect_session_authenticate_spec.rb +34 -0
  68. data/spec/models/connect_session_create_spec.rb +68 -0
  69. data/spec/models/connect_session_spec.rb +86 -0
  70. data/spec/models/connect_session_token_spec.rb +92 -0
  71. data/spec/models/employment_result_spec.rb +40 -0
  72. data/spec/models/employment_spec.rb +82 -0
  73. data/spec/models/employments_paginated_spec.rb +46 -0
  74. data/spec/models/location_result_spec.rb +40 -0
  75. data/spec/models/location_spec.rb +94 -0
  76. data/spec/models/locations_paginated_spec.rb +46 -0
  77. data/spec/spec_helper.rb +3 -3
  78. data/stackone_hris_client.gemspec +5 -5
  79. metadata +79 -3
@@ -0,0 +1,304 @@
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.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module StackOneHRIS
17
+ class ConnectSessionCreate
18
+ # The categories of the provider to connect to
19
+ attr_accessor :categories
20
+
21
+ # The provider to connect to
22
+ attr_accessor :provider
23
+
24
+ # The origin owner identifier
25
+ attr_accessor :origin_owner_id
26
+
27
+ # The origin owner name
28
+ attr_accessor :origin_owner_name
29
+
30
+ # The origin username
31
+ attr_accessor :origin_username
32
+
33
+ # The metadata for the connection
34
+ attr_accessor :metadata
35
+
36
+ class EnumAttributeValidator
37
+ attr_reader :datatype
38
+ attr_reader :allowable_values
39
+
40
+ def initialize(datatype, allowable_values)
41
+ @allowable_values = allowable_values.map do |value|
42
+ case datatype.to_s
43
+ when /Integer/i
44
+ value.to_i
45
+ when /Float/i
46
+ value.to_f
47
+ else
48
+ value
49
+ end
50
+ end
51
+ end
52
+
53
+ def valid?(value)
54
+ !value || allowable_values.include?(value)
55
+ end
56
+ end
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'categories' => :'categories',
62
+ :'provider' => :'provider',
63
+ :'origin_owner_id' => :'origin_owner_id',
64
+ :'origin_owner_name' => :'origin_owner_name',
65
+ :'origin_username' => :'origin_username',
66
+ :'metadata' => :'metadata'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'categories' => :'Array<String>',
79
+ :'provider' => :'String',
80
+ :'origin_owner_id' => :'String',
81
+ :'origin_owner_name' => :'String',
82
+ :'origin_username' => :'String',
83
+ :'metadata' => :'Object'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `StackOneHRIS::ConnectSessionCreate` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!self.class.attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `StackOneHRIS::ConnectSessionCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'categories')
109
+ if (value = attributes[:'categories']).is_a?(Array)
110
+ self.categories = value
111
+ end
112
+ end
113
+
114
+ if attributes.key?(:'provider')
115
+ self.provider = attributes[:'provider']
116
+ end
117
+
118
+ if attributes.key?(:'origin_owner_id')
119
+ self.origin_owner_id = attributes[:'origin_owner_id']
120
+ end
121
+
122
+ if attributes.key?(:'origin_owner_name')
123
+ self.origin_owner_name = attributes[:'origin_owner_name']
124
+ end
125
+
126
+ if attributes.key?(:'origin_username')
127
+ self.origin_username = attributes[:'origin_username']
128
+ end
129
+
130
+ if attributes.key?(:'metadata')
131
+ self.metadata = attributes[:'metadata']
132
+ end
133
+ end
134
+
135
+ # Show invalid properties with the reasons. Usually used together with valid?
136
+ # @return Array for valid properties with the reasons
137
+ def list_invalid_properties
138
+ invalid_properties = Array.new
139
+ if @origin_owner_id.nil?
140
+ invalid_properties.push('invalid value for "origin_owner_id", origin_owner_id cannot be nil.')
141
+ end
142
+
143
+ if @origin_owner_name.nil?
144
+ invalid_properties.push('invalid value for "origin_owner_name", origin_owner_name cannot be nil.')
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ return false if @origin_owner_id.nil?
154
+ return false if @origin_owner_name.nil?
155
+ true
156
+ end
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(o)
161
+ return true if self.equal?(o)
162
+ self.class == o.class &&
163
+ categories == o.categories &&
164
+ provider == o.provider &&
165
+ origin_owner_id == o.origin_owner_id &&
166
+ origin_owner_name == o.origin_owner_name &&
167
+ origin_username == o.origin_username &&
168
+ metadata == o.metadata
169
+ end
170
+
171
+ # @see the `==` method
172
+ # @param [Object] Object to be compared
173
+ def eql?(o)
174
+ self == o
175
+ end
176
+
177
+ # Calculates hash code according to all attributes.
178
+ # @return [Integer] Hash code
179
+ def hash
180
+ [categories, provider, origin_owner_id, origin_owner_name, origin_username, metadata].hash
181
+ end
182
+
183
+ # Builds the object from hash
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ # @return [Object] Returns the model itself
186
+ def self.build_from_hash(attributes)
187
+ new.build_from_hash(attributes)
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def build_from_hash(attributes)
194
+ return nil unless attributes.is_a?(Hash)
195
+ attributes = attributes.transform_keys(&:to_sym)
196
+ self.class.openapi_types.each_pair do |key, type|
197
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
198
+ self.send("#{key}=", nil)
199
+ elsif type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
203
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
204
+ end
205
+ elsif !attributes[self.class.attribute_map[key]].nil?
206
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
207
+ end
208
+ end
209
+
210
+ self
211
+ end
212
+
213
+ # Deserializes the data based on type
214
+ # @param string type Data type
215
+ # @param string value Value to be deserialized
216
+ # @return [Object] Deserialized data
217
+ def _deserialize(type, value)
218
+ case type.to_sym
219
+ when :Time
220
+ Time.parse(value)
221
+ when :Date
222
+ Date.parse(value)
223
+ when :String
224
+ value.to_s
225
+ when :Integer
226
+ value.to_i
227
+ when :Float
228
+ value.to_f
229
+ when :Boolean
230
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
231
+ true
232
+ else
233
+ false
234
+ end
235
+ when :Object
236
+ # generic object (usually a Hash), return directly
237
+ value
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ # models (e.g. Pet) or oneOf
251
+ klass = StackOneHRIS.const_get(type)
252
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
253
+ end
254
+ end
255
+
256
+ # Returns the string representation of the object
257
+ # @return [String] String presentation of the object
258
+ def to_s
259
+ to_hash.to_s
260
+ end
261
+
262
+ # to_body is an alias to to_hash (backward compatibility)
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_body
265
+ to_hash
266
+ end
267
+
268
+ # Returns the object in the form of hash
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_hash
271
+ hash = {}
272
+ self.class.attribute_map.each_pair do |attr, param|
273
+ value = self.send(attr)
274
+ if value.nil?
275
+ is_nullable = self.class.openapi_nullable.include?(attr)
276
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
277
+ end
278
+
279
+ hash[param] = _to_hash(value)
280
+ end
281
+ hash
282
+ end
283
+
284
+ # Outputs non-array value in the form of hash
285
+ # For object, use to_hash. Otherwise, just return the value
286
+ # @param [Object] value Any valid value
287
+ # @return [Hash] Returns the value in the form of hash
288
+ def _to_hash(value)
289
+ if value.is_a?(Array)
290
+ value.compact.map { |v| _to_hash(v) }
291
+ elsif value.is_a?(Hash)
292
+ {}.tap do |hash|
293
+ value.each { |k, v| hash[k] = _to_hash(v) }
294
+ end
295
+ elsif value.respond_to? :to_hash
296
+ value.to_hash
297
+ else
298
+ value
299
+ end
300
+ end
301
+
302
+ end
303
+
304
+ end
@@ -0,0 +1,364 @@
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.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module StackOneHRIS
17
+ class ConnectSessionToken
18
+ attr_accessor :id
19
+
20
+ attr_accessor :organization_id
21
+
22
+ attr_accessor :project_id
23
+
24
+ attr_accessor :categories
25
+
26
+ attr_accessor :provider
27
+
28
+ attr_accessor :origin_owner_id
29
+
30
+ attr_accessor :origin_owner_name
31
+
32
+ attr_accessor :origin_username
33
+
34
+ attr_accessor :created_at
35
+
36
+ attr_accessor :token
37
+
38
+ class EnumAttributeValidator
39
+ attr_reader :datatype
40
+ attr_reader :allowable_values
41
+
42
+ def initialize(datatype, allowable_values)
43
+ @allowable_values = allowable_values.map do |value|
44
+ case datatype.to_s
45
+ when /Integer/i
46
+ value.to_i
47
+ when /Float/i
48
+ value.to_f
49
+ else
50
+ value
51
+ end
52
+ end
53
+ end
54
+
55
+ def valid?(value)
56
+ !value || allowable_values.include?(value)
57
+ end
58
+ end
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'id' => :'id',
64
+ :'organization_id' => :'organization_id',
65
+ :'project_id' => :'project_id',
66
+ :'categories' => :'categories',
67
+ :'provider' => :'provider',
68
+ :'origin_owner_id' => :'origin_owner_id',
69
+ :'origin_owner_name' => :'origin_owner_name',
70
+ :'origin_username' => :'origin_username',
71
+ :'created_at' => :'created_at',
72
+ :'token' => :'token'
73
+ }
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'id' => :'String',
85
+ :'organization_id' => :'String',
86
+ :'project_id' => :'String',
87
+ :'categories' => :'Array<String>',
88
+ :'provider' => :'String',
89
+ :'origin_owner_id' => :'String',
90
+ :'origin_owner_name' => :'String',
91
+ :'origin_username' => :'String',
92
+ :'created_at' => :'Time',
93
+ :'token' => :'String'
94
+ }
95
+ end
96
+
97
+ # List of attributes with nullable: true
98
+ def self.openapi_nullable
99
+ Set.new([
100
+ ])
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ if (!attributes.is_a?(Hash))
107
+ fail ArgumentError, "The input argument (attributes) must be a hash in `StackOneHRIS::ConnectSessionToken` initialize method"
108
+ end
109
+
110
+ # check to see if the attribute exists and convert string to symbol for hash key
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!self.class.attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `StackOneHRIS::ConnectSessionToken`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'id')
119
+ self.id = attributes[:'id']
120
+ end
121
+
122
+ if attributes.key?(:'organization_id')
123
+ self.organization_id = attributes[:'organization_id']
124
+ end
125
+
126
+ if attributes.key?(:'project_id')
127
+ self.project_id = attributes[:'project_id']
128
+ end
129
+
130
+ if attributes.key?(:'categories')
131
+ if (value = attributes[:'categories']).is_a?(Array)
132
+ self.categories = value
133
+ end
134
+ end
135
+
136
+ if attributes.key?(:'provider')
137
+ self.provider = attributes[:'provider']
138
+ end
139
+
140
+ if attributes.key?(:'origin_owner_id')
141
+ self.origin_owner_id = attributes[:'origin_owner_id']
142
+ end
143
+
144
+ if attributes.key?(:'origin_owner_name')
145
+ self.origin_owner_name = attributes[:'origin_owner_name']
146
+ end
147
+
148
+ if attributes.key?(:'origin_username')
149
+ self.origin_username = attributes[:'origin_username']
150
+ end
151
+
152
+ if attributes.key?(:'created_at')
153
+ self.created_at = attributes[:'created_at']
154
+ end
155
+
156
+ if attributes.key?(:'token')
157
+ self.token = attributes[:'token']
158
+ end
159
+ end
160
+
161
+ # Show invalid properties with the reasons. Usually used together with valid?
162
+ # @return Array for valid properties with the reasons
163
+ def list_invalid_properties
164
+ invalid_properties = Array.new
165
+ if @id.nil?
166
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
167
+ end
168
+
169
+ if @organization_id.nil?
170
+ invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.')
171
+ end
172
+
173
+ if @project_id.nil?
174
+ invalid_properties.push('invalid value for "project_id", project_id cannot be nil.')
175
+ end
176
+
177
+ if @provider.nil?
178
+ invalid_properties.push('invalid value for "provider", provider cannot be nil.')
179
+ end
180
+
181
+ if @origin_owner_id.nil?
182
+ invalid_properties.push('invalid value for "origin_owner_id", origin_owner_id cannot be nil.')
183
+ end
184
+
185
+ if @origin_owner_name.nil?
186
+ invalid_properties.push('invalid value for "origin_owner_name", origin_owner_name cannot be nil.')
187
+ end
188
+
189
+ if @created_at.nil?
190
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
191
+ end
192
+
193
+ if @token.nil?
194
+ invalid_properties.push('invalid value for "token", token cannot be nil.')
195
+ end
196
+
197
+ invalid_properties
198
+ end
199
+
200
+ # Check to see if the all the properties in the model are valid
201
+ # @return true if the model is valid
202
+ def valid?
203
+ return false if @id.nil?
204
+ return false if @organization_id.nil?
205
+ return false if @project_id.nil?
206
+ return false if @provider.nil?
207
+ return false if @origin_owner_id.nil?
208
+ return false if @origin_owner_name.nil?
209
+ return false if @created_at.nil?
210
+ return false if @token.nil?
211
+ true
212
+ end
213
+
214
+ # Checks equality by comparing each attribute.
215
+ # @param [Object] Object to be compared
216
+ def ==(o)
217
+ return true if self.equal?(o)
218
+ self.class == o.class &&
219
+ id == o.id &&
220
+ organization_id == o.organization_id &&
221
+ project_id == o.project_id &&
222
+ categories == o.categories &&
223
+ provider == o.provider &&
224
+ origin_owner_id == o.origin_owner_id &&
225
+ origin_owner_name == o.origin_owner_name &&
226
+ origin_username == o.origin_username &&
227
+ created_at == o.created_at &&
228
+ token == o.token
229
+ end
230
+
231
+ # @see the `==` method
232
+ # @param [Object] Object to be compared
233
+ def eql?(o)
234
+ self == o
235
+ end
236
+
237
+ # Calculates hash code according to all attributes.
238
+ # @return [Integer] Hash code
239
+ def hash
240
+ [id, organization_id, project_id, categories, provider, origin_owner_id, origin_owner_name, origin_username, created_at, token].hash
241
+ end
242
+
243
+ # Builds the object from hash
244
+ # @param [Hash] attributes Model attributes in the form of hash
245
+ # @return [Object] Returns the model itself
246
+ def self.build_from_hash(attributes)
247
+ new.build_from_hash(attributes)
248
+ end
249
+
250
+ # Builds the object from hash
251
+ # @param [Hash] attributes Model attributes in the form of hash
252
+ # @return [Object] Returns the model itself
253
+ def build_from_hash(attributes)
254
+ return nil unless attributes.is_a?(Hash)
255
+ attributes = attributes.transform_keys(&:to_sym)
256
+ self.class.openapi_types.each_pair do |key, type|
257
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
258
+ self.send("#{key}=", nil)
259
+ elsif type =~ /\AArray<(.*)>/i
260
+ # check to ensure the input is an array given that the attribute
261
+ # is documented as an array but the input is not
262
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
263
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
264
+ end
265
+ elsif !attributes[self.class.attribute_map[key]].nil?
266
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
267
+ end
268
+ end
269
+
270
+ self
271
+ end
272
+
273
+ # Deserializes the data based on type
274
+ # @param string type Data type
275
+ # @param string value Value to be deserialized
276
+ # @return [Object] Deserialized data
277
+ def _deserialize(type, value)
278
+ case type.to_sym
279
+ when :Time
280
+ Time.parse(value)
281
+ when :Date
282
+ Date.parse(value)
283
+ when :String
284
+ value.to_s
285
+ when :Integer
286
+ value.to_i
287
+ when :Float
288
+ value.to_f
289
+ when :Boolean
290
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
291
+ true
292
+ else
293
+ false
294
+ end
295
+ when :Object
296
+ # generic object (usually a Hash), return directly
297
+ value
298
+ when /\AArray<(?<inner_type>.+)>\z/
299
+ inner_type = Regexp.last_match[:inner_type]
300
+ value.map { |v| _deserialize(inner_type, v) }
301
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
302
+ k_type = Regexp.last_match[:k_type]
303
+ v_type = Regexp.last_match[:v_type]
304
+ {}.tap do |hash|
305
+ value.each do |k, v|
306
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
307
+ end
308
+ end
309
+ else # model
310
+ # models (e.g. Pet) or oneOf
311
+ klass = StackOneHRIS.const_get(type)
312
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
313
+ end
314
+ end
315
+
316
+ # Returns the string representation of the object
317
+ # @return [String] String presentation of the object
318
+ def to_s
319
+ to_hash.to_s
320
+ end
321
+
322
+ # to_body is an alias to to_hash (backward compatibility)
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_body
325
+ to_hash
326
+ end
327
+
328
+ # Returns the object in the form of hash
329
+ # @return [Hash] Returns the object in the form of hash
330
+ def to_hash
331
+ hash = {}
332
+ self.class.attribute_map.each_pair do |attr, param|
333
+ value = self.send(attr)
334
+ if value.nil?
335
+ is_nullable = self.class.openapi_nullable.include?(attr)
336
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
337
+ end
338
+
339
+ hash[param] = _to_hash(value)
340
+ end
341
+ hash
342
+ end
343
+
344
+ # Outputs non-array value in the form of hash
345
+ # For object, use to_hash. Otherwise, just return the value
346
+ # @param [Object] value Any valid value
347
+ # @return [Hash] Returns the value in the form of hash
348
+ def _to_hash(value)
349
+ if value.is_a?(Array)
350
+ value.compact.map { |v| _to_hash(v) }
351
+ elsif value.is_a?(Hash)
352
+ {}.tap do |hash|
353
+ value.each { |k, v| hash[k] = _to_hash(v) }
354
+ end
355
+ elsif value.respond_to? :to_hash
356
+ value.to_hash
357
+ else
358
+ value
359
+ end
360
+ end
361
+
362
+ end
363
+
364
+ end