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