mailslurp_client 15.7.16 → 15.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/inbox_controller_api.rb +2 -2
  3. data/lib/mailslurp_client/api/template_controller_api.rb +28 -16
  4. data/lib/mailslurp_client/api/webhook_controller_api.rb +68 -10
  5. data/lib/mailslurp_client/models/abstract_webhook_payload.rb +15 -15
  6. data/lib/mailslurp_client/models/alias_projection.rb +33 -33
  7. data/lib/mailslurp_client/models/attachment_projection.rb +28 -28
  8. data/lib/mailslurp_client/models/contact_projection.rb +13 -13
  9. data/lib/mailslurp_client/models/create_template_options.rb +3 -1
  10. data/lib/mailslurp_client/models/email_projection.rb +15 -15
  11. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +19 -19
  12. data/lib/mailslurp_client/models/flush_expired_inboxes_result.rb +2 -0
  13. data/lib/mailslurp_client/models/missed_email_projection.rb +13 -13
  14. data/lib/mailslurp_client/models/page_alias.rb +19 -19
  15. data/lib/mailslurp_client/models/page_attachment_entity.rb +19 -19
  16. data/lib/mailslurp_client/models/page_bounced_email.rb +19 -19
  17. data/lib/mailslurp_client/models/page_bounced_recipients.rb +19 -19
  18. data/lib/mailslurp_client/models/page_contact_projection.rb +19 -19
  19. data/lib/mailslurp_client/models/page_email_preview.rb +19 -19
  20. data/lib/mailslurp_client/models/page_email_projection.rb +19 -19
  21. data/lib/mailslurp_client/models/page_email_validation_request.rb +19 -19
  22. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +19 -19
  23. data/lib/mailslurp_client/models/page_group_projection.rb +19 -19
  24. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +19 -19
  25. data/lib/mailslurp_client/models/page_inbox_projection.rb +19 -19
  26. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +19 -19
  27. data/lib/mailslurp_client/models/page_missed_email_projection.rb +19 -19
  28. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +19 -19
  29. data/lib/mailslurp_client/models/page_template_projection.rb +19 -19
  30. data/lib/mailslurp_client/models/page_thread_projection.rb +19 -19
  31. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +19 -19
  32. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +19 -19
  33. data/lib/mailslurp_client/models/page_webhook_projection.rb +19 -19
  34. data/lib/mailslurp_client/models/page_webhook_result.rb +19 -19
  35. data/lib/mailslurp_client/models/sent_email_projection.rb +26 -26
  36. data/lib/mailslurp_client/models/template_dto.rb +5 -0
  37. data/lib/mailslurp_client/models/template_variable.rb +2 -0
  38. data/lib/mailslurp_client/models/thread_projection.rb +35 -24
  39. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +18 -18
  40. data/lib/mailslurp_client/models/unknown_missed_email_projection.rb +13 -13
  41. data/lib/mailslurp_client/models/verify_webhook_signature_options.rb +225 -0
  42. data/lib/mailslurp_client/models/verify_webhook_signature_results.rb +211 -0
  43. data/lib/mailslurp_client/models/webhook_projection.rb +11 -11
  44. data/lib/mailslurp_client/version.rb +1 -1
  45. data/lib/mailslurp_client.rb +2 -0
  46. metadata +4 -2
@@ -15,26 +15,37 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # A thread is a message thread created for a message received by an alias
17
17
  class ThreadProjection
18
+ # Name of thread
18
19
  attr_accessor :name
19
20
 
21
+ # ID of email thread
20
22
  attr_accessor :id
21
23
 
24
+ # Thread subject
22
25
  attr_accessor :subject
23
26
 
24
- attr_accessor :created_at
27
+ # Inbox ID
28
+ attr_accessor :inbox_id
25
29
 
30
+ # User ID
26
31
  attr_accessor :user_id
27
32
 
28
- attr_accessor :inbox_id
29
-
33
+ # To recipients
30
34
  attr_accessor :to
31
35
 
36
+ # BCC recipients
32
37
  attr_accessor :bcc
33
38
 
39
+ # CC recipients
34
40
  attr_accessor :cc
35
41
 
42
+ # Created at DateTime
43
+ attr_accessor :created_at
44
+
45
+ # Updated at DateTime
36
46
  attr_accessor :updated_at
37
47
 
48
+ # Alias ID
38
49
  attr_accessor :alias_id
39
50
 
40
51
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -43,12 +54,12 @@ module MailSlurpClient
43
54
  :'name' => :'name',
44
55
  :'id' => :'id',
45
56
  :'subject' => :'subject',
46
- :'created_at' => :'createdAt',
47
- :'user_id' => :'userId',
48
57
  :'inbox_id' => :'inboxId',
58
+ :'user_id' => :'userId',
49
59
  :'to' => :'to',
50
60
  :'bcc' => :'bcc',
51
61
  :'cc' => :'cc',
62
+ :'created_at' => :'createdAt',
52
63
  :'updated_at' => :'updatedAt',
53
64
  :'alias_id' => :'aliasId'
54
65
  }
@@ -60,12 +71,12 @@ module MailSlurpClient
60
71
  :'name' => :'String',
61
72
  :'id' => :'String',
62
73
  :'subject' => :'String',
63
- :'created_at' => :'DateTime',
64
- :'user_id' => :'String',
65
74
  :'inbox_id' => :'String',
75
+ :'user_id' => :'String',
66
76
  :'to' => :'Array<String>',
67
77
  :'bcc' => :'Array<String>',
68
78
  :'cc' => :'Array<String>',
79
+ :'created_at' => :'DateTime',
69
80
  :'updated_at' => :'DateTime',
70
81
  :'alias_id' => :'String'
71
82
  }
@@ -104,18 +115,14 @@ module MailSlurpClient
104
115
  self.subject = attributes[:'subject']
105
116
  end
106
117
 
107
- if attributes.key?(:'created_at')
108
- self.created_at = attributes[:'created_at']
118
+ if attributes.key?(:'inbox_id')
119
+ self.inbox_id = attributes[:'inbox_id']
109
120
  end
110
121
 
111
122
  if attributes.key?(:'user_id')
112
123
  self.user_id = attributes[:'user_id']
113
124
  end
114
125
 
115
- if attributes.key?(:'inbox_id')
116
- self.inbox_id = attributes[:'inbox_id']
117
- end
118
-
119
126
  if attributes.key?(:'to')
120
127
  if (value = attributes[:'to']).is_a?(Array)
121
128
  self.to = value
@@ -134,6 +141,10 @@ module MailSlurpClient
134
141
  end
135
142
  end
136
143
 
144
+ if attributes.key?(:'created_at')
145
+ self.created_at = attributes[:'created_at']
146
+ end
147
+
137
148
  if attributes.key?(:'updated_at')
138
149
  self.updated_at = attributes[:'updated_at']
139
150
  end
@@ -151,22 +162,22 @@ module MailSlurpClient
151
162
  invalid_properties.push('invalid value for "id", id cannot be nil.')
152
163
  end
153
164
 
154
- if @created_at.nil?
155
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
165
+ if @inbox_id.nil?
166
+ invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
156
167
  end
157
168
 
158
169
  if @user_id.nil?
159
170
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
160
171
  end
161
172
 
162
- if @inbox_id.nil?
163
- invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
164
- end
165
-
166
173
  if @to.nil?
167
174
  invalid_properties.push('invalid value for "to", to cannot be nil.')
168
175
  end
169
176
 
177
+ if @created_at.nil?
178
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
179
+ end
180
+
170
181
  if @updated_at.nil?
171
182
  invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
172
183
  end
@@ -182,10 +193,10 @@ module MailSlurpClient
182
193
  # @return true if the model is valid
183
194
  def valid?
184
195
  return false if @id.nil?
185
- return false if @created_at.nil?
186
- return false if @user_id.nil?
187
196
  return false if @inbox_id.nil?
197
+ return false if @user_id.nil?
188
198
  return false if @to.nil?
199
+ return false if @created_at.nil?
189
200
  return false if @updated_at.nil?
190
201
  return false if @alias_id.nil?
191
202
  true
@@ -199,12 +210,12 @@ module MailSlurpClient
199
210
  name == o.name &&
200
211
  id == o.id &&
201
212
  subject == o.subject &&
202
- created_at == o.created_at &&
203
- user_id == o.user_id &&
204
213
  inbox_id == o.inbox_id &&
214
+ user_id == o.user_id &&
205
215
  to == o.to &&
206
216
  bcc == o.bcc &&
207
217
  cc == o.cc &&
218
+ created_at == o.created_at &&
208
219
  updated_at == o.updated_at &&
209
220
  alias_id == o.alias_id
210
221
  end
@@ -218,7 +229,7 @@ module MailSlurpClient
218
229
  # Calculates hash code according to all attributes.
219
230
  # @return [Integer] Hash code
220
231
  def hash
221
- [name, id, subject, created_at, user_id, inbox_id, to, bcc, cc, updated_at, alias_id].hash
232
+ [name, id, subject, inbox_id, user_id, to, bcc, cc, created_at, updated_at, alias_id].hash
222
233
  end
223
234
 
224
235
  # Builds the object from hash
@@ -19,11 +19,11 @@ module MailSlurpClient
19
19
 
20
20
  attr_accessor :id
21
21
 
22
- attr_accessor :created_at
22
+ attr_accessor :inbox_id
23
23
 
24
24
  attr_accessor :user_id
25
25
 
26
- attr_accessor :inbox_id
26
+ attr_accessor :created_at
27
27
 
28
28
  attr_accessor :recipient
29
29
 
@@ -38,9 +38,9 @@ module MailSlurpClient
38
38
  {
39
39
  :'name' => :'name',
40
40
  :'id' => :'id',
41
- :'created_at' => :'createdAt',
42
- :'user_id' => :'userId',
43
41
  :'inbox_id' => :'inboxId',
42
+ :'user_id' => :'userId',
43
+ :'created_at' => :'createdAt',
44
44
  :'recipient' => :'recipient',
45
45
  :'seen' => :'seen',
46
46
  :'seen_at' => :'seenAt',
@@ -53,9 +53,9 @@ module MailSlurpClient
53
53
  {
54
54
  :'name' => :'String',
55
55
  :'id' => :'String',
56
- :'created_at' => :'DateTime',
57
- :'user_id' => :'String',
58
56
  :'inbox_id' => :'String',
57
+ :'user_id' => :'String',
58
+ :'created_at' => :'DateTime',
59
59
  :'recipient' => :'String',
60
60
  :'seen' => :'Boolean',
61
61
  :'seen_at' => :'DateTime',
@@ -92,16 +92,16 @@ module MailSlurpClient
92
92
  self.id = attributes[:'id']
93
93
  end
94
94
 
95
- if attributes.key?(:'created_at')
96
- self.created_at = attributes[:'created_at']
95
+ if attributes.key?(:'inbox_id')
96
+ self.inbox_id = attributes[:'inbox_id']
97
97
  end
98
98
 
99
99
  if attributes.key?(:'user_id')
100
100
  self.user_id = attributes[:'user_id']
101
101
  end
102
102
 
103
- if attributes.key?(:'inbox_id')
104
- self.inbox_id = attributes[:'inbox_id']
103
+ if attributes.key?(:'created_at')
104
+ self.created_at = attributes[:'created_at']
105
105
  end
106
106
 
107
107
  if attributes.key?(:'recipient')
@@ -129,14 +129,14 @@ module MailSlurpClient
129
129
  invalid_properties.push('invalid value for "id", id cannot be nil.')
130
130
  end
131
131
 
132
- if @created_at.nil?
133
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
134
- end
135
-
136
132
  if @user_id.nil?
137
133
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
138
134
  end
139
135
 
136
+ if @created_at.nil?
137
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
138
+ end
139
+
140
140
  if @seen.nil?
141
141
  invalid_properties.push('invalid value for "seen", seen cannot be nil.')
142
142
  end
@@ -148,8 +148,8 @@ module MailSlurpClient
148
148
  # @return true if the model is valid
149
149
  def valid?
150
150
  return false if @id.nil?
151
- return false if @created_at.nil?
152
151
  return false if @user_id.nil?
152
+ return false if @created_at.nil?
153
153
  return false if @seen.nil?
154
154
  true
155
155
  end
@@ -161,9 +161,9 @@ module MailSlurpClient
161
161
  self.class == o.class &&
162
162
  name == o.name &&
163
163
  id == o.id &&
164
- created_at == o.created_at &&
165
- user_id == o.user_id &&
166
164
  inbox_id == o.inbox_id &&
165
+ user_id == o.user_id &&
166
+ created_at == o.created_at &&
167
167
  recipient == o.recipient &&
168
168
  seen == o.seen &&
169
169
  seen_at == o.seen_at &&
@@ -179,7 +179,7 @@ module MailSlurpClient
179
179
  # Calculates hash code according to all attributes.
180
180
  # @return [Integer] Hash code
181
181
  def hash
182
- [name, id, created_at, user_id, inbox_id, recipient, seen, seen_at, sent_email_id].hash
182
+ [name, id, inbox_id, user_id, created_at, recipient, seen, seen_at, sent_email_id].hash
183
183
  end
184
184
 
185
185
  # Builds the object from hash
@@ -21,18 +21,18 @@ module MailSlurpClient
21
21
 
22
22
  attr_accessor :subject
23
23
 
24
- attr_accessor :created_at
25
-
26
24
  attr_accessor :to
27
25
 
26
+ attr_accessor :created_at
27
+
28
28
  # Attribute mapping from ruby-style variable name to JSON key.
29
29
  def self.attribute_map
30
30
  {
31
31
  :'id' => :'id',
32
32
  :'from' => :'from',
33
33
  :'subject' => :'subject',
34
- :'created_at' => :'createdAt',
35
- :'to' => :'to'
34
+ :'to' => :'to',
35
+ :'created_at' => :'createdAt'
36
36
  }
37
37
  end
38
38
 
@@ -42,8 +42,8 @@ module MailSlurpClient
42
42
  :'id' => :'String',
43
43
  :'from' => :'String',
44
44
  :'subject' => :'String',
45
- :'created_at' => :'DateTime',
46
- :'to' => :'Array<String>'
45
+ :'to' => :'Array<String>',
46
+ :'created_at' => :'DateTime'
47
47
  }
48
48
  end
49
49
 
@@ -80,15 +80,15 @@ module MailSlurpClient
80
80
  self.subject = attributes[:'subject']
81
81
  end
82
82
 
83
- if attributes.key?(:'created_at')
84
- self.created_at = attributes[:'created_at']
85
- end
86
-
87
83
  if attributes.key?(:'to')
88
84
  if (value = attributes[:'to']).is_a?(Array)
89
85
  self.to = value
90
86
  end
91
87
  end
88
+
89
+ if attributes.key?(:'created_at')
90
+ self.created_at = attributes[:'created_at']
91
+ end
92
92
  end
93
93
 
94
94
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -122,8 +122,8 @@ module MailSlurpClient
122
122
  id == o.id &&
123
123
  from == o.from &&
124
124
  subject == o.subject &&
125
- created_at == o.created_at &&
126
- to == o.to
125
+ to == o.to &&
126
+ created_at == o.created_at
127
127
  end
128
128
 
129
129
  # @see the `==` method
@@ -135,7 +135,7 @@ module MailSlurpClient
135
135
  # Calculates hash code according to all attributes.
136
136
  # @return [Integer] Hash code
137
137
  def hash
138
- [id, from, subject, created_at, to].hash
138
+ [id, from, subject, to, created_at].hash
139
139
  end
140
140
 
141
141
  # Builds the object from hash
@@ -0,0 +1,225 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+ Contact: contact@mailslurp.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ class VerifyWebhookSignatureOptions
17
+ attr_accessor :message_id
18
+
19
+ attr_accessor :signature
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'message_id' => :'messageId',
25
+ :'signature' => :'signature'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'message_id' => :'String',
33
+ :'signature' => :'String'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::VerifyWebhookSignatureOptions` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::VerifyWebhookSignatureOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'message_id')
59
+ self.message_id = attributes[:'message_id']
60
+ end
61
+
62
+ if attributes.key?(:'signature')
63
+ self.signature = attributes[:'signature']
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ if @message_id.nil?
72
+ invalid_properties.push('invalid value for "message_id", message_id cannot be nil.')
73
+ end
74
+
75
+ if @signature.nil?
76
+ invalid_properties.push('invalid value for "signature", signature cannot be nil.')
77
+ end
78
+
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ return false if @message_id.nil?
86
+ return false if @signature.nil?
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ message_id == o.message_id &&
96
+ signature == o.signature
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [message_id, signature].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ new.build_from_hash(attributes)
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.openapi_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :Boolean
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ MailSlurpClient.const_get(type).build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.openapi_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+ end
225
+ end