hubspot-api-client 16.0.4 → 16.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile.lock +1 -1
  4. data/lib/hubspot/codegen/crm/objects/postal_mail/api/associations_api.rb +264 -0
  5. data/lib/hubspot/codegen/crm/objects/postal_mail/api/basic_api.rb +391 -0
  6. data/lib/hubspot/codegen/crm/objects/postal_mail/api/batch_api.rb +295 -0
  7. data/lib/hubspot/codegen/crm/objects/postal_mail/api/public_object_api.rb +94 -0
  8. data/lib/hubspot/codegen/crm/objects/postal_mail/api/search_api.rb +92 -0
  9. data/lib/hubspot/codegen/crm/objects/postal_mail/api_client.rb +412 -0
  10. data/lib/hubspot/codegen/crm/objects/postal_mail/api_error.rb +63 -0
  11. data/lib/hubspot/codegen/crm/objects/postal_mail/configuration.rb +296 -0
  12. data/lib/hubspot/codegen/crm/objects/postal_mail/models/associated_id.rb +244 -0
  13. data/lib/hubspot/codegen/crm/objects/postal_mail/models/association_spec.rb +278 -0
  14. data/lib/hubspot/codegen/crm/objects/postal_mail/models/association_spec_with_label.rb +287 -0
  15. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_input_simple_public_object_batch_input.rb +232 -0
  16. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_input_simple_public_object_id.rb +232 -0
  17. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_input_simple_public_object_input.rb +232 -0
  18. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_read_input_simple_public_object_id.rb +273 -0
  19. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_response_simple_public_object.rb +328 -0
  20. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_response_simple_public_object_with_errors.rb +348 -0
  21. data/lib/hubspot/codegen/crm/objects/postal_mail/models/collection_response_associated_id.rb +241 -0
  22. data/lib/hubspot/codegen/crm/objects/postal_mail/models/collection_response_multi_associated_object_with_label_forward_paging.rb +241 -0
  23. data/lib/hubspot/codegen/crm/objects/postal_mail/models/collection_response_simple_public_object_with_associations_forward_paging.rb +241 -0
  24. data/lib/hubspot/codegen/crm/objects/postal_mail/models/collection_response_with_total_simple_public_object_forward_paging.rb +255 -0
  25. data/lib/hubspot/codegen/crm/objects/postal_mail/models/error.rb +307 -0
  26. data/lib/hubspot/codegen/crm/objects/postal_mail/models/error_category.rb +278 -0
  27. data/lib/hubspot/codegen/crm/objects/postal_mail/models/error_detail.rb +273 -0
  28. data/lib/hubspot/codegen/crm/objects/postal_mail/models/filter.rb +299 -0
  29. data/lib/hubspot/codegen/crm/objects/postal_mail/models/filter_group.rb +232 -0
  30. data/lib/hubspot/codegen/crm/objects/postal_mail/models/forward_paging.rb +225 -0
  31. data/lib/hubspot/codegen/crm/objects/postal_mail/models/labels_between_object_pair.rb +288 -0
  32. data/lib/hubspot/codegen/crm/objects/postal_mail/models/multi_associated_object_with_label.rb +246 -0
  33. data/lib/hubspot/codegen/crm/objects/postal_mail/models/next_page.rb +239 -0
  34. data/lib/hubspot/codegen/crm/objects/postal_mail/models/paging.rb +234 -0
  35. data/lib/hubspot/codegen/crm/objects/postal_mail/models/previous_page.rb +239 -0
  36. data/lib/hubspot/codegen/crm/objects/postal_mail/models/public_merge_input.rb +244 -0
  37. data/lib/hubspot/codegen/crm/objects/postal_mail/models/public_object_search_request.rb +301 -0
  38. data/lib/hubspot/codegen/crm/objects/postal_mail/models/simple_public_object.rb +303 -0
  39. data/lib/hubspot/codegen/crm/objects/postal_mail/models/simple_public_object_batch_input.rb +246 -0
  40. data/lib/hubspot/codegen/crm/objects/postal_mail/models/simple_public_object_id.rb +230 -0
  41. data/lib/hubspot/codegen/crm/objects/postal_mail/models/simple_public_object_input.rb +232 -0
  42. data/lib/hubspot/codegen/crm/objects/postal_mail/models/simple_public_object_with_associations.rb +314 -0
  43. data/lib/hubspot/codegen/crm/objects/postal_mail/models/standard_error.rb +324 -0
  44. data/lib/hubspot/codegen/crm/objects/postal_mail/models/value_with_timestamp.rb +285 -0
  45. data/lib/hubspot/codegen/marketing/events/models/property_value.rb +13 -4
  46. data/lib/hubspot/discovery/crm/objects/client.rb +1 -0
  47. data/lib/hubspot/discovery/crm/objects/postal_mail/api/associations_api.rb +15 -0
  48. data/lib/hubspot/discovery/crm/objects/postal_mail/api/basic_api.rb +15 -0
  49. data/lib/hubspot/discovery/crm/objects/postal_mail/api/batch_api.rb +15 -0
  50. data/lib/hubspot/discovery/crm/objects/postal_mail/api/public_object_api.rb +15 -0
  51. data/lib/hubspot/discovery/crm/objects/postal_mail/api/search_api.rb +15 -0
  52. data/lib/hubspot/discovery/crm/objects/postal_mail/client.rb +25 -0
  53. data/lib/hubspot/version.rb +1 -1
  54. data/spec/discovery/crm/objects/postal_mail/associations_api_spec.rb +9 -0
  55. data/spec/discovery/crm/objects/postal_mail/basic_api_spec.rb +10 -0
  56. data/spec/discovery/crm/objects/postal_mail/batch_api_spec.rb +10 -0
  57. data/spec/discovery/crm/objects/postal_mail/public_object_api_spec.rb +7 -0
  58. data/spec/discovery/crm/objects/postal_mail/search_api_spec.rb +7 -0
  59. metadata +59 -2
@@ -0,0 +1,303 @@
1
+ =begin
2
+ #Postal Mail
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Hubspot
17
+ module Crm
18
+ module Objects
19
+ module PostalMail
20
+ class SimplePublicObject
21
+ attr_accessor :id
22
+
23
+ attr_accessor :properties
24
+
25
+ attr_accessor :properties_with_history
26
+
27
+ attr_accessor :created_at
28
+
29
+ attr_accessor :updated_at
30
+
31
+ attr_accessor :archived
32
+
33
+ attr_accessor :archived_at
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'id' => :'id',
39
+ :'properties' => :'properties',
40
+ :'properties_with_history' => :'propertiesWithHistory',
41
+ :'created_at' => :'createdAt',
42
+ :'updated_at' => :'updatedAt',
43
+ :'archived' => :'archived',
44
+ :'archived_at' => :'archivedAt'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'id' => :'String',
57
+ :'properties' => :'Hash<String, String>',
58
+ :'properties_with_history' => :'Hash<String, Array<ValueWithTimestamp>>',
59
+ :'created_at' => :'Time',
60
+ :'updated_at' => :'Time',
61
+ :'archived' => :'Boolean',
62
+ :'archived_at' => :'Time'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Crm::Objects::PostalMail::SimplePublicObject` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!self.class.attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Crm::Objects::PostalMail::SimplePublicObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'id')
88
+ self.id = attributes[:'id']
89
+ end
90
+
91
+ if attributes.key?(:'properties')
92
+ if (value = attributes[:'properties']).is_a?(Hash)
93
+ self.properties = value
94
+ end
95
+ end
96
+
97
+ if attributes.key?(:'properties_with_history')
98
+ if (value = attributes[:'properties_with_history']).is_a?(Hash)
99
+ self.properties_with_history = value
100
+ end
101
+ end
102
+
103
+ if attributes.key?(:'created_at')
104
+ self.created_at = attributes[:'created_at']
105
+ end
106
+
107
+ if attributes.key?(:'updated_at')
108
+ self.updated_at = attributes[:'updated_at']
109
+ end
110
+
111
+ if attributes.key?(:'archived')
112
+ self.archived = attributes[:'archived']
113
+ end
114
+
115
+ if attributes.key?(:'archived_at')
116
+ self.archived_at = attributes[:'archived_at']
117
+ end
118
+ end
119
+
120
+ # Show invalid properties with the reasons. Usually used together with valid?
121
+ # @return Array for valid properties with the reasons
122
+ def list_invalid_properties
123
+ invalid_properties = Array.new
124
+ if @id.nil?
125
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
126
+ end
127
+
128
+ if @properties.nil?
129
+ invalid_properties.push('invalid value for "properties", properties cannot be nil.')
130
+ end
131
+
132
+ if @created_at.nil?
133
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
134
+ end
135
+
136
+ if @updated_at.nil?
137
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ return false if @id.nil?
147
+ return false if @properties.nil?
148
+ return false if @created_at.nil?
149
+ return false if @updated_at.nil?
150
+ true
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ id == o.id &&
159
+ properties == o.properties &&
160
+ properties_with_history == o.properties_with_history &&
161
+ created_at == o.created_at &&
162
+ updated_at == o.updated_at &&
163
+ archived == o.archived &&
164
+ archived_at == o.archived_at
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Integer] Hash code
175
+ def hash
176
+ [id, properties, properties_with_history, created_at, updated_at, archived, archived_at].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def self.build_from_hash(attributes)
183
+ new.build_from_hash(attributes)
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def build_from_hash(attributes)
190
+ return nil unless attributes.is_a?(Hash)
191
+ attributes = attributes.transform_keys(&:to_sym)
192
+ self.class.openapi_types.each_pair do |key, type|
193
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
194
+ self.send("#{key}=", nil)
195
+ elsif type =~ /\AArray<(.*)>/i
196
+ # check to ensure the input is an array given that the attribute
197
+ # is documented as an array but the input is not
198
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
199
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
200
+ end
201
+ elsif !attributes[self.class.attribute_map[key]].nil?
202
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
203
+ end
204
+ end
205
+
206
+ self
207
+ end
208
+
209
+ # Deserializes the data based on type
210
+ # @param string type Data type
211
+ # @param string value Value to be deserialized
212
+ # @return [Object] Deserialized data
213
+ def _deserialize(type, value)
214
+ case type.to_sym
215
+ when :Time
216
+ Time.parse(value)
217
+ when :Date
218
+ Date.parse(value)
219
+ when :String
220
+ value.to_s
221
+ when :Integer
222
+ value.to_i
223
+ when :Float
224
+ value.to_f
225
+ when :Boolean
226
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
227
+ true
228
+ else
229
+ false
230
+ end
231
+ when :Object
232
+ # generic object (usually a Hash), return directly
233
+ value
234
+ when /\AArray<(?<inner_type>.+)>\z/
235
+ inner_type = Regexp.last_match[:inner_type]
236
+ value.map { |v| _deserialize(inner_type, v) }
237
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
238
+ k_type = Regexp.last_match[:k_type]
239
+ v_type = Regexp.last_match[:v_type]
240
+ {}.tap do |hash|
241
+ value.each do |k, v|
242
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
243
+ end
244
+ end
245
+ else # model
246
+ # models (e.g. Pet) or oneOf
247
+ klass = Hubspot::Crm::Objects::PostalMail.const_get(type)
248
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
249
+ end
250
+ end
251
+
252
+ # Returns the string representation of the object
253
+ # @return [String] String presentation of the object
254
+ def to_s
255
+ to_hash.to_s
256
+ end
257
+
258
+ # to_body is an alias to to_hash (backward compatibility)
259
+ # @return [Hash] Returns the object in the form of hash
260
+ def to_body
261
+ to_hash
262
+ end
263
+
264
+ # Returns the object in the form of hash
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_hash
267
+ hash = {}
268
+ self.class.attribute_map.each_pair do |attr, param|
269
+ value = self.send(attr)
270
+ if value.nil?
271
+ is_nullable = self.class.openapi_nullable.include?(attr)
272
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
273
+ end
274
+
275
+ hash[param] = _to_hash(value)
276
+ end
277
+ hash
278
+ end
279
+
280
+ # Outputs non-array value in the form of hash
281
+ # For object, use to_hash. Otherwise, just return the value
282
+ # @param [Object] value Any valid value
283
+ # @return [Hash] Returns the value in the form of hash
284
+ def _to_hash(value)
285
+ if value.is_a?(Array)
286
+ value.compact.map { |v| _to_hash(v) }
287
+ elsif value.is_a?(Hash)
288
+ {}.tap do |hash|
289
+ value.each { |k, v| hash[k] = _to_hash(v) }
290
+ end
291
+ elsif value.respond_to? :to_hash
292
+ value.to_hash
293
+ else
294
+ value
295
+ end
296
+ end
297
+
298
+ end
299
+
300
+ end
301
+ end
302
+ end
303
+ end
@@ -0,0 +1,246 @@
1
+ =begin
2
+ #Postal Mail
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Hubspot
17
+ module Crm
18
+ module Objects
19
+ module PostalMail
20
+ class SimplePublicObjectBatchInput
21
+ attr_accessor :properties
22
+
23
+ attr_accessor :id
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'properties' => :'properties',
29
+ :'id' => :'id'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'properties' => :'Hash<String, String>',
42
+ :'id' => :'String'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Crm::Objects::PostalMail::SimplePublicObjectBatchInput` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Crm::Objects::PostalMail::SimplePublicObjectBatchInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'properties')
68
+ if (value = attributes[:'properties']).is_a?(Hash)
69
+ self.properties = value
70
+ end
71
+ end
72
+
73
+ if attributes.key?(:'id')
74
+ self.id = attributes[:'id']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ if @properties.nil?
83
+ invalid_properties.push('invalid value for "properties", properties cannot be nil.')
84
+ end
85
+
86
+ if @id.nil?
87
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
88
+ end
89
+
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ return false if @properties.nil?
97
+ return false if @id.nil?
98
+ true
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(o)
104
+ return true if self.equal?(o)
105
+ self.class == o.class &&
106
+ properties == o.properties &&
107
+ id == o.id
108
+ end
109
+
110
+ # @see the `==` method
111
+ # @param [Object] Object to be compared
112
+ def eql?(o)
113
+ self == o
114
+ end
115
+
116
+ # Calculates hash code according to all attributes.
117
+ # @return [Integer] Hash code
118
+ def hash
119
+ [properties, id].hash
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def self.build_from_hash(attributes)
126
+ new.build_from_hash(attributes)
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ attributes = attributes.transform_keys(&:to_sym)
135
+ self.class.openapi_types.each_pair do |key, type|
136
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
137
+ self.send("#{key}=", nil)
138
+ elsif type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :Time
159
+ Time.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ # models (e.g. Pet) or oneOf
190
+ klass = Hubspot::Crm::Objects::PostalMail.const_get(type)
191
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end
240
+
241
+ end
242
+
243
+ end
244
+ end
245
+ end
246
+ end