mailslurp_client 16.1.4 → 16.2.0

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.
@@ -14,12 +14,12 @@ require 'date'
14
14
 
15
15
  module MailSlurpClient
16
16
  class PageableObject
17
- attr_accessor :page_size
18
-
19
17
  attr_accessor :paged
20
18
 
21
19
  attr_accessor :page_number
22
20
 
21
+ attr_accessor :page_size
22
+
23
23
  attr_accessor :unpaged
24
24
 
25
25
  attr_accessor :offset
@@ -29,9 +29,9 @@ module MailSlurpClient
29
29
  # Attribute mapping from ruby-style variable name to JSON key.
30
30
  def self.attribute_map
31
31
  {
32
- :'page_size' => :'pageSize',
33
32
  :'paged' => :'paged',
34
33
  :'page_number' => :'pageNumber',
34
+ :'page_size' => :'pageSize',
35
35
  :'unpaged' => :'unpaged',
36
36
  :'offset' => :'offset',
37
37
  :'sort' => :'sort'
@@ -41,9 +41,9 @@ module MailSlurpClient
41
41
  # Attribute type mapping.
42
42
  def self.openapi_types
43
43
  {
44
- :'page_size' => :'Integer',
45
44
  :'paged' => :'Boolean',
46
45
  :'page_number' => :'Integer',
46
+ :'page_size' => :'Integer',
47
47
  :'unpaged' => :'Boolean',
48
48
  :'offset' => :'Integer',
49
49
  :'sort' => :'SortObject'
@@ -71,10 +71,6 @@ module MailSlurpClient
71
71
  h[k.to_sym] = v
72
72
  }
73
73
 
74
- if attributes.key?(:'page_size')
75
- self.page_size = attributes[:'page_size']
76
- end
77
-
78
74
  if attributes.key?(:'paged')
79
75
  self.paged = attributes[:'paged']
80
76
  end
@@ -83,6 +79,10 @@ module MailSlurpClient
83
79
  self.page_number = attributes[:'page_number']
84
80
  end
85
81
 
82
+ if attributes.key?(:'page_size')
83
+ self.page_size = attributes[:'page_size']
84
+ end
85
+
86
86
  if attributes.key?(:'unpaged')
87
87
  self.unpaged = attributes[:'unpaged']
88
88
  end
@@ -114,9 +114,9 @@ module MailSlurpClient
114
114
  def ==(o)
115
115
  return true if self.equal?(o)
116
116
  self.class == o.class &&
117
- page_size == o.page_size &&
118
117
  paged == o.paged &&
119
118
  page_number == o.page_number &&
119
+ page_size == o.page_size &&
120
120
  unpaged == o.unpaged &&
121
121
  offset == o.offset &&
122
122
  sort == o.sort
@@ -131,7 +131,7 @@ module MailSlurpClient
131
131
  # Calculates hash code according to all attributes.
132
132
  # @return [Integer] Hash code
133
133
  def hash
134
- [page_size, paged, page_number, unpaged, offset, sort].hash
134
+ [paged, page_number, page_size, unpaged, offset, sort].hash
135
135
  end
136
136
 
137
137
  # Builds the object from hash
@@ -14,6 +14,8 @@ require 'date'
14
14
 
15
15
  module MailSlurpClient
16
16
  class PhoneMessageThreadProjection
17
+ attr_accessor :last_body
18
+
17
19
  attr_accessor :phone_number
18
20
 
19
21
  attr_accessor :phone_number_id
@@ -22,8 +24,6 @@ module MailSlurpClient
22
24
 
23
25
  attr_accessor :last_message_direction
24
26
 
25
- attr_accessor :last_body
26
-
27
27
  attr_accessor :last_created
28
28
 
29
29
  class EnumAttributeValidator
@@ -51,11 +51,11 @@ module MailSlurpClient
51
51
  # Attribute mapping from ruby-style variable name to JSON key.
52
52
  def self.attribute_map
53
53
  {
54
+ :'last_body' => :'lastBody',
54
55
  :'phone_number' => :'phoneNumber',
55
56
  :'phone_number_id' => :'phoneNumberId',
56
57
  :'other_phone_number' => :'otherPhoneNumber',
57
58
  :'last_message_direction' => :'lastMessageDirection',
58
- :'last_body' => :'lastBody',
59
59
  :'last_created' => :'lastCreated'
60
60
  }
61
61
  end
@@ -63,11 +63,11 @@ module MailSlurpClient
63
63
  # Attribute type mapping.
64
64
  def self.openapi_types
65
65
  {
66
+ :'last_body' => :'String',
66
67
  :'phone_number' => :'String',
67
68
  :'phone_number_id' => :'String',
68
69
  :'other_phone_number' => :'String',
69
70
  :'last_message_direction' => :'String',
70
- :'last_body' => :'String',
71
71
  :'last_created' => :'DateTime'
72
72
  }
73
73
  end
@@ -93,6 +93,10 @@ module MailSlurpClient
93
93
  h[k.to_sym] = v
94
94
  }
95
95
 
96
+ if attributes.key?(:'last_body')
97
+ self.last_body = attributes[:'last_body']
98
+ end
99
+
96
100
  if attributes.key?(:'phone_number')
97
101
  self.phone_number = attributes[:'phone_number']
98
102
  end
@@ -109,10 +113,6 @@ module MailSlurpClient
109
113
  self.last_message_direction = attributes[:'last_message_direction']
110
114
  end
111
115
 
112
- if attributes.key?(:'last_body')
113
- self.last_body = attributes[:'last_body']
114
- end
115
-
116
116
  if attributes.key?(:'last_created')
117
117
  self.last_created = attributes[:'last_created']
118
118
  end
@@ -122,6 +122,10 @@ module MailSlurpClient
122
122
  # @return Array for valid properties with the reasons
123
123
  def list_invalid_properties
124
124
  invalid_properties = Array.new
125
+ if @last_body.nil?
126
+ invalid_properties.push('invalid value for "last_body", last_body cannot be nil.')
127
+ end
128
+
125
129
  if @phone_number.nil?
126
130
  invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
127
131
  end
@@ -138,10 +142,6 @@ module MailSlurpClient
138
142
  invalid_properties.push('invalid value for "last_message_direction", last_message_direction cannot be nil.')
139
143
  end
140
144
 
141
- if @last_body.nil?
142
- invalid_properties.push('invalid value for "last_body", last_body cannot be nil.')
143
- end
144
-
145
145
  if @last_created.nil?
146
146
  invalid_properties.push('invalid value for "last_created", last_created cannot be nil.')
147
147
  end
@@ -152,13 +152,13 @@ module MailSlurpClient
152
152
  # Check to see if the all the properties in the model are valid
153
153
  # @return true if the model is valid
154
154
  def valid?
155
+ return false if @last_body.nil?
155
156
  return false if @phone_number.nil?
156
157
  return false if @phone_number_id.nil?
157
158
  return false if @other_phone_number.nil?
158
159
  return false if @last_message_direction.nil?
159
160
  last_message_direction_validator = EnumAttributeValidator.new('String', ["OUTBOUND", "INBOUND"])
160
161
  return false unless last_message_direction_validator.valid?(@last_message_direction)
161
- return false if @last_body.nil?
162
162
  return false if @last_created.nil?
163
163
  true
164
164
  end
@@ -178,11 +178,11 @@ module MailSlurpClient
178
178
  def ==(o)
179
179
  return true if self.equal?(o)
180
180
  self.class == o.class &&
181
+ last_body == o.last_body &&
181
182
  phone_number == o.phone_number &&
182
183
  phone_number_id == o.phone_number_id &&
183
184
  other_phone_number == o.other_phone_number &&
184
185
  last_message_direction == o.last_message_direction &&
185
- last_body == o.last_body &&
186
186
  last_created == o.last_created
187
187
  end
188
188
 
@@ -195,7 +195,7 @@ module MailSlurpClient
195
195
  # Calculates hash code according to all attributes.
196
196
  # @return [Integer] Hash code
197
197
  def hash
198
- [phone_number, phone_number_id, other_phone_number, last_message_direction, last_body, last_created].hash
198
+ [last_body, phone_number, phone_number_id, other_phone_number, last_message_direction, last_created].hash
199
199
  end
200
200
 
201
201
  # Builds the object from hash
@@ -14,22 +14,26 @@ require 'date'
14
14
 
15
15
  module MailSlurpClient
16
16
  class SentEmailProjection
17
+ attr_accessor :subject
18
+
17
19
  attr_accessor :id
18
20
 
21
+ attr_accessor :thread_id
22
+
23
+ attr_accessor :in_reply_to
24
+
19
25
  attr_accessor :from
20
26
 
21
27
  attr_accessor :sender
22
28
 
23
29
  attr_accessor :recipients
24
30
 
25
- attr_accessor :subject
31
+ attr_accessor :attachments
26
32
 
27
33
  attr_accessor :inbox_id
28
34
 
29
35
  attr_accessor :user_id
30
36
 
31
- attr_accessor :attachments
32
-
33
37
  attr_accessor :created_at
34
38
 
35
39
  attr_accessor :to
@@ -40,8 +44,6 @@ module MailSlurpClient
40
44
 
41
45
  attr_accessor :message_id
42
46
 
43
- attr_accessor :in_reply_to
44
-
45
47
  attr_accessor :body_excerpt
46
48
 
47
49
  attr_accessor :text_excerpt
@@ -50,72 +52,70 @@ module MailSlurpClient
50
52
 
51
53
  attr_accessor :virtual_send
52
54
 
53
- attr_accessor :thread_id
54
-
55
55
  # Attribute mapping from ruby-style variable name to JSON key.
56
56
  def self.attribute_map
57
57
  {
58
+ :'subject' => :'subject',
58
59
  :'id' => :'id',
60
+ :'thread_id' => :'threadId',
61
+ :'in_reply_to' => :'inReplyTo',
59
62
  :'from' => :'from',
60
63
  :'sender' => :'sender',
61
64
  :'recipients' => :'recipients',
62
- :'subject' => :'subject',
65
+ :'attachments' => :'attachments',
63
66
  :'inbox_id' => :'inboxId',
64
67
  :'user_id' => :'userId',
65
- :'attachments' => :'attachments',
66
68
  :'created_at' => :'createdAt',
67
69
  :'to' => :'to',
68
70
  :'cc' => :'cc',
69
71
  :'bcc' => :'bcc',
70
72
  :'message_id' => :'messageId',
71
- :'in_reply_to' => :'inReplyTo',
72
73
  :'body_excerpt' => :'bodyExcerpt',
73
74
  :'text_excerpt' => :'textExcerpt',
74
75
  :'body_md5_hash' => :'bodyMD5Hash',
75
- :'virtual_send' => :'virtualSend',
76
- :'thread_id' => :'threadId'
76
+ :'virtual_send' => :'virtualSend'
77
77
  }
78
78
  end
79
79
 
80
80
  # Attribute type mapping.
81
81
  def self.openapi_types
82
82
  {
83
+ :'subject' => :'String',
83
84
  :'id' => :'String',
85
+ :'thread_id' => :'String',
86
+ :'in_reply_to' => :'String',
84
87
  :'from' => :'String',
85
88
  :'sender' => :'Sender',
86
89
  :'recipients' => :'EmailRecipients',
87
- :'subject' => :'String',
90
+ :'attachments' => :'Array<String>',
88
91
  :'inbox_id' => :'String',
89
92
  :'user_id' => :'String',
90
- :'attachments' => :'Array<String>',
91
93
  :'created_at' => :'DateTime',
92
94
  :'to' => :'Array<String>',
93
95
  :'cc' => :'Array<String>',
94
96
  :'bcc' => :'Array<String>',
95
97
  :'message_id' => :'String',
96
- :'in_reply_to' => :'String',
97
98
  :'body_excerpt' => :'String',
98
99
  :'text_excerpt' => :'String',
99
100
  :'body_md5_hash' => :'String',
100
- :'virtual_send' => :'Boolean',
101
- :'thread_id' => :'String'
101
+ :'virtual_send' => :'Boolean'
102
102
  }
103
103
  end
104
104
 
105
105
  # List of attributes with nullable: true
106
106
  def self.openapi_nullable
107
107
  Set.new([
108
+ :'subject',
109
+ :'thread_id',
110
+ :'in_reply_to',
108
111
  :'from',
109
112
  :'sender',
110
113
  :'recipients',
111
- :'subject',
112
114
  :'attachments',
113
115
  :'message_id',
114
- :'in_reply_to',
115
116
  :'body_excerpt',
116
117
  :'text_excerpt',
117
118
  :'body_md5_hash',
118
- :'thread_id'
119
119
  ])
120
120
  end
121
121
 
@@ -134,10 +134,22 @@ module MailSlurpClient
134
134
  h[k.to_sym] = v
135
135
  }
136
136
 
137
+ if attributes.key?(:'subject')
138
+ self.subject = attributes[:'subject']
139
+ end
140
+
137
141
  if attributes.key?(:'id')
138
142
  self.id = attributes[:'id']
139
143
  end
140
144
 
145
+ if attributes.key?(:'thread_id')
146
+ self.thread_id = attributes[:'thread_id']
147
+ end
148
+
149
+ if attributes.key?(:'in_reply_to')
150
+ self.in_reply_to = attributes[:'in_reply_to']
151
+ end
152
+
141
153
  if attributes.key?(:'from')
142
154
  self.from = attributes[:'from']
143
155
  end
@@ -150,8 +162,10 @@ module MailSlurpClient
150
162
  self.recipients = attributes[:'recipients']
151
163
  end
152
164
 
153
- if attributes.key?(:'subject')
154
- self.subject = attributes[:'subject']
165
+ if attributes.key?(:'attachments')
166
+ if (value = attributes[:'attachments']).is_a?(Array)
167
+ self.attachments = value
168
+ end
155
169
  end
156
170
 
157
171
  if attributes.key?(:'inbox_id')
@@ -162,12 +176,6 @@ module MailSlurpClient
162
176
  self.user_id = attributes[:'user_id']
163
177
  end
164
178
 
165
- if attributes.key?(:'attachments')
166
- if (value = attributes[:'attachments']).is_a?(Array)
167
- self.attachments = value
168
- end
169
- end
170
-
171
179
  if attributes.key?(:'created_at')
172
180
  self.created_at = attributes[:'created_at']
173
181
  end
@@ -194,10 +202,6 @@ module MailSlurpClient
194
202
  self.message_id = attributes[:'message_id']
195
203
  end
196
204
 
197
- if attributes.key?(:'in_reply_to')
198
- self.in_reply_to = attributes[:'in_reply_to']
199
- end
200
-
201
205
  if attributes.key?(:'body_excerpt')
202
206
  self.body_excerpt = attributes[:'body_excerpt']
203
207
  end
@@ -213,10 +217,6 @@ module MailSlurpClient
213
217
  if attributes.key?(:'virtual_send')
214
218
  self.virtual_send = attributes[:'virtual_send']
215
219
  end
216
-
217
- if attributes.key?(:'thread_id')
218
- self.thread_id = attributes[:'thread_id']
219
- end
220
220
  end
221
221
 
222
222
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -277,25 +277,25 @@ module MailSlurpClient
277
277
  def ==(o)
278
278
  return true if self.equal?(o)
279
279
  self.class == o.class &&
280
+ subject == o.subject &&
280
281
  id == o.id &&
282
+ thread_id == o.thread_id &&
283
+ in_reply_to == o.in_reply_to &&
281
284
  from == o.from &&
282
285
  sender == o.sender &&
283
286
  recipients == o.recipients &&
284
- subject == o.subject &&
287
+ attachments == o.attachments &&
285
288
  inbox_id == o.inbox_id &&
286
289
  user_id == o.user_id &&
287
- attachments == o.attachments &&
288
290
  created_at == o.created_at &&
289
291
  to == o.to &&
290
292
  cc == o.cc &&
291
293
  bcc == o.bcc &&
292
294
  message_id == o.message_id &&
293
- in_reply_to == o.in_reply_to &&
294
295
  body_excerpt == o.body_excerpt &&
295
296
  text_excerpt == o.text_excerpt &&
296
297
  body_md5_hash == o.body_md5_hash &&
297
- virtual_send == o.virtual_send &&
298
- thread_id == o.thread_id
298
+ virtual_send == o.virtual_send
299
299
  end
300
300
 
301
301
  # @see the `==` method
@@ -307,7 +307,7 @@ module MailSlurpClient
307
307
  # Calculates hash code according to all attributes.
308
308
  # @return [Integer] Hash code
309
309
  def hash
310
- [id, from, sender, recipients, subject, inbox_id, user_id, attachments, created_at, to, cc, bcc, message_id, in_reply_to, body_excerpt, text_excerpt, body_md5_hash, virtual_send, thread_id].hash
310
+ [subject, id, thread_id, in_reply_to, from, sender, recipients, attachments, inbox_id, user_id, created_at, to, cc, bcc, message_id, body_excerpt, text_excerpt, body_md5_hash, virtual_send].hash
311
311
  end
312
312
 
313
313
  # Builds the object from hash
@@ -0,0 +1,221 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails and SMS from dynamically allocated email addresses and phone numbers. 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 TotpDeviceCodeDto
17
+ attr_accessor :code
18
+
19
+ attr_accessor :expires_at
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'code' => :'code',
25
+ :'expires_at' => :'expiresAt'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'code' => :'String',
33
+ :'expires_at' => :'DateTime'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ :'expires_at'
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::TotpDeviceCodeDto` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::TotpDeviceCodeDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'code')
60
+ self.code = attributes[:'code']
61
+ end
62
+
63
+ if attributes.key?(:'expires_at')
64
+ self.expires_at = attributes[:'expires_at']
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ if @code.nil?
73
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
74
+ end
75
+
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ return false if @code.nil?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ code == o.code &&
92
+ expires_at == o.expires_at
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [code, expires_at].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ DateTime.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ MailSlurpClient.const_get(type).build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+ end
221
+ end