stackone_hris_client 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,350 @@
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 ConnectSession
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
+ 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
+ :'id' => :'id',
62
+ :'organization_id' => :'organization_id',
63
+ :'project_id' => :'project_id',
64
+ :'categories' => :'categories',
65
+ :'provider' => :'provider',
66
+ :'origin_owner_id' => :'origin_owner_id',
67
+ :'origin_owner_name' => :'origin_owner_name',
68
+ :'origin_username' => :'origin_username',
69
+ :'created_at' => :'created_at'
70
+ }
71
+ end
72
+
73
+ # Returns all the JSON keys this model knows about
74
+ def self.acceptable_attributes
75
+ attribute_map.values
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'id' => :'String',
82
+ :'organization_id' => :'String',
83
+ :'project_id' => :'String',
84
+ :'categories' => :'Array<String>',
85
+ :'provider' => :'String',
86
+ :'origin_owner_id' => :'String',
87
+ :'origin_owner_name' => :'String',
88
+ :'origin_username' => :'String',
89
+ :'created_at' => :'Time'
90
+ }
91
+ end
92
+
93
+ # List of attributes with nullable: true
94
+ def self.openapi_nullable
95
+ Set.new([
96
+ ])
97
+ end
98
+
99
+ # Initializes the object
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ def initialize(attributes = {})
102
+ if (!attributes.is_a?(Hash))
103
+ fail ArgumentError, "The input argument (attributes) must be a hash in `StackOneHRIS::ConnectSession` initialize method"
104
+ end
105
+
106
+ # check to see if the attribute exists and convert string to symbol for hash key
107
+ attributes = attributes.each_with_object({}) { |(k, v), h|
108
+ if (!self.class.attribute_map.key?(k.to_sym))
109
+ fail ArgumentError, "`#{k}` is not a valid attribute in `StackOneHRIS::ConnectSession`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
110
+ end
111
+ h[k.to_sym] = v
112
+ }
113
+
114
+ if attributes.key?(:'id')
115
+ self.id = attributes[:'id']
116
+ end
117
+
118
+ if attributes.key?(:'organization_id')
119
+ self.organization_id = attributes[:'organization_id']
120
+ end
121
+
122
+ if attributes.key?(:'project_id')
123
+ self.project_id = attributes[:'project_id']
124
+ end
125
+
126
+ if attributes.key?(:'categories')
127
+ if (value = attributes[:'categories']).is_a?(Array)
128
+ self.categories = value
129
+ end
130
+ end
131
+
132
+ if attributes.key?(:'provider')
133
+ self.provider = attributes[:'provider']
134
+ end
135
+
136
+ if attributes.key?(:'origin_owner_id')
137
+ self.origin_owner_id = attributes[:'origin_owner_id']
138
+ end
139
+
140
+ if attributes.key?(:'origin_owner_name')
141
+ self.origin_owner_name = attributes[:'origin_owner_name']
142
+ end
143
+
144
+ if attributes.key?(:'origin_username')
145
+ self.origin_username = attributes[:'origin_username']
146
+ end
147
+
148
+ if attributes.key?(:'created_at')
149
+ self.created_at = attributes[:'created_at']
150
+ end
151
+ end
152
+
153
+ # Show invalid properties with the reasons. Usually used together with valid?
154
+ # @return Array for valid properties with the reasons
155
+ def list_invalid_properties
156
+ invalid_properties = Array.new
157
+ if @id.nil?
158
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
159
+ end
160
+
161
+ if @organization_id.nil?
162
+ invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.')
163
+ end
164
+
165
+ if @project_id.nil?
166
+ invalid_properties.push('invalid value for "project_id", project_id cannot be nil.')
167
+ end
168
+
169
+ if @provider.nil?
170
+ invalid_properties.push('invalid value for "provider", provider cannot be nil.')
171
+ end
172
+
173
+ if @origin_owner_id.nil?
174
+ invalid_properties.push('invalid value for "origin_owner_id", origin_owner_id cannot be nil.')
175
+ end
176
+
177
+ if @origin_owner_name.nil?
178
+ invalid_properties.push('invalid value for "origin_owner_name", origin_owner_name cannot be nil.')
179
+ end
180
+
181
+ if @created_at.nil?
182
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
183
+ end
184
+
185
+ invalid_properties
186
+ end
187
+
188
+ # Check to see if the all the properties in the model are valid
189
+ # @return true if the model is valid
190
+ def valid?
191
+ return false if @id.nil?
192
+ return false if @organization_id.nil?
193
+ return false if @project_id.nil?
194
+ return false if @provider.nil?
195
+ return false if @origin_owner_id.nil?
196
+ return false if @origin_owner_name.nil?
197
+ return false if @created_at.nil?
198
+ true
199
+ end
200
+
201
+ # Checks equality by comparing each attribute.
202
+ # @param [Object] Object to be compared
203
+ def ==(o)
204
+ return true if self.equal?(o)
205
+ self.class == o.class &&
206
+ id == o.id &&
207
+ organization_id == o.organization_id &&
208
+ project_id == o.project_id &&
209
+ categories == o.categories &&
210
+ provider == o.provider &&
211
+ origin_owner_id == o.origin_owner_id &&
212
+ origin_owner_name == o.origin_owner_name &&
213
+ origin_username == o.origin_username &&
214
+ created_at == o.created_at
215
+ end
216
+
217
+ # @see the `==` method
218
+ # @param [Object] Object to be compared
219
+ def eql?(o)
220
+ self == o
221
+ end
222
+
223
+ # Calculates hash code according to all attributes.
224
+ # @return [Integer] Hash code
225
+ def hash
226
+ [id, organization_id, project_id, categories, provider, origin_owner_id, origin_owner_name, origin_username, created_at].hash
227
+ end
228
+
229
+ # Builds the object from hash
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ # @return [Object] Returns the model itself
232
+ def self.build_from_hash(attributes)
233
+ new.build_from_hash(attributes)
234
+ end
235
+
236
+ # Builds the object from hash
237
+ # @param [Hash] attributes Model attributes in the form of hash
238
+ # @return [Object] Returns the model itself
239
+ def build_from_hash(attributes)
240
+ return nil unless attributes.is_a?(Hash)
241
+ attributes = attributes.transform_keys(&:to_sym)
242
+ self.class.openapi_types.each_pair do |key, type|
243
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
244
+ self.send("#{key}=", nil)
245
+ elsif type =~ /\AArray<(.*)>/i
246
+ # check to ensure the input is an array given that the attribute
247
+ # is documented as an array but the input is not
248
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
249
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
250
+ end
251
+ elsif !attributes[self.class.attribute_map[key]].nil?
252
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
253
+ end
254
+ end
255
+
256
+ self
257
+ end
258
+
259
+ # Deserializes the data based on type
260
+ # @param string type Data type
261
+ # @param string value Value to be deserialized
262
+ # @return [Object] Deserialized data
263
+ def _deserialize(type, value)
264
+ case type.to_sym
265
+ when :Time
266
+ Time.parse(value)
267
+ when :Date
268
+ Date.parse(value)
269
+ when :String
270
+ value.to_s
271
+ when :Integer
272
+ value.to_i
273
+ when :Float
274
+ value.to_f
275
+ when :Boolean
276
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
277
+ true
278
+ else
279
+ false
280
+ end
281
+ when :Object
282
+ # generic object (usually a Hash), return directly
283
+ value
284
+ when /\AArray<(?<inner_type>.+)>\z/
285
+ inner_type = Regexp.last_match[:inner_type]
286
+ value.map { |v| _deserialize(inner_type, v) }
287
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
288
+ k_type = Regexp.last_match[:k_type]
289
+ v_type = Regexp.last_match[:v_type]
290
+ {}.tap do |hash|
291
+ value.each do |k, v|
292
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
293
+ end
294
+ end
295
+ else # model
296
+ # models (e.g. Pet) or oneOf
297
+ klass = StackOneHRIS.const_get(type)
298
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
299
+ end
300
+ end
301
+
302
+ # Returns the string representation of the object
303
+ # @return [String] String presentation of the object
304
+ def to_s
305
+ to_hash.to_s
306
+ end
307
+
308
+ # to_body is an alias to to_hash (backward compatibility)
309
+ # @return [Hash] Returns the object in the form of hash
310
+ def to_body
311
+ to_hash
312
+ end
313
+
314
+ # Returns the object in the form of hash
315
+ # @return [Hash] Returns the object in the form of hash
316
+ def to_hash
317
+ hash = {}
318
+ self.class.attribute_map.each_pair do |attr, param|
319
+ value = self.send(attr)
320
+ if value.nil?
321
+ is_nullable = self.class.openapi_nullable.include?(attr)
322
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
323
+ end
324
+
325
+ hash[param] = _to_hash(value)
326
+ end
327
+ hash
328
+ end
329
+
330
+ # Outputs non-array value in the form of hash
331
+ # For object, use to_hash. Otherwise, just return the value
332
+ # @param [Object] value Any valid value
333
+ # @return [Hash] Returns the value in the form of hash
334
+ def _to_hash(value)
335
+ if value.is_a?(Array)
336
+ value.compact.map { |v| _to_hash(v) }
337
+ elsif value.is_a?(Hash)
338
+ {}.tap do |hash|
339
+ value.each { |k, v| hash[k] = _to_hash(v) }
340
+ end
341
+ elsif value.respond_to? :to_hash
342
+ value.to_hash
343
+ else
344
+ value
345
+ end
346
+ end
347
+
348
+ end
349
+
350
+ end
@@ -0,0 +1,225 @@
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 ConnectSessionAuthenticate
18
+ # The token to authenticate with
19
+ attr_accessor :token
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'token' => :'token'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'token' => :'String'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `StackOneHRIS::ConnectSessionAuthenticate` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `StackOneHRIS::ConnectSessionAuthenticate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'token')
62
+ self.token = attributes[:'token']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ if @token.nil?
71
+ invalid_properties.push('invalid value for "token", token cannot be nil.')
72
+ end
73
+
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ return false if @token.nil?
81
+ true
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(o)
87
+ return true if self.equal?(o)
88
+ self.class == o.class &&
89
+ token == o.token
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(o)
95
+ self == o
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Integer] Hash code
100
+ def hash
101
+ [token].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ new.build_from_hash(attributes)
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ attributes = attributes.transform_keys(&:to_sym)
117
+ self.class.openapi_types.each_pair do |key, type|
118
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
119
+ self.send("#{key}=", nil)
120
+ elsif type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :Time
141
+ Time.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ # models (e.g. Pet) or oneOf
172
+ klass = StackOneHRIS.const_get(type)
173
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
+ end
175
+ end
176
+
177
+ # Returns the string representation of the object
178
+ # @return [String] String presentation of the object
179
+ def to_s
180
+ to_hash.to_s
181
+ end
182
+
183
+ # to_body is an alias to to_hash (backward compatibility)
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Outputs non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ # @param [Object] value Any valid value
208
+ # @return [Hash] Returns the value in the form of hash
209
+ def _to_hash(value)
210
+ if value.is_a?(Array)
211
+ value.compact.map { |v| _to_hash(v) }
212
+ elsif value.is_a?(Hash)
213
+ {}.tap do |hash|
214
+ value.each { |k, v| hash[k] = _to_hash(v) }
215
+ end
216
+ elsif value.respond_to? :to_hash
217
+ value.to_hash
218
+ else
219
+ value
220
+ end
221
+ end
222
+
223
+ end
224
+
225
+ end