hatchet-sdk 0.6.0 → 0.7.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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/lib/hatchet/clients/rest/.openapi-generator/FILES +9 -0
  4. data/lib/hatchet/clients/rest/README.md +16 -3
  5. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/filter_api.rb +4 -0
  6. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/operator_api.rb +405 -0
  7. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/webhook_api.rb +2 -0
  8. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_meta.rb +14 -4
  9. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_tenant_invite_request.rb +14 -4
  10. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request.rb +105 -0
  11. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request_pause.rb +343 -0
  12. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pause_workflow_request_unpause.rb +262 -0
  13. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_invite.rb +11 -1
  14. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member.rb +11 -1
  15. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member_role.rb +2 -1
  16. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_invite_request.rb +14 -4
  17. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_member_request.rb +14 -4
  18. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_http_operator_request.rb +346 -0
  19. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_event.rb +14 -4
  20. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator.rb +372 -0
  21. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_http_operator_list.rb +231 -0
  22. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_summary.rb +14 -4
  23. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_http_operator_request.rb +252 -0
  24. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run.rb +14 -4
  25. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow.rb +43 -1
  26. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_pause_scheduled_cron_run_queue_behavior.rb +40 -0
  27. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_update_request.rb +7 -8
  28. data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +9 -0
  29. data/lib/hatchet/concurrency.rb +5 -1
  30. data/lib/hatchet/context.rb +5 -2
  31. data/lib/hatchet/contracts/v1/workflows_pb.rb +1 -1
  32. data/lib/hatchet/durable_context.rb +5 -12
  33. data/lib/hatchet/features/cel.rb +2 -2
  34. data/lib/hatchet/features/cron.rb +5 -5
  35. data/lib/hatchet/features/events.rb +7 -7
  36. data/lib/hatchet/features/filters.rb +7 -7
  37. data/lib/hatchet/features/logs.rb +2 -2
  38. data/lib/hatchet/features/metrics.rb +6 -6
  39. data/lib/hatchet/features/rate_limits.rb +2 -2
  40. data/lib/hatchet/features/runs.rb +4 -5
  41. data/lib/hatchet/features/scheduled.rb +7 -7
  42. data/lib/hatchet/features/tenant.rb +2 -2
  43. data/lib/hatchet/features/workers.rb +5 -5
  44. data/lib/hatchet/features/workflows.rb +6 -6
  45. data/lib/hatchet/version.rb +1 -1
  46. data/lib/hatchet/workflow.rb +58 -33
  47. data/lib/hatchet-sdk.rb +65 -32
  48. metadata +11 -2
@@ -21,6 +21,9 @@ module HatchetSdkRest
21
21
  # The role of the user in the tenant.
22
22
  attr_accessor :role
23
23
 
24
+ # Whether the invited user can view payloads. Defaults to true.
25
+ attr_accessor :can_view_payloads
26
+
24
27
  class EnumAttributeValidator
25
28
  attr_reader :datatype
26
29
  attr_reader :allowable_values
@@ -47,7 +50,8 @@ module HatchetSdkRest
47
50
  def self.attribute_map
48
51
  {
49
52
  :'email' => :'email',
50
- :'role' => :'role'
53
+ :'role' => :'role',
54
+ :'can_view_payloads' => :'canViewPayloads'
51
55
  }
52
56
  end
53
57
 
@@ -65,7 +69,8 @@ module HatchetSdkRest
65
69
  def self.openapi_types
66
70
  {
67
71
  :'email' => :'String',
68
- :'role' => :'TenantMemberRole'
72
+ :'role' => :'TenantMemberRole',
73
+ :'can_view_payloads' => :'Boolean'
69
74
  }
70
75
  end
71
76
 
@@ -102,6 +107,10 @@ module HatchetSdkRest
102
107
  else
103
108
  self.role = nil
104
109
  end
110
+
111
+ if attributes.key?(:'can_view_payloads')
112
+ self.can_view_payloads = attributes[:'can_view_payloads']
113
+ end
105
114
  end
106
115
 
107
116
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -155,7 +164,8 @@ module HatchetSdkRest
155
164
  return true if self.equal?(o)
156
165
  self.class == o.class &&
157
166
  email == o.email &&
158
- role == o.role
167
+ role == o.role &&
168
+ can_view_payloads == o.can_view_payloads
159
169
  end
160
170
 
161
171
  # @see the `==` method
@@ -167,7 +177,7 @@ module HatchetSdkRest
167
177
  # Calculates hash code according to all attributes.
168
178
  # @return [Integer] Hash code
169
179
  def hash
170
- [email, role].hash
180
+ [email, role, can_view_payloads].hash
171
181
  end
172
182
 
173
183
  # Builds the object from hash
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #Hatchet API
3
+
4
+ #The Hatchet API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module HatchetSdkRest
17
+ module PauseWorkflowRequest
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'PauseWorkflowRequestPause',
23
+ :'PauseWorkflowRequestUnpause'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.iso8601(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = HatchetSdkRest.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -0,0 +1,343 @@
1
+ =begin
2
+ #Hatchet API
3
+
4
+ #The Hatchet API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module HatchetSdkRest
17
+ class PauseWorkflowRequestPause
18
+ # Discriminator indicating this request pauses the workflow.
19
+ attr_accessor :action
20
+
21
+ # The behavior of cron runs triggered while the workflow is paused.
22
+ attr_accessor :paused_workflow_cron_run_queue_behavior
23
+
24
+ # The behavior of scheduled runs triggered while the workflow is paused.
25
+ attr_accessor :paused_workflow_scheduled_run_queue_behavior
26
+
27
+ # The TTL for queued runs while the workflow is paused before they get dropped, expressed as a Go-style duration string (e.g. \"1d7h30m\").
28
+ attr_accessor :paused_workflow_queue_ttl
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'action' => :'action',
56
+ :'paused_workflow_cron_run_queue_behavior' => :'pausedWorkflowCronRunQueueBehavior',
57
+ :'paused_workflow_scheduled_run_queue_behavior' => :'pausedWorkflowScheduledRunQueueBehavior',
58
+ :'paused_workflow_queue_ttl' => :'pausedWorkflowQueueTTL'
59
+ }
60
+ end
61
+
62
+ # Returns attribute mapping this model knows about
63
+ def self.acceptable_attribute_map
64
+ attribute_map
65
+ end
66
+
67
+ # Returns all the JSON keys this model knows about
68
+ def self.acceptable_attributes
69
+ acceptable_attribute_map.values
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'action' => :'String',
76
+ :'paused_workflow_cron_run_queue_behavior' => :'WorkflowPauseScheduledCronRunQueueBehavior',
77
+ :'paused_workflow_scheduled_run_queue_behavior' => :'WorkflowPauseScheduledCronRunQueueBehavior',
78
+ :'paused_workflow_queue_ttl' => :'String'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HatchetSdkRest::PauseWorkflowRequestPause` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ acceptable_attribute_map = self.class.acceptable_attribute_map
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!acceptable_attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HatchetSdkRest::PauseWorkflowRequestPause`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'action')
105
+ self.action = attributes[:'action']
106
+ else
107
+ self.action = nil
108
+ end
109
+
110
+ if attributes.key?(:'paused_workflow_cron_run_queue_behavior')
111
+ self.paused_workflow_cron_run_queue_behavior = attributes[:'paused_workflow_cron_run_queue_behavior']
112
+ else
113
+ self.paused_workflow_cron_run_queue_behavior = nil
114
+ end
115
+
116
+ if attributes.key?(:'paused_workflow_scheduled_run_queue_behavior')
117
+ self.paused_workflow_scheduled_run_queue_behavior = attributes[:'paused_workflow_scheduled_run_queue_behavior']
118
+ else
119
+ self.paused_workflow_scheduled_run_queue_behavior = nil
120
+ end
121
+
122
+ if attributes.key?(:'paused_workflow_queue_ttl')
123
+ self.paused_workflow_queue_ttl = attributes[:'paused_workflow_queue_ttl']
124
+ else
125
+ self.paused_workflow_queue_ttl = nil
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
133
+ invalid_properties = Array.new
134
+ if @action.nil?
135
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
136
+ end
137
+
138
+ if @paused_workflow_cron_run_queue_behavior.nil?
139
+ invalid_properties.push('invalid value for "paused_workflow_cron_run_queue_behavior", paused_workflow_cron_run_queue_behavior cannot be nil.')
140
+ end
141
+
142
+ if @paused_workflow_scheduled_run_queue_behavior.nil?
143
+ invalid_properties.push('invalid value for "paused_workflow_scheduled_run_queue_behavior", paused_workflow_scheduled_run_queue_behavior cannot be nil.')
144
+ end
145
+
146
+ if @paused_workflow_queue_ttl.nil?
147
+ invalid_properties.push('invalid value for "paused_workflow_queue_ttl", paused_workflow_queue_ttl cannot be nil.')
148
+ end
149
+
150
+ invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ warn '[DEPRECATED] the `valid?` method is obsolete'
157
+ return false if @action.nil?
158
+ action_validator = EnumAttributeValidator.new('String', ["pause"])
159
+ return false unless action_validator.valid?(@action)
160
+ return false if @paused_workflow_cron_run_queue_behavior.nil?
161
+ return false if @paused_workflow_scheduled_run_queue_behavior.nil?
162
+ return false if @paused_workflow_queue_ttl.nil?
163
+ true
164
+ end
165
+
166
+ # Custom attribute writer method checking allowed values (enum).
167
+ # @param [Object] action Object to be assigned
168
+ def action=(action)
169
+ validator = EnumAttributeValidator.new('String', ["pause"])
170
+ unless validator.valid?(action)
171
+ fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
172
+ end
173
+ @action = action
174
+ end
175
+
176
+ # Custom attribute writer method with validation
177
+ # @param [Object] paused_workflow_cron_run_queue_behavior Value to be assigned
178
+ def paused_workflow_cron_run_queue_behavior=(paused_workflow_cron_run_queue_behavior)
179
+ if paused_workflow_cron_run_queue_behavior.nil?
180
+ fail ArgumentError, 'paused_workflow_cron_run_queue_behavior cannot be nil'
181
+ end
182
+
183
+ @paused_workflow_cron_run_queue_behavior = paused_workflow_cron_run_queue_behavior
184
+ end
185
+
186
+ # Custom attribute writer method with validation
187
+ # @param [Object] paused_workflow_scheduled_run_queue_behavior Value to be assigned
188
+ def paused_workflow_scheduled_run_queue_behavior=(paused_workflow_scheduled_run_queue_behavior)
189
+ if paused_workflow_scheduled_run_queue_behavior.nil?
190
+ fail ArgumentError, 'paused_workflow_scheduled_run_queue_behavior cannot be nil'
191
+ end
192
+
193
+ @paused_workflow_scheduled_run_queue_behavior = paused_workflow_scheduled_run_queue_behavior
194
+ end
195
+
196
+ # Custom attribute writer method with validation
197
+ # @param [Object] paused_workflow_queue_ttl Value to be assigned
198
+ def paused_workflow_queue_ttl=(paused_workflow_queue_ttl)
199
+ if paused_workflow_queue_ttl.nil?
200
+ fail ArgumentError, 'paused_workflow_queue_ttl cannot be nil'
201
+ end
202
+
203
+ @paused_workflow_queue_ttl = paused_workflow_queue_ttl
204
+ end
205
+
206
+ # Checks equality by comparing each attribute.
207
+ # @param [Object] Object to be compared
208
+ def ==(o)
209
+ return true if self.equal?(o)
210
+ self.class == o.class &&
211
+ action == o.action &&
212
+ paused_workflow_cron_run_queue_behavior == o.paused_workflow_cron_run_queue_behavior &&
213
+ paused_workflow_scheduled_run_queue_behavior == o.paused_workflow_scheduled_run_queue_behavior &&
214
+ paused_workflow_queue_ttl == o.paused_workflow_queue_ttl
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
+ [action, paused_workflow_cron_run_queue_behavior, paused_workflow_scheduled_run_queue_behavior, paused_workflow_queue_ttl].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
+ return nil unless attributes.is_a?(Hash)
234
+ attributes = attributes.transform_keys(&:to_sym)
235
+ transformed_hash = {}
236
+ openapi_types.each_pair do |key, type|
237
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
238
+ transformed_hash["#{key}"] = nil
239
+ elsif type =~ /\AArray<(.*)>/i
240
+ # check to ensure the input is an array given that the attribute
241
+ # is documented as an array but the input is not
242
+ if attributes[attribute_map[key]].is_a?(Array)
243
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
244
+ end
245
+ elsif !attributes[attribute_map[key]].nil?
246
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
247
+ end
248
+ end
249
+ new(transformed_hash)
250
+ end
251
+
252
+ # Deserializes the data based on type
253
+ # @param string type Data type
254
+ # @param string value Value to be deserialized
255
+ # @return [Object] Deserialized data
256
+ def self._deserialize(type, value)
257
+ case type.to_sym
258
+ when :Time
259
+ Time.parse(value)
260
+ when :Date
261
+ Date.parse(value)
262
+ when :String
263
+ value.to_s
264
+ when :Integer
265
+ value.to_i
266
+ when :Float
267
+ value.to_f
268
+ when :Boolean
269
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
270
+ true
271
+ else
272
+ false
273
+ end
274
+ when :Object
275
+ # generic object (usually a Hash), return directly
276
+ value
277
+ when /\AArray<(?<inner_type>.+)>\z/
278
+ inner_type = Regexp.last_match[:inner_type]
279
+ value.map { |v| _deserialize(inner_type, v) }
280
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
281
+ k_type = Regexp.last_match[:k_type]
282
+ v_type = Regexp.last_match[:v_type]
283
+ {}.tap do |hash|
284
+ value.each do |k, v|
285
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
286
+ end
287
+ end
288
+ else # model
289
+ # models (e.g. Pet) or oneOf
290
+ klass = HatchetSdkRest.const_get(type)
291
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
292
+ end
293
+ end
294
+
295
+ # Returns the string representation of the object
296
+ # @return [String] String presentation of the object
297
+ def to_s
298
+ to_hash.to_s
299
+ end
300
+
301
+ # to_body is an alias to to_hash (backward compatibility)
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_body
304
+ to_hash
305
+ end
306
+
307
+ # Returns the object in the form of hash
308
+ # @return [Hash] Returns the object in the form of hash
309
+ def to_hash
310
+ hash = {}
311
+ self.class.attribute_map.each_pair do |attr, param|
312
+ value = self.send(attr)
313
+ if value.nil?
314
+ is_nullable = self.class.openapi_nullable.include?(attr)
315
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
316
+ end
317
+
318
+ hash[param] = _to_hash(value)
319
+ end
320
+ hash
321
+ end
322
+
323
+ # Outputs non-array value in the form of hash
324
+ # For object, use to_hash. Otherwise, just return the value
325
+ # @param [Object] value Any valid value
326
+ # @return [Hash] Returns the value in the form of hash
327
+ def _to_hash(value)
328
+ if value.is_a?(Array)
329
+ value.compact.map { |v| _to_hash(v) }
330
+ elsif value.is_a?(Hash)
331
+ {}.tap do |hash|
332
+ value.each { |k, v| hash[k] = _to_hash(v) }
333
+ end
334
+ elsif value.respond_to? :to_hash
335
+ value.to_hash
336
+ else
337
+ value
338
+ end
339
+ end
340
+
341
+ end
342
+
343
+ end