ultracart_api 4.0.141 → 4.0.143

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +39 -4
  3. data/docs/DatawarehouseApi.md +651 -0
  4. data/docs/Report.md +36 -0
  5. data/docs/ReportAuth.md +24 -0
  6. data/docs/ReportAuthResponse.md +26 -0
  7. data/docs/ReportDataSet.md +46 -0
  8. data/docs/ReportDataSetColumn.md +18 -0
  9. data/docs/ReportDataSetPage.md +36 -0
  10. data/docs/ReportDataSetPageResponse.md +26 -0
  11. data/docs/ReportDataSetQuery.md +40 -0
  12. data/docs/ReportDataSetResponse.md +26 -0
  13. data/docs/ReportDataSetRow.md +18 -0
  14. data/docs/ReportDataSetSchema.md +20 -0
  15. data/docs/ReportDataSetSummary.md +30 -0
  16. data/docs/ReportDataSource.md +28 -0
  17. data/docs/ReportDataSourceSchema.md +22 -0
  18. data/docs/ReportExecuteQueriesRequest.md +30 -0
  19. data/docs/ReportFilter.md +28 -0
  20. data/docs/ReportFilterConnection.md +20 -0
  21. data/docs/ReportPage.md +24 -0
  22. data/docs/ReportPageVisualization.md +34 -0
  23. data/docs/ReportPageVisualizationDimension.md +30 -0
  24. data/docs/ReportPageVisualizationMetric.md +24 -0
  25. data/docs/ReportResponse.md +26 -0
  26. data/docs/ReportWebsocketEvent.md +20 -0
  27. data/docs/ReportsResponse.md +26 -0
  28. data/lib/ultracart_api/api/datawarehouse_api.rb +626 -0
  29. data/lib/ultracart_api/models/report.rb +342 -0
  30. data/lib/ultracart_api/models/report_auth.rb +247 -0
  31. data/lib/ultracart_api/models/report_auth_response.rb +256 -0
  32. data/lib/ultracart_api/models/report_data_set.rb +397 -0
  33. data/lib/ultracart_api/models/report_data_set_column.rb +219 -0
  34. data/lib/ultracart_api/models/report_data_set_page.rb +308 -0
  35. data/lib/ultracart_api/models/report_data_set_page_response.rb +256 -0
  36. data/lib/ultracart_api/models/report_data_set_query.rb +365 -0
  37. data/lib/ultracart_api/models/report_data_set_response.rb +256 -0
  38. data/lib/ultracart_api/models/report_data_set_row.rb +221 -0
  39. data/lib/ultracart_api/models/report_data_set_schema.rb +263 -0
  40. data/lib/ultracart_api/models/report_data_set_summary.rb +316 -0
  41. data/lib/ultracart_api/models/report_data_source.rb +267 -0
  42. data/lib/ultracart_api/models/report_data_source_schema.rb +273 -0
  43. data/lib/ultracart_api/models/report_execute_queries_request.rb +313 -0
  44. data/lib/ultracart_api/models/report_filter.rb +307 -0
  45. data/lib/ultracart_api/models/report_filter_connection.rb +228 -0
  46. data/lib/ultracart_api/models/report_page.rb +251 -0
  47. data/lib/ultracart_api/models/report_page_visualization.rb +334 -0
  48. data/lib/ultracart_api/models/report_page_visualization_dimension.rb +279 -0
  49. data/lib/ultracart_api/models/report_page_visualization_metric.rb +283 -0
  50. data/lib/ultracart_api/models/report_response.rb +256 -0
  51. data/lib/ultracart_api/models/report_websocket_event.rb +263 -0
  52. data/lib/ultracart_api/models/reports_response.rb +258 -0
  53. data/lib/ultracart_api/version.rb +1 -1
  54. data/lib/ultracart_api.rb +25 -0
  55. metadata +51 -1
@@ -0,0 +1,334 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class ReportPageVisualization
18
+ # A JSON representation of the configuration for this visualization
19
+ attr_accessor :config
20
+
21
+ attr_accessor :data_source_name
22
+
23
+ attr_accessor :dimensions
24
+
25
+ attr_accessor :metrics
26
+
27
+ attr_accessor :name
28
+
29
+ # True if the visualization should show a comparison based upon the date range
30
+ attr_accessor :show_comparison
31
+
32
+ # A JSON representation of the style configuration for this visualization
33
+ attr_accessor :styles
34
+
35
+ # Type of visualization
36
+ attr_accessor :type
37
+
38
+ # A UUID for the visualization
39
+ attr_accessor :visualization_uuid
40
+
41
+ class EnumAttributeValidator
42
+ attr_reader :datatype
43
+ attr_reader :allowable_values
44
+
45
+ def initialize(datatype, allowable_values)
46
+ @allowable_values = allowable_values.map do |value|
47
+ case datatype.to_s
48
+ when /Integer/i
49
+ value.to_i
50
+ when /Float/i
51
+ value.to_f
52
+ else
53
+ value
54
+ end
55
+ end
56
+ end
57
+
58
+ def valid?(value)
59
+ !value || allowable_values.include?(value)
60
+ end
61
+ end
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'config' => :'config',
67
+ :'data_source_name' => :'data_source_name',
68
+ :'dimensions' => :'dimensions',
69
+ :'metrics' => :'metrics',
70
+ :'name' => :'name',
71
+ :'show_comparison' => :'show_comparison',
72
+ :'styles' => :'styles',
73
+ :'type' => :'type',
74
+ :'visualization_uuid' => :'visualization_uuid'
75
+ }
76
+ end
77
+
78
+ # Returns all the JSON keys this model knows about
79
+ def self.acceptable_attributes
80
+ attribute_map.values
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.openapi_types
85
+ {
86
+ :'config' => :'String',
87
+ :'data_source_name' => :'String',
88
+ :'dimensions' => :'Array<ReportPageVisualizationDimension>',
89
+ :'metrics' => :'Array<ReportPageVisualizationMetric>',
90
+ :'name' => :'String',
91
+ :'show_comparison' => :'Boolean',
92
+ :'styles' => :'String',
93
+ :'type' => :'String',
94
+ :'visualization_uuid' => :'String'
95
+ }
96
+ end
97
+
98
+ # List of attributes with nullable: true
99
+ def self.openapi_nullable
100
+ Set.new([
101
+ ])
102
+ end
103
+
104
+ # Initializes the object
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ def initialize(attributes = {})
107
+ if (!attributes.is_a?(Hash))
108
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ReportPageVisualization` initialize method"
109
+ end
110
+
111
+ # check to see if the attribute exists and convert string to symbol for hash key
112
+ attributes = attributes.each_with_object({}) { |(k, v), h|
113
+ if (!self.class.attribute_map.key?(k.to_sym))
114
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ReportPageVisualization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
115
+ end
116
+ h[k.to_sym] = v
117
+ }
118
+
119
+ if attributes.key?(:'config')
120
+ self.config = attributes[:'config']
121
+ end
122
+
123
+ if attributes.key?(:'data_source_name')
124
+ self.data_source_name = attributes[:'data_source_name']
125
+ end
126
+
127
+ if attributes.key?(:'dimensions')
128
+ if (value = attributes[:'dimensions']).is_a?(Array)
129
+ self.dimensions = value
130
+ end
131
+ end
132
+
133
+ if attributes.key?(:'metrics')
134
+ if (value = attributes[:'metrics']).is_a?(Array)
135
+ self.metrics = value
136
+ end
137
+ end
138
+
139
+ if attributes.key?(:'name')
140
+ self.name = attributes[:'name']
141
+ end
142
+
143
+ if attributes.key?(:'show_comparison')
144
+ self.show_comparison = attributes[:'show_comparison']
145
+ end
146
+
147
+ if attributes.key?(:'styles')
148
+ self.styles = attributes[:'styles']
149
+ end
150
+
151
+ if attributes.key?(:'type')
152
+ self.type = attributes[:'type']
153
+ end
154
+
155
+ if attributes.key?(:'visualization_uuid')
156
+ self.visualization_uuid = attributes[:'visualization_uuid']
157
+ end
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properties with the reasons
162
+ def list_invalid_properties
163
+ invalid_properties = Array.new
164
+ invalid_properties
165
+ end
166
+
167
+ # Check to see if the all the properties in the model are valid
168
+ # @return true if the model is valid
169
+ def valid?
170
+ type_validator = EnumAttributeValidator.new('String', ["score card", "line chart", "bar chart", "text", "table"])
171
+ return false unless type_validator.valid?(@type)
172
+ true
173
+ end
174
+
175
+ # Custom attribute writer method checking allowed values (enum).
176
+ # @param [Object] type Object to be assigned
177
+ def type=(type)
178
+ validator = EnumAttributeValidator.new('String', ["score card", "line chart", "bar chart", "text", "table"])
179
+ unless validator.valid?(type)
180
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
181
+ end
182
+ @type = type
183
+ end
184
+
185
+ # Checks equality by comparing each attribute.
186
+ # @param [Object] Object to be compared
187
+ def ==(o)
188
+ return true if self.equal?(o)
189
+ self.class == o.class &&
190
+ config == o.config &&
191
+ data_source_name == o.data_source_name &&
192
+ dimensions == o.dimensions &&
193
+ metrics == o.metrics &&
194
+ name == o.name &&
195
+ show_comparison == o.show_comparison &&
196
+ styles == o.styles &&
197
+ type == o.type &&
198
+ visualization_uuid == o.visualization_uuid
199
+ end
200
+
201
+ # @see the `==` method
202
+ # @param [Object] Object to be compared
203
+ def eql?(o)
204
+ self == o
205
+ end
206
+
207
+ # Calculates hash code according to all attributes.
208
+ # @return [Integer] Hash code
209
+ def hash
210
+ [config, data_source_name, dimensions, metrics, name, show_comparison, styles, type, visualization_uuid].hash
211
+ end
212
+
213
+ # Builds the object from hash
214
+ # @param [Hash] attributes Model attributes in the form of hash
215
+ # @return [Object] Returns the model itself
216
+ def self.build_from_hash(attributes)
217
+ new.build_from_hash(attributes)
218
+ end
219
+
220
+ # Builds the object from hash
221
+ # @param [Hash] attributes Model attributes in the form of hash
222
+ # @return [Object] Returns the model itself
223
+ def build_from_hash(attributes)
224
+ return nil unless attributes.is_a?(Hash)
225
+ attributes = attributes.transform_keys(&:to_sym)
226
+ self.class.openapi_types.each_pair do |key, type|
227
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
228
+ self.send("#{key}=", nil)
229
+ elsif type =~ /\AArray<(.*)>/i
230
+ # check to ensure the input is an array given that the attribute
231
+ # is documented as an array but the input is not
232
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
233
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
234
+ end
235
+ elsif !attributes[self.class.attribute_map[key]].nil?
236
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
237
+ end
238
+ end
239
+
240
+ self
241
+ end
242
+
243
+ # Deserializes the data based on type
244
+ # @param string type Data type
245
+ # @param string value Value to be deserialized
246
+ # @return [Object] Deserialized data
247
+ def _deserialize(type, value)
248
+ case type.to_sym
249
+ when :Time
250
+ Time.parse(value)
251
+ when :Date
252
+ Date.parse(value)
253
+ when :String
254
+ value.to_s
255
+ when :Integer
256
+ value.to_i
257
+ when :Float
258
+ value.to_f
259
+ when :Boolean
260
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
261
+ true
262
+ else
263
+ false
264
+ end
265
+ when :Object
266
+ # generic object (usually a Hash), return directly
267
+ value
268
+ when /\AArray<(?<inner_type>.+)>\z/
269
+ inner_type = Regexp.last_match[:inner_type]
270
+ value.map { |v| _deserialize(inner_type, v) }
271
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
272
+ k_type = Regexp.last_match[:k_type]
273
+ v_type = Regexp.last_match[:v_type]
274
+ {}.tap do |hash|
275
+ value.each do |k, v|
276
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
277
+ end
278
+ end
279
+ else # model
280
+ # models (e.g. Pet) or oneOf
281
+ klass = UltracartClient.const_get(type)
282
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
283
+ end
284
+ end
285
+
286
+ # Returns the string representation of the object
287
+ # @return [String] String presentation of the object
288
+ def to_s
289
+ to_hash.to_s
290
+ end
291
+
292
+ # to_body is an alias to to_hash (backward compatibility)
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_body
295
+ to_hash
296
+ end
297
+
298
+ # Returns the object in the form of hash
299
+ # @return [Hash] Returns the object in the form of hash
300
+ def to_hash
301
+ hash = {}
302
+ self.class.attribute_map.each_pair do |attr, param|
303
+ value = self.send(attr)
304
+ if value.nil?
305
+ is_nullable = self.class.openapi_nullable.include?(attr)
306
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
307
+ end
308
+
309
+ hash[param] = _to_hash(value)
310
+ end
311
+ hash
312
+ end
313
+
314
+ # Outputs non-array value in the form of hash
315
+ # For object, use to_hash. Otherwise, just return the value
316
+ # @param [Object] value Any valid value
317
+ # @return [Hash] Returns the value in the form of hash
318
+ def _to_hash(value)
319
+ if value.is_a?(Array)
320
+ value.compact.map { |v| _to_hash(v) }
321
+ elsif value.is_a?(Hash)
322
+ {}.tap do |hash|
323
+ value.each { |k, v| hash[k] = _to_hash(v) }
324
+ end
325
+ elsif value.respond_to? :to_hash
326
+ value.to_hash
327
+ else
328
+ value
329
+ end
330
+ end
331
+
332
+ end
333
+
334
+ end
@@ -0,0 +1,279 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class ReportPageVisualizationDimension
18
+ # Return the column as a different name
19
+ attr_accessor :as
20
+
21
+ # Cast the column to a different data type such as DATETIME -> DATE
22
+ attr_accessor :cast
23
+
24
+ attr_accessor :column
25
+
26
+ # The timezone to shift the date to
27
+ attr_accessor :datetime_timezone
28
+
29
+ # The type of truncation to perform on the date, DAY, WEEK(MONDAY), etc.
30
+ attr_accessor :datetime_trunc
31
+
32
+ # Part of a datetime to extract
33
+ attr_accessor :extract
34
+
35
+ # The function to perform around the column such as DATE_TRUNC(@column, day)
36
+ attr_accessor :function
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'as' => :'as',
42
+ :'cast' => :'cast',
43
+ :'column' => :'column',
44
+ :'datetime_timezone' => :'datetime_timezone',
45
+ :'datetime_trunc' => :'datetime_trunc',
46
+ :'extract' => :'extract',
47
+ :'function' => :'function'
48
+ }
49
+ end
50
+
51
+ # Returns all the JSON keys this model knows about
52
+ def self.acceptable_attributes
53
+ attribute_map.values
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'as' => :'String',
60
+ :'cast' => :'String',
61
+ :'column' => :'String',
62
+ :'datetime_timezone' => :'String',
63
+ :'datetime_trunc' => :'String',
64
+ :'extract' => :'String',
65
+ :'function' => :'String'
66
+ }
67
+ end
68
+
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ReportPageVisualizationDimension` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ReportPageVisualizationDimension`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'as')
91
+ self.as = attributes[:'as']
92
+ end
93
+
94
+ if attributes.key?(:'cast')
95
+ self.cast = attributes[:'cast']
96
+ end
97
+
98
+ if attributes.key?(:'column')
99
+ self.column = attributes[:'column']
100
+ end
101
+
102
+ if attributes.key?(:'datetime_timezone')
103
+ self.datetime_timezone = attributes[:'datetime_timezone']
104
+ end
105
+
106
+ if attributes.key?(:'datetime_trunc')
107
+ self.datetime_trunc = attributes[:'datetime_trunc']
108
+ end
109
+
110
+ if attributes.key?(:'extract')
111
+ self.extract = attributes[:'extract']
112
+ end
113
+
114
+ if attributes.key?(:'function')
115
+ self.function = attributes[:'function']
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ invalid_properties = Array.new
123
+ invalid_properties
124
+ end
125
+
126
+ # Check to see if the all the properties in the model are valid
127
+ # @return true if the model is valid
128
+ def valid?
129
+ true
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
+ as == o.as &&
138
+ cast == o.cast &&
139
+ column == o.column &&
140
+ datetime_timezone == o.datetime_timezone &&
141
+ datetime_trunc == o.datetime_trunc &&
142
+ extract == o.extract &&
143
+ function == o.function
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(o)
149
+ self == o
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Integer] Hash code
154
+ def hash
155
+ [as, cast, column, datetime_timezone, datetime_trunc, extract, function].hash
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def self.build_from_hash(attributes)
162
+ new.build_from_hash(attributes)
163
+ end
164
+
165
+ # Builds the object from hash
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ # @return [Object] Returns the model itself
168
+ def build_from_hash(attributes)
169
+ return nil unless attributes.is_a?(Hash)
170
+ attributes = attributes.transform_keys(&:to_sym)
171
+ self.class.openapi_types.each_pair do |key, type|
172
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
173
+ self.send("#{key}=", nil)
174
+ elsif type =~ /\AArray<(.*)>/i
175
+ # check to ensure the input is an array given that the attribute
176
+ # is documented as an array but the input is not
177
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
178
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
179
+ end
180
+ elsif !attributes[self.class.attribute_map[key]].nil?
181
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
182
+ end
183
+ end
184
+
185
+ self
186
+ end
187
+
188
+ # Deserializes the data based on type
189
+ # @param string type Data type
190
+ # @param string value Value to be deserialized
191
+ # @return [Object] Deserialized data
192
+ def _deserialize(type, value)
193
+ case type.to_sym
194
+ when :Time
195
+ Time.parse(value)
196
+ when :Date
197
+ Date.parse(value)
198
+ when :String
199
+ value.to_s
200
+ when :Integer
201
+ value.to_i
202
+ when :Float
203
+ value.to_f
204
+ when :Boolean
205
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
206
+ true
207
+ else
208
+ false
209
+ end
210
+ when :Object
211
+ # generic object (usually a Hash), return directly
212
+ value
213
+ when /\AArray<(?<inner_type>.+)>\z/
214
+ inner_type = Regexp.last_match[:inner_type]
215
+ value.map { |v| _deserialize(inner_type, v) }
216
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
217
+ k_type = Regexp.last_match[:k_type]
218
+ v_type = Regexp.last_match[:v_type]
219
+ {}.tap do |hash|
220
+ value.each do |k, v|
221
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
222
+ end
223
+ end
224
+ else # model
225
+ # models (e.g. Pet) or oneOf
226
+ klass = UltracartClient.const_get(type)
227
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
228
+ end
229
+ end
230
+
231
+ # Returns the string representation of the object
232
+ # @return [String] String presentation of the object
233
+ def to_s
234
+ to_hash.to_s
235
+ end
236
+
237
+ # to_body is an alias to to_hash (backward compatibility)
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_body
240
+ to_hash
241
+ end
242
+
243
+ # Returns the object in the form of hash
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_hash
246
+ hash = {}
247
+ self.class.attribute_map.each_pair do |attr, param|
248
+ value = self.send(attr)
249
+ if value.nil?
250
+ is_nullable = self.class.openapi_nullable.include?(attr)
251
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
252
+ end
253
+
254
+ hash[param] = _to_hash(value)
255
+ end
256
+ hash
257
+ end
258
+
259
+ # Outputs non-array value in the form of hash
260
+ # For object, use to_hash. Otherwise, just return the value
261
+ # @param [Object] value Any valid value
262
+ # @return [Hash] Returns the value in the form of hash
263
+ def _to_hash(value)
264
+ if value.is_a?(Array)
265
+ value.compact.map { |v| _to_hash(v) }
266
+ elsif value.is_a?(Hash)
267
+ {}.tap do |hash|
268
+ value.each { |k, v| hash[k] = _to_hash(v) }
269
+ end
270
+ elsif value.respond_to? :to_hash
271
+ value.to_hash
272
+ else
273
+ value
274
+ end
275
+ end
276
+
277
+ end
278
+
279
+ end