crisphive 0.2.0 → 0.3.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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +98 -10
  3. data/lib/crisphive/api/business_skill_api.rb +348 -0
  4. data/lib/crisphive/api/customer_api.rb +7 -4
  5. data/lib/crisphive/api/job_request_business_api.rb +243 -27
  6. data/lib/crisphive/api/job_types_api.rb +208 -0
  7. data/lib/crisphive/api/permission_api.rb +79 -0
  8. data/lib/crisphive/api/service_area_api.rb +208 -0
  9. data/lib/crisphive/api/technician_api.rb +8 -8
  10. data/lib/crisphive/api/technician_time_off_api.rb +240 -0
  11. data/lib/crisphive/api/vehicle_api.rb +208 -0
  12. data/lib/crisphive/api/webhooks_api.rb +213 -0
  13. data/lib/crisphive/models/api_internal_techtimeoff_actions.rb +232 -0
  14. data/lib/crisphive/models/api_internal_techtimeoff_status.rb +42 -0
  15. data/lib/crisphive/models/assignable_group.rb +289 -0
  16. data/lib/crisphive/models/book_and_confirm_job_request200_response.rb +253 -0
  17. data/lib/crisphive/models/commit_absence_resolve200_response.rb +253 -0
  18. data/lib/crisphive/models/create_job_type200_response.rb +253 -0
  19. data/lib/crisphive/models/create_service_area200_response.rb +253 -0
  20. data/lib/crisphive/models/create_skill200_response.rb +253 -0
  21. data/lib/crisphive/models/create_skill_category200_response.rb +253 -0
  22. data/lib/crisphive/models/create_technician_time_off200_response.rb +253 -0
  23. data/lib/crisphive/models/create_vehicle200_response.rb +253 -0
  24. data/lib/crisphive/models/create_webhook_endpoint200_response.rb +253 -0
  25. data/lib/crisphive/models/customer.rb +11 -1
  26. data/lib/crisphive/models/customer_contact.rb +25 -5
  27. data/lib/crisphive/models/customer_create_request.rb +12 -2
  28. data/lib/crisphive/models/customer_list_item.rb +11 -1
  29. data/lib/crisphive/models/customer_quick_books_link.rb +235 -0
  30. data/lib/crisphive/models/customer_service_area_ref.rb +225 -0
  31. data/lib/crisphive/models/customer_technician_ref.rb +225 -0
  32. data/lib/crisphive/models/customer_update_request.rb +23 -20
  33. data/lib/crisphive/models/internal_jobrequest_http_address_req.rb +475 -0
  34. data/lib/crisphive/models/job_request.rb +11 -1
  35. data/lib/crisphive/models/job_request_absence_alternative.rb +356 -0
  36. data/lib/crisphive/models/job_request_absence_alternative_cost.rb +275 -0
  37. data/lib/crisphive/models/job_request_absence_assignment.rb +319 -0
  38. data/lib/crisphive/models/job_request_absence_commit_request.rb +296 -0
  39. data/lib/crisphive/models/job_request_absence_notification.rb +283 -0
  40. data/lib/crisphive/models/job_request_absence_plan.rb +322 -0
  41. data/lib/crisphive/models/job_request_absence_preview_request.rb +280 -0
  42. data/lib/crisphive/models/job_request_absence_resolved_job.rb +499 -0
  43. data/lib/crisphive/models/job_request_absence_solver.rb +289 -0
  44. data/lib/crisphive/models/job_request_absence_time_off.rb +281 -0
  45. data/lib/crisphive/models/job_request_absence_unresolved_job.rb +364 -0
  46. data/lib/crisphive/models/job_request_action_summary.rb +1 -1
  47. data/lib/crisphive/models/job_request_attention_summary.rb +2 -2
  48. data/lib/crisphive/models/job_request_blocker.rb +363 -0
  49. data/lib/crisphive/models/job_request_blocker_ref.rb +223 -0
  50. data/lib/crisphive/models/job_request_book_and_confirm_customer.rb +302 -0
  51. data/lib/crisphive/models/job_request_book_and_confirm_emergency.rb +315 -0
  52. data/lib/crisphive/models/job_request_book_and_confirm_emergency_result.rb +279 -0
  53. data/lib/crisphive/models/job_request_book_and_confirm_refusal.rb +280 -0
  54. data/lib/crisphive/models/job_request_book_and_confirm_request.rb +466 -0
  55. data/lib/crisphive/models/job_request_book_and_confirm_response.rb +295 -0
  56. data/lib/crisphive/models/job_request_confirm_request.rb +14 -4
  57. data/lib/crisphive/models/job_request_create_request.rb +1 -1
  58. data/lib/crisphive/models/job_request_emergency_candidate.rb +26 -4
  59. data/lib/crisphive/models/job_request_emergency_candidates.rb +1 -1
  60. data/lib/crisphive/models/job_request_emergency_candidates_request.rb +24 -11
  61. data/lib/crisphive/models/job_request_emergency_commit_request.rb +11 -1
  62. data/lib/crisphive/models/job_request_emergency_inline_job.rb +353 -0
  63. data/lib/crisphive/models/job_request_emergency_plan.rb +25 -3
  64. data/lib/crisphive/models/job_request_emergency_preview_request.rb +24 -11
  65. data/lib/crisphive/models/job_request_move_commit_req.rb +11 -1
  66. data/lib/crisphive/models/job_request_move_plan.rb +11 -1
  67. data/lib/crisphive/models/job_request_move_preview_req.rb +11 -1
  68. data/lib/crisphive/models/job_request_move_warning.rb +32 -8
  69. data/lib/crisphive/models/job_request_priority_update_result.rb +217 -0
  70. data/lib/crisphive/models/job_request_quote_request.rb +14 -11
  71. data/lib/crisphive/models/job_request_reassign_fallback.rb +287 -0
  72. data/lib/crisphive/models/job_request_skill_summary.rb +1 -1
  73. data/lib/crisphive/models/job_request_status_summary.rb +1 -1
  74. data/lib/crisphive/models/job_request_time_segments.rb +2 -2
  75. data/lib/crisphive/models/job_type.rb +42 -2
  76. data/lib/crisphive/models/job_type_create_request.rb +399 -0
  77. data/lib/crisphive/models/job_type_create_response.rb +215 -0
  78. data/lib/crisphive/models/job_type_update_request.rb +400 -0
  79. data/lib/crisphive/models/list_assignable_groups200_response.rb +255 -0
  80. data/lib/crisphive/models/list_technician_time_off200_response.rb +253 -0
  81. data/lib/crisphive/models/list_webhook_event_types200_response.rb +255 -0
  82. data/lib/crisphive/models/quote_job_request200_response.rb +253 -0
  83. data/lib/crisphive/models/service_area.rb +21 -1
  84. data/lib/crisphive/models/service_area_create_request.rb +455 -0
  85. data/lib/crisphive/models/service_area_create_response.rb +215 -0
  86. data/lib/crisphive/models/service_area_update_request.rb +451 -0
  87. data/lib/crisphive/models/skill_category_create_request.rb +270 -0
  88. data/lib/crisphive/models/skill_category_create_response.rb +215 -0
  89. data/lib/crisphive/models/skill_create_request.rb +270 -0
  90. data/lib/crisphive/models/skill_create_response.rb +215 -0
  91. data/lib/crisphive/models/skill_update_request.rb +281 -0
  92. data/lib/crisphive/models/technician.rb +64 -2
  93. data/lib/crisphive/models/technician_create_request.rb +14 -11
  94. data/lib/crisphive/models/technician_time_off.rb +334 -0
  95. data/lib/crisphive/models/technician_time_off_create_request.rb +285 -0
  96. data/lib/crisphive/models/technician_time_off_create_response.rb +215 -0
  97. data/lib/crisphive/models/technician_time_off_list.rb +246 -0
  98. data/lib/crisphive/models/technician_update_request.rb +2 -2
  99. data/lib/crisphive/models/vehicle_create_request.rb +420 -0
  100. data/lib/crisphive/models/vehicle_create_response.rb +215 -0
  101. data/lib/crisphive/models/vehicle_update_request.rb +440 -0
  102. data/lib/crisphive/models/webhook_create_request.rb +320 -0
  103. data/lib/crisphive/models/webhook_create_response.rb +391 -0
  104. data/lib/crisphive/models/webhook_verification.rb +235 -0
  105. data/lib/crisphive/version.rb +1 -1
  106. data/lib/crisphive.rb +66 -0
  107. metadata +68 -2
@@ -0,0 +1,440 @@
1
+ =begin
2
+ #Crisphive Developer API
3
+
4
+ #Public REST API for integrating Crisphive from your own backend. Authenticate every request with a secret API key as a Bearer token (`Authorization: Bearer chsk_live_…`). The key prefix selects the data environment: `chsk_live_…` → production (live), `chsk_test_…` → sandbox (isolated test). **Key scopes (restricted keys).** A key is either *full-access* (can call every endpoint below) or *restricted* to a set of permission codes chosen at creation — the same codes as the dashboard permission grid (e.g. `customers_view`, `job_create`, `team_manage`). A restricted key calling an endpoint outside its scope gets `403`. The full code list is the permission catalog (`GET /permission/modules` on the dashboard API). Create, scope, and revoke keys from the business dashboard. Every response is wrapped in the envelope `{ \"error_code\": 0, \"message\": \"Success\", \"data\": <payload> }`.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Crisphive
17
+ class VehicleUpdateRequest
18
+ # nil = keep; \"\" clears the field.
19
+ attr_accessor :brand
20
+
21
+ attr_accessor :current_mileage
22
+
23
+ attr_accessor :model
24
+
25
+ # nil = keep. min=1 rejects an explicit \"\" (a vehicle needs a name); omitempty is what lets a nil pointer skip validation entirely.
26
+ attr_accessor :name
27
+
28
+ # nil = keep the current owner; \"\" clears it; a UUID sets it.
29
+ attr_accessor :owner_id
30
+
31
+ attr_accessor :plate_number
32
+
33
+ attr_accessor :status
34
+
35
+ # nil = keep; a non-nil value must be a known enum member.
36
+ attr_accessor :vehicle_type
37
+
38
+ attr_accessor :year
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'brand' => :'brand',
66
+ :'current_mileage' => :'current_mileage',
67
+ :'model' => :'model',
68
+ :'name' => :'name',
69
+ :'owner_id' => :'owner_id',
70
+ :'plate_number' => :'plate_number',
71
+ :'status' => :'status',
72
+ :'vehicle_type' => :'vehicle_type',
73
+ :'year' => :'year'
74
+ }
75
+ end
76
+
77
+ # Returns all the JSON keys this model knows about
78
+ def self.acceptable_attributes
79
+ attribute_map.values
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'brand' => :'String',
86
+ :'current_mileage' => :'Integer',
87
+ :'model' => :'String',
88
+ :'name' => :'String',
89
+ :'owner_id' => :'String',
90
+ :'plate_number' => :'String',
91
+ :'status' => :'String',
92
+ :'vehicle_type' => :'String',
93
+ :'year' => :'Integer'
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 `Crisphive::VehicleUpdateRequest` 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 `Crisphive::VehicleUpdateRequest`. 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?(:'brand')
119
+ self.brand = attributes[:'brand']
120
+ end
121
+
122
+ if attributes.key?(:'current_mileage')
123
+ self.current_mileage = attributes[:'current_mileage']
124
+ end
125
+
126
+ if attributes.key?(:'model')
127
+ self.model = attributes[:'model']
128
+ end
129
+
130
+ if attributes.key?(:'name')
131
+ self.name = attributes[:'name']
132
+ end
133
+
134
+ if attributes.key?(:'owner_id')
135
+ self.owner_id = attributes[:'owner_id']
136
+ end
137
+
138
+ if attributes.key?(:'plate_number')
139
+ self.plate_number = attributes[:'plate_number']
140
+ end
141
+
142
+ if attributes.key?(:'status')
143
+ self.status = attributes[:'status']
144
+ end
145
+
146
+ if attributes.key?(:'vehicle_type')
147
+ self.vehicle_type = attributes[:'vehicle_type']
148
+ end
149
+
150
+ if attributes.key?(:'year')
151
+ self.year = attributes[:'year']
152
+ end
153
+ end
154
+
155
+ # Show invalid properties with the reasons. Usually used together with valid?
156
+ # @return Array for valid properties with the reasons
157
+ def list_invalid_properties
158
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
159
+ invalid_properties = Array.new
160
+ if !@brand.nil? && @brand.to_s.length > 50
161
+ invalid_properties.push('invalid value for "brand", the character length must be smaller than or equal to 50.')
162
+ end
163
+
164
+ if !@current_mileage.nil? && @current_mileage < 0
165
+ invalid_properties.push('invalid value for "current_mileage", must be greater than or equal to 0.')
166
+ end
167
+
168
+ if !@model.nil? && @model.to_s.length > 50
169
+ invalid_properties.push('invalid value for "model", the character length must be smaller than or equal to 50.')
170
+ end
171
+
172
+ if !@name.nil? && @name.to_s.length > 100
173
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
174
+ end
175
+
176
+ if !@name.nil? && @name.to_s.length < 1
177
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
178
+ end
179
+
180
+ if !@plate_number.nil? && @plate_number.to_s.length > 20
181
+ invalid_properties.push('invalid value for "plate_number", the character length must be smaller than or equal to 20.')
182
+ end
183
+
184
+ invalid_properties
185
+ end
186
+
187
+ # Check to see if the all the properties in the model are valid
188
+ # @return true if the model is valid
189
+ def valid?
190
+ warn '[DEPRECATED] the `valid?` method is obsolete'
191
+ return false if !@brand.nil? && @brand.to_s.length > 50
192
+ return false if !@current_mileage.nil? && @current_mileage < 0
193
+ return false if !@model.nil? && @model.to_s.length > 50
194
+ return false if !@name.nil? && @name.to_s.length > 100
195
+ return false if !@name.nil? && @name.to_s.length < 1
196
+ return false if !@plate_number.nil? && @plate_number.to_s.length > 20
197
+ status_validator = EnumAttributeValidator.new('String', ["inactive", "idle", "on_job", "maintenance"])
198
+ return false unless status_validator.valid?(@status)
199
+ vehicle_type_validator = EnumAttributeValidator.new('String', ["van", "truck", "car"])
200
+ return false unless vehicle_type_validator.valid?(@vehicle_type)
201
+ true
202
+ end
203
+
204
+ # Custom attribute writer method with validation
205
+ # @param [Object] brand Value to be assigned
206
+ def brand=(brand)
207
+ if brand.nil?
208
+ fail ArgumentError, 'brand cannot be nil'
209
+ end
210
+
211
+ if brand.to_s.length > 50
212
+ fail ArgumentError, 'invalid value for "brand", the character length must be smaller than or equal to 50.'
213
+ end
214
+
215
+ @brand = brand
216
+ end
217
+
218
+ # Custom attribute writer method with validation
219
+ # @param [Object] current_mileage Value to be assigned
220
+ def current_mileage=(current_mileage)
221
+ if current_mileage.nil?
222
+ fail ArgumentError, 'current_mileage cannot be nil'
223
+ end
224
+
225
+ if current_mileage < 0
226
+ fail ArgumentError, 'invalid value for "current_mileage", must be greater than or equal to 0.'
227
+ end
228
+
229
+ @current_mileage = current_mileage
230
+ end
231
+
232
+ # Custom attribute writer method with validation
233
+ # @param [Object] model Value to be assigned
234
+ def model=(model)
235
+ if model.nil?
236
+ fail ArgumentError, 'model cannot be nil'
237
+ end
238
+
239
+ if model.to_s.length > 50
240
+ fail ArgumentError, 'invalid value for "model", the character length must be smaller than or equal to 50.'
241
+ end
242
+
243
+ @model = model
244
+ end
245
+
246
+ # Custom attribute writer method with validation
247
+ # @param [Object] name Value to be assigned
248
+ def name=(name)
249
+ if name.nil?
250
+ fail ArgumentError, 'name cannot be nil'
251
+ end
252
+
253
+ if name.to_s.length > 100
254
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.'
255
+ end
256
+
257
+ if name.to_s.length < 1
258
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
259
+ end
260
+
261
+ @name = name
262
+ end
263
+
264
+ # Custom attribute writer method with validation
265
+ # @param [Object] plate_number Value to be assigned
266
+ def plate_number=(plate_number)
267
+ if plate_number.nil?
268
+ fail ArgumentError, 'plate_number cannot be nil'
269
+ end
270
+
271
+ if plate_number.to_s.length > 20
272
+ fail ArgumentError, 'invalid value for "plate_number", the character length must be smaller than or equal to 20.'
273
+ end
274
+
275
+ @plate_number = plate_number
276
+ end
277
+
278
+ # Custom attribute writer method checking allowed values (enum).
279
+ # @param [Object] status Object to be assigned
280
+ def status=(status)
281
+ validator = EnumAttributeValidator.new('String', ["inactive", "idle", "on_job", "maintenance"])
282
+ unless validator.valid?(status)
283
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
284
+ end
285
+ @status = status
286
+ end
287
+
288
+ # Custom attribute writer method checking allowed values (enum).
289
+ # @param [Object] vehicle_type Object to be assigned
290
+ def vehicle_type=(vehicle_type)
291
+ validator = EnumAttributeValidator.new('String', ["van", "truck", "car"])
292
+ unless validator.valid?(vehicle_type)
293
+ fail ArgumentError, "invalid value for \"vehicle_type\", must be one of #{validator.allowable_values}."
294
+ end
295
+ @vehicle_type = vehicle_type
296
+ end
297
+
298
+ # Checks equality by comparing each attribute.
299
+ # @param [Object] Object to be compared
300
+ def ==(o)
301
+ return true if self.equal?(o)
302
+ self.class == o.class &&
303
+ brand == o.brand &&
304
+ current_mileage == o.current_mileage &&
305
+ model == o.model &&
306
+ name == o.name &&
307
+ owner_id == o.owner_id &&
308
+ plate_number == o.plate_number &&
309
+ status == o.status &&
310
+ vehicle_type == o.vehicle_type &&
311
+ year == o.year
312
+ end
313
+
314
+ # @see the `==` method
315
+ # @param [Object] Object to be compared
316
+ def eql?(o)
317
+ self == o
318
+ end
319
+
320
+ # Calculates hash code according to all attributes.
321
+ # @return [Integer] Hash code
322
+ def hash
323
+ [brand, current_mileage, model, name, owner_id, plate_number, status, vehicle_type, year].hash
324
+ end
325
+
326
+ # Builds the object from hash
327
+ # @param [Hash] attributes Model attributes in the form of hash
328
+ # @return [Object] Returns the model itself
329
+ def self.build_from_hash(attributes)
330
+ return nil unless attributes.is_a?(Hash)
331
+ attributes = attributes.transform_keys(&:to_sym)
332
+ transformed_hash = {}
333
+ openapi_types.each_pair do |key, type|
334
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
335
+ transformed_hash["#{key}"] = nil
336
+ elsif type =~ /\AArray<(.*)>/i
337
+ # check to ensure the input is an array given that the attribute
338
+ # is documented as an array but the input is not
339
+ if attributes[attribute_map[key]].is_a?(Array)
340
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
341
+ end
342
+ elsif !attributes[attribute_map[key]].nil?
343
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
344
+ end
345
+ end
346
+ new(transformed_hash)
347
+ end
348
+
349
+ # Deserializes the data based on type
350
+ # @param string type Data type
351
+ # @param string value Value to be deserialized
352
+ # @return [Object] Deserialized data
353
+ def self._deserialize(type, value)
354
+ case type.to_sym
355
+ when :Time
356
+ Time.parse(value)
357
+ when :Date
358
+ Date.parse(value)
359
+ when :String
360
+ value.to_s
361
+ when :Integer
362
+ value.to_i
363
+ when :Float
364
+ value.to_f
365
+ when :Boolean
366
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
367
+ true
368
+ else
369
+ false
370
+ end
371
+ when :Object
372
+ # generic object (usually a Hash), return directly
373
+ value
374
+ when /\AArray<(?<inner_type>.+)>\z/
375
+ inner_type = Regexp.last_match[:inner_type]
376
+ value.map { |v| _deserialize(inner_type, v) }
377
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
378
+ k_type = Regexp.last_match[:k_type]
379
+ v_type = Regexp.last_match[:v_type]
380
+ {}.tap do |hash|
381
+ value.each do |k, v|
382
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
383
+ end
384
+ end
385
+ else # model
386
+ # models (e.g. Pet) or oneOf
387
+ klass = Crisphive.const_get(type)
388
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
389
+ end
390
+ end
391
+
392
+ # Returns the string representation of the object
393
+ # @return [String] String presentation of the object
394
+ def to_s
395
+ to_hash.to_s
396
+ end
397
+
398
+ # to_body is an alias to to_hash (backward compatibility)
399
+ # @return [Hash] Returns the object in the form of hash
400
+ def to_body
401
+ to_hash
402
+ end
403
+
404
+ # Returns the object in the form of hash
405
+ # @return [Hash] Returns the object in the form of hash
406
+ def to_hash
407
+ hash = {}
408
+ self.class.attribute_map.each_pair do |attr, param|
409
+ value = self.send(attr)
410
+ if value.nil?
411
+ is_nullable = self.class.openapi_nullable.include?(attr)
412
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
413
+ end
414
+
415
+ hash[param] = _to_hash(value)
416
+ end
417
+ hash
418
+ end
419
+
420
+ # Outputs non-array value in the form of hash
421
+ # For object, use to_hash. Otherwise, just return the value
422
+ # @param [Object] value Any valid value
423
+ # @return [Hash] Returns the value in the form of hash
424
+ def _to_hash(value)
425
+ if value.is_a?(Array)
426
+ value.compact.map { |v| _to_hash(v) }
427
+ elsif value.is_a?(Hash)
428
+ {}.tap do |hash|
429
+ value.each { |k, v| hash[k] = _to_hash(v) }
430
+ end
431
+ elsif value.respond_to? :to_hash
432
+ value.to_hash
433
+ else
434
+ value
435
+ end
436
+ end
437
+
438
+ end
439
+
440
+ end