ElasticEmail 4.0.27 → 4.0.28

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.
@@ -0,0 +1,330 @@
1
+ =begin
2
+ #Elastic Email REST API
3
+
4
+ #This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach. Every API call is established on which specific request type (GET, POST, PUT, DELETE) will be used. The API has a limit of 20 concurrent connections and a hard timeout of 600 seconds per request. To start using this API, you will need your Access Token (available <a target='_blank' href='https://app.elasticemail.com/marketing/settings/new/manage-api'>here</a>). Remember to keep it safe. Required access levels are listed in the given request’s description. Downloadable library clients can be found in our Github repository <a target='_blank' href='https://github.com/ElasticEmail?tab=repositories&q=%22rest+api%22+in%3Areadme'>here</a>
5
+
6
+ The version of the OpenAPI document: 4.0.0
7
+ Contact: support@elasticemail.com
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 ElasticEmail
17
+ # Notification webhook setting
18
+ class Webhook
19
+ # Public webhook ID
20
+ attr_accessor :webhook_id
21
+
22
+ # Filename
23
+ attr_accessor :name
24
+
25
+ # Creation date.
26
+ attr_accessor :date_created
27
+
28
+ # Last change date
29
+ attr_accessor :date_updated
30
+
31
+ # URL of notification.
32
+ attr_accessor :url
33
+
34
+ attr_accessor :notify_once_per_email
35
+
36
+ attr_accessor :notification_for_sent
37
+
38
+ attr_accessor :notification_for_opened
39
+
40
+ attr_accessor :notification_for_clicked
41
+
42
+ attr_accessor :notification_for_unsubscribed
43
+
44
+ attr_accessor :notification_for_abuse_report
45
+
46
+ attr_accessor :notification_for_error
47
+
48
+ attr_accessor :is_enabled
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'webhook_id' => :'WebhookID',
54
+ :'name' => :'Name',
55
+ :'date_created' => :'DateCreated',
56
+ :'date_updated' => :'DateUpdated',
57
+ :'url' => :'URL',
58
+ :'notify_once_per_email' => :'NotifyOncePerEmail',
59
+ :'notification_for_sent' => :'NotificationForSent',
60
+ :'notification_for_opened' => :'NotificationForOpened',
61
+ :'notification_for_clicked' => :'NotificationForClicked',
62
+ :'notification_for_unsubscribed' => :'NotificationForUnsubscribed',
63
+ :'notification_for_abuse_report' => :'NotificationForAbuseReport',
64
+ :'notification_for_error' => :'NotificationForError',
65
+ :'is_enabled' => :'IsEnabled'
66
+ }
67
+ end
68
+
69
+ # Returns all the JSON keys this model knows about
70
+ def self.acceptable_attributes
71
+ attribute_map.values
72
+ end
73
+
74
+ # Attribute type mapping.
75
+ def self.openapi_types
76
+ {
77
+ :'webhook_id' => :'String',
78
+ :'name' => :'String',
79
+ :'date_created' => :'Time',
80
+ :'date_updated' => :'Time',
81
+ :'url' => :'String',
82
+ :'notify_once_per_email' => :'Boolean',
83
+ :'notification_for_sent' => :'Boolean',
84
+ :'notification_for_opened' => :'Boolean',
85
+ :'notification_for_clicked' => :'Boolean',
86
+ :'notification_for_unsubscribed' => :'Boolean',
87
+ :'notification_for_abuse_report' => :'Boolean',
88
+ :'notification_for_error' => :'Boolean',
89
+ :'is_enabled' => :'Boolean'
90
+ }
91
+ end
92
+
93
+ # List of attributes with nullable: true
94
+ def self.openapi_nullable
95
+ Set.new([
96
+ :'date_created',
97
+ :'date_updated',
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `ElasticEmail::Webhook` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ElasticEmail::Webhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'webhook_id')
117
+ self.webhook_id = attributes[:'webhook_id']
118
+ end
119
+
120
+ if attributes.key?(:'name')
121
+ self.name = attributes[:'name']
122
+ end
123
+
124
+ if attributes.key?(:'date_created')
125
+ self.date_created = attributes[:'date_created']
126
+ end
127
+
128
+ if attributes.key?(:'date_updated')
129
+ self.date_updated = attributes[:'date_updated']
130
+ end
131
+
132
+ if attributes.key?(:'url')
133
+ self.url = attributes[:'url']
134
+ end
135
+
136
+ if attributes.key?(:'notify_once_per_email')
137
+ self.notify_once_per_email = attributes[:'notify_once_per_email']
138
+ end
139
+
140
+ if attributes.key?(:'notification_for_sent')
141
+ self.notification_for_sent = attributes[:'notification_for_sent']
142
+ end
143
+
144
+ if attributes.key?(:'notification_for_opened')
145
+ self.notification_for_opened = attributes[:'notification_for_opened']
146
+ end
147
+
148
+ if attributes.key?(:'notification_for_clicked')
149
+ self.notification_for_clicked = attributes[:'notification_for_clicked']
150
+ end
151
+
152
+ if attributes.key?(:'notification_for_unsubscribed')
153
+ self.notification_for_unsubscribed = attributes[:'notification_for_unsubscribed']
154
+ end
155
+
156
+ if attributes.key?(:'notification_for_abuse_report')
157
+ self.notification_for_abuse_report = attributes[:'notification_for_abuse_report']
158
+ end
159
+
160
+ if attributes.key?(:'notification_for_error')
161
+ self.notification_for_error = attributes[:'notification_for_error']
162
+ end
163
+
164
+ if attributes.key?(:'is_enabled')
165
+ self.is_enabled = attributes[:'is_enabled']
166
+ end
167
+ end
168
+
169
+ # Show invalid properties with the reasons. Usually used together with valid?
170
+ # @return Array for valid properties with the reasons
171
+ def list_invalid_properties
172
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
173
+ invalid_properties = Array.new
174
+ invalid_properties
175
+ end
176
+
177
+ # Check to see if the all the properties in the model are valid
178
+ # @return true if the model is valid
179
+ def valid?
180
+ warn '[DEPRECATED] the `valid?` method is obsolete'
181
+ true
182
+ end
183
+
184
+ # Checks equality by comparing each attribute.
185
+ # @param [Object] Object to be compared
186
+ def ==(o)
187
+ return true if self.equal?(o)
188
+ self.class == o.class &&
189
+ webhook_id == o.webhook_id &&
190
+ name == o.name &&
191
+ date_created == o.date_created &&
192
+ date_updated == o.date_updated &&
193
+ url == o.url &&
194
+ notify_once_per_email == o.notify_once_per_email &&
195
+ notification_for_sent == o.notification_for_sent &&
196
+ notification_for_opened == o.notification_for_opened &&
197
+ notification_for_clicked == o.notification_for_clicked &&
198
+ notification_for_unsubscribed == o.notification_for_unsubscribed &&
199
+ notification_for_abuse_report == o.notification_for_abuse_report &&
200
+ notification_for_error == o.notification_for_error &&
201
+ is_enabled == o.is_enabled
202
+ end
203
+
204
+ # @see the `==` method
205
+ # @param [Object] Object to be compared
206
+ def eql?(o)
207
+ self == o
208
+ end
209
+
210
+ # Calculates hash code according to all attributes.
211
+ # @return [Integer] Hash code
212
+ def hash
213
+ [webhook_id, name, date_created, date_updated, url, notify_once_per_email, notification_for_sent, notification_for_opened, notification_for_clicked, notification_for_unsubscribed, notification_for_abuse_report, notification_for_error, is_enabled].hash
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def self.build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ attributes = attributes.transform_keys(&:to_sym)
222
+ transformed_hash = {}
223
+ openapi_types.each_pair do |key, type|
224
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
225
+ transformed_hash["#{key}"] = nil
226
+ elsif type =~ /\AArray<(.*)>/i
227
+ # check to ensure the input is an array given that the attribute
228
+ # is documented as an array but the input is not
229
+ if attributes[attribute_map[key]].is_a?(Array)
230
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
231
+ end
232
+ elsif !attributes[attribute_map[key]].nil?
233
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
234
+ end
235
+ end
236
+ new(transformed_hash)
237
+ end
238
+
239
+ # Deserializes the data based on type
240
+ # @param string type Data type
241
+ # @param string value Value to be deserialized
242
+ # @return [Object] Deserialized data
243
+ def self._deserialize(type, value)
244
+ case type.to_sym
245
+ when :Time
246
+ Time.parse(value)
247
+ when :Date
248
+ Date.parse(value)
249
+ when :String
250
+ value.to_s
251
+ when :Integer
252
+ value.to_i
253
+ when :Float
254
+ value.to_f
255
+ when :Boolean
256
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
257
+ true
258
+ else
259
+ false
260
+ end
261
+ when :Object
262
+ # generic object (usually a Hash), return directly
263
+ value
264
+ when /\AArray<(?<inner_type>.+)>\z/
265
+ inner_type = Regexp.last_match[:inner_type]
266
+ value.map { |v| _deserialize(inner_type, v) }
267
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
268
+ k_type = Regexp.last_match[:k_type]
269
+ v_type = Regexp.last_match[:v_type]
270
+ {}.tap do |hash|
271
+ value.each do |k, v|
272
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
273
+ end
274
+ end
275
+ else # model
276
+ # models (e.g. Pet) or oneOf
277
+ klass = ElasticEmail.const_get(type)
278
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
279
+ end
280
+ end
281
+
282
+ # Returns the string representation of the object
283
+ # @return [String] String presentation of the object
284
+ def to_s
285
+ to_hash.to_s
286
+ end
287
+
288
+ # to_body is an alias to to_hash (backward compatibility)
289
+ # @return [Hash] Returns the object in the form of hash
290
+ def to_body
291
+ to_hash
292
+ end
293
+
294
+ # Returns the object in the form of hash
295
+ # @return [Hash] Returns the object in the form of hash
296
+ def to_hash
297
+ hash = {}
298
+ self.class.attribute_map.each_pair do |attr, param|
299
+ value = self.send(attr)
300
+ if value.nil?
301
+ is_nullable = self.class.openapi_nullable.include?(attr)
302
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
303
+ end
304
+
305
+ hash[param] = _to_hash(value)
306
+ end
307
+ hash
308
+ end
309
+
310
+ # Outputs non-array value in the form of hash
311
+ # For object, use to_hash. Otherwise, just return the value
312
+ # @param [Object] value Any valid value
313
+ # @return [Hash] Returns the value in the form of hash
314
+ def _to_hash(value)
315
+ if value.is_a?(Array)
316
+ value.compact.map { |v| _to_hash(v) }
317
+ elsif value.is_a?(Hash)
318
+ {}.tap do |hash|
319
+ value.each { |k, v| hash[k] = _to_hash(v) }
320
+ end
321
+ elsif value.respond_to? :to_hash
322
+ value.to_hash
323
+ else
324
+ value
325
+ end
326
+ end
327
+
328
+ end
329
+
330
+ end
@@ -0,0 +1,303 @@
1
+ =begin
2
+ #Elastic Email REST API
3
+
4
+ #This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach. Every API call is established on which specific request type (GET, POST, PUT, DELETE) will be used. The API has a limit of 20 concurrent connections and a hard timeout of 600 seconds per request. To start using this API, you will need your Access Token (available <a target='_blank' href='https://app.elasticemail.com/marketing/settings/new/manage-api'>here</a>). Remember to keep it safe. Required access levels are listed in the given request’s description. Downloadable library clients can be found in our Github repository <a target='_blank' href='https://github.com/ElasticEmail?tab=repositories&q=%22rest+api%22+in%3Areadme'>here</a>
5
+
6
+ The version of the OpenAPI document: 4.0.0
7
+ Contact: support@elasticemail.com
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 ElasticEmail
17
+ # Create webhook payload
18
+ class WebhookCreatePayload
19
+ # Filename
20
+ attr_accessor :name
21
+
22
+ # URL of notification.
23
+ attr_accessor :url
24
+
25
+ attr_accessor :notify_once_per_email
26
+
27
+ attr_accessor :notification_for_sent
28
+
29
+ attr_accessor :notification_for_opened
30
+
31
+ attr_accessor :notification_for_clicked
32
+
33
+ attr_accessor :notification_for_unsubscribed
34
+
35
+ attr_accessor :notification_for_abuse_report
36
+
37
+ attr_accessor :notification_for_error
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'name' => :'Name',
43
+ :'url' => :'URL',
44
+ :'notify_once_per_email' => :'NotifyOncePerEmail',
45
+ :'notification_for_sent' => :'NotificationForSent',
46
+ :'notification_for_opened' => :'NotificationForOpened',
47
+ :'notification_for_clicked' => :'NotificationForClicked',
48
+ :'notification_for_unsubscribed' => :'NotificationForUnsubscribed',
49
+ :'notification_for_abuse_report' => :'NotificationForAbuseReport',
50
+ :'notification_for_error' => :'NotificationForError'
51
+ }
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'name' => :'String',
63
+ :'url' => :'String',
64
+ :'notify_once_per_email' => :'Boolean',
65
+ :'notification_for_sent' => :'Boolean',
66
+ :'notification_for_opened' => :'Boolean',
67
+ :'notification_for_clicked' => :'Boolean',
68
+ :'notification_for_unsubscribed' => :'Boolean',
69
+ :'notification_for_abuse_report' => :'Boolean',
70
+ :'notification_for_error' => :'Boolean'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `ElasticEmail::WebhookCreatePayload` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!self.class.attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ElasticEmail::WebhookCreatePayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'name')
96
+ self.name = attributes[:'name']
97
+ else
98
+ self.name = nil
99
+ end
100
+
101
+ if attributes.key?(:'url')
102
+ self.url = attributes[:'url']
103
+ else
104
+ self.url = nil
105
+ end
106
+
107
+ if attributes.key?(:'notify_once_per_email')
108
+ self.notify_once_per_email = attributes[:'notify_once_per_email']
109
+ end
110
+
111
+ if attributes.key?(:'notification_for_sent')
112
+ self.notification_for_sent = attributes[:'notification_for_sent']
113
+ end
114
+
115
+ if attributes.key?(:'notification_for_opened')
116
+ self.notification_for_opened = attributes[:'notification_for_opened']
117
+ end
118
+
119
+ if attributes.key?(:'notification_for_clicked')
120
+ self.notification_for_clicked = attributes[:'notification_for_clicked']
121
+ end
122
+
123
+ if attributes.key?(:'notification_for_unsubscribed')
124
+ self.notification_for_unsubscribed = attributes[:'notification_for_unsubscribed']
125
+ end
126
+
127
+ if attributes.key?(:'notification_for_abuse_report')
128
+ self.notification_for_abuse_report = attributes[:'notification_for_abuse_report']
129
+ end
130
+
131
+ if attributes.key?(:'notification_for_error')
132
+ self.notification_for_error = attributes[:'notification_for_error']
133
+ end
134
+ end
135
+
136
+ # Show invalid properties with the reasons. Usually used together with valid?
137
+ # @return Array for valid properties with the reasons
138
+ def list_invalid_properties
139
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
140
+ invalid_properties = Array.new
141
+ if @name.nil?
142
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
143
+ end
144
+
145
+ if @url.nil?
146
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
147
+ end
148
+
149
+ invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ warn '[DEPRECATED] the `valid?` method is obsolete'
156
+ return false if @name.nil?
157
+ return false if @url.nil?
158
+ true
159
+ end
160
+
161
+ # Checks equality by comparing each attribute.
162
+ # @param [Object] Object to be compared
163
+ def ==(o)
164
+ return true if self.equal?(o)
165
+ self.class == o.class &&
166
+ name == o.name &&
167
+ url == o.url &&
168
+ notify_once_per_email == o.notify_once_per_email &&
169
+ notification_for_sent == o.notification_for_sent &&
170
+ notification_for_opened == o.notification_for_opened &&
171
+ notification_for_clicked == o.notification_for_clicked &&
172
+ notification_for_unsubscribed == o.notification_for_unsubscribed &&
173
+ notification_for_abuse_report == o.notification_for_abuse_report &&
174
+ notification_for_error == o.notification_for_error
175
+ end
176
+
177
+ # @see the `==` method
178
+ # @param [Object] Object to be compared
179
+ def eql?(o)
180
+ self == o
181
+ end
182
+
183
+ # Calculates hash code according to all attributes.
184
+ # @return [Integer] Hash code
185
+ def hash
186
+ [name, url, notify_once_per_email, notification_for_sent, notification_for_opened, notification_for_clicked, notification_for_unsubscribed, notification_for_abuse_report, notification_for_error].hash
187
+ end
188
+
189
+ # Builds the object from hash
190
+ # @param [Hash] attributes Model attributes in the form of hash
191
+ # @return [Object] Returns the model itself
192
+ def self.build_from_hash(attributes)
193
+ return nil unless attributes.is_a?(Hash)
194
+ attributes = attributes.transform_keys(&:to_sym)
195
+ transformed_hash = {}
196
+ openapi_types.each_pair do |key, type|
197
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
198
+ transformed_hash["#{key}"] = nil
199
+ elsif type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[attribute_map[key]].is_a?(Array)
203
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
204
+ end
205
+ elsif !attributes[attribute_map[key]].nil?
206
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
207
+ end
208
+ end
209
+ new(transformed_hash)
210
+ end
211
+
212
+ # Deserializes the data based on type
213
+ # @param string type Data type
214
+ # @param string value Value to be deserialized
215
+ # @return [Object] Deserialized data
216
+ def self._deserialize(type, value)
217
+ case type.to_sym
218
+ when :Time
219
+ Time.parse(value)
220
+ when :Date
221
+ Date.parse(value)
222
+ when :String
223
+ value.to_s
224
+ when :Integer
225
+ value.to_i
226
+ when :Float
227
+ value.to_f
228
+ when :Boolean
229
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
230
+ true
231
+ else
232
+ false
233
+ end
234
+ when :Object
235
+ # generic object (usually a Hash), return directly
236
+ value
237
+ when /\AArray<(?<inner_type>.+)>\z/
238
+ inner_type = Regexp.last_match[:inner_type]
239
+ value.map { |v| _deserialize(inner_type, v) }
240
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
241
+ k_type = Regexp.last_match[:k_type]
242
+ v_type = Regexp.last_match[:v_type]
243
+ {}.tap do |hash|
244
+ value.each do |k, v|
245
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
246
+ end
247
+ end
248
+ else # model
249
+ # models (e.g. Pet) or oneOf
250
+ klass = ElasticEmail.const_get(type)
251
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
252
+ end
253
+ end
254
+
255
+ # Returns the string representation of the object
256
+ # @return [String] String presentation of the object
257
+ def to_s
258
+ to_hash.to_s
259
+ end
260
+
261
+ # to_body is an alias to to_hash (backward compatibility)
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_body
264
+ to_hash
265
+ end
266
+
267
+ # Returns the object in the form of hash
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_hash
270
+ hash = {}
271
+ self.class.attribute_map.each_pair do |attr, param|
272
+ value = self.send(attr)
273
+ if value.nil?
274
+ is_nullable = self.class.openapi_nullable.include?(attr)
275
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
276
+ end
277
+
278
+ hash[param] = _to_hash(value)
279
+ end
280
+ hash
281
+ end
282
+
283
+ # Outputs non-array value in the form of hash
284
+ # For object, use to_hash. Otherwise, just return the value
285
+ # @param [Object] value Any valid value
286
+ # @return [Hash] Returns the value in the form of hash
287
+ def _to_hash(value)
288
+ if value.is_a?(Array)
289
+ value.compact.map { |v| _to_hash(v) }
290
+ elsif value.is_a?(Hash)
291
+ {}.tap do |hash|
292
+ value.each { |k, v| hash[k] = _to_hash(v) }
293
+ end
294
+ elsif value.respond_to? :to_hash
295
+ value.to_hash
296
+ else
297
+ value
298
+ end
299
+ end
300
+
301
+ end
302
+
303
+ end