coinbase-sdk 0.0.13 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/external_address.rb +3 -166
  3. data/lib/coinbase/address/wallet_address.rb +51 -4
  4. data/lib/coinbase/address.rb +164 -0
  5. data/lib/coinbase/client/api/assets_api.rb +2 -2
  6. data/lib/coinbase/client/api/contract_events_api.rb +121 -0
  7. data/lib/coinbase/client/api/external_addresses_api.rb +85 -0
  8. data/lib/coinbase/client/api/networks_api.rb +85 -0
  9. data/lib/coinbase/client/api/stake_api.rb +361 -0
  10. data/lib/coinbase/client/api/webhooks_api.rb +286 -0
  11. data/lib/coinbase/client/models/address_historical_balance_list.rb +258 -0
  12. data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +239 -0
  13. data/lib/coinbase/client/models/contract_event.rb +336 -0
  14. data/lib/coinbase/client/models/contract_event_list.rb +259 -0
  15. data/lib/coinbase/client/models/create_staking_operation_request.rb +274 -0
  16. data/lib/coinbase/client/models/create_transfer_request.rb +14 -4
  17. data/lib/coinbase/client/models/create_webhook_request.rb +282 -0
  18. data/lib/coinbase/client/models/ethereum_validator.rb +374 -0
  19. data/lib/coinbase/client/models/feature_set.rb +307 -0
  20. data/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +258 -0
  21. data/lib/coinbase/client/models/get_validator200_response.rb +221 -0
  22. data/lib/coinbase/client/models/get_validator200_response_validator.rb +214 -0
  23. data/lib/coinbase/client/models/historical_balance.rb +273 -0
  24. data/lib/coinbase/client/models/network.rb +355 -0
  25. data/lib/coinbase/client/models/network_identifier.rb +44 -0
  26. data/lib/coinbase/client/models/sponsored_send.rb +338 -0
  27. data/lib/coinbase/client/models/staking_balance.rb +289 -0
  28. data/lib/coinbase/client/models/staking_context_context.rb +222 -74
  29. data/lib/coinbase/client/models/staking_operation.rb +15 -5
  30. data/lib/coinbase/client/models/staking_reward.rb +22 -6
  31. data/lib/coinbase/client/models/staking_reward_format.rb +2 -1
  32. data/lib/coinbase/client/models/staking_reward_usd_value.rb +257 -0
  33. data/lib/coinbase/client/models/transaction.rb +2 -2
  34. data/lib/coinbase/client/models/transaction_type.rb +2 -1
  35. data/lib/coinbase/client/models/transfer.rb +29 -24
  36. data/lib/coinbase/client/models/update_webhook_request.rb +289 -0
  37. data/lib/coinbase/client/models/validator_list_data.rb +216 -0
  38. data/lib/coinbase/client/models/wallet.rb +13 -16
  39. data/lib/coinbase/client/models/webhook.rb +299 -0
  40. data/lib/coinbase/client/models/webhook_event_filter.rb +236 -0
  41. data/lib/coinbase/client/models/webhook_event_type.rb +42 -0
  42. data/lib/coinbase/client/models/webhook_list.rb +244 -0
  43. data/lib/coinbase/client.rb +22 -3
  44. data/lib/coinbase/errors.rb +7 -0
  45. data/lib/coinbase/historical_balance.rb +53 -0
  46. data/lib/coinbase/middleware.rb +12 -0
  47. data/lib/coinbase/server_signer.rb +14 -3
  48. data/lib/coinbase/sponsored_send.rb +110 -0
  49. data/lib/coinbase/staking_balance.rb +86 -0
  50. data/lib/coinbase/staking_operation.rb +106 -5
  51. data/lib/coinbase/staking_reward.rb +18 -0
  52. data/lib/coinbase/trade.rb +1 -1
  53. data/lib/coinbase/transaction.rb +7 -3
  54. data/lib/coinbase/transfer.rb +56 -29
  55. data/lib/coinbase/wallet/data.rb +31 -0
  56. data/lib/coinbase/wallet.rb +91 -46
  57. data/lib/coinbase.rb +17 -4
  58. metadata +74 -2
@@ -0,0 +1,239 @@
1
+ =begin
2
+ #Coinbase Platform API
3
+
4
+ #This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
5
+
6
+ The version of the OpenAPI document: 0.0.1-alpha
7
+ Contact: yuga.cohler@coinbase.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Coinbase::Client
17
+ class BroadcastStakingOperationRequest
18
+ # The hex-encoded signed payload of the staking operation.
19
+ attr_accessor :signed_payload
20
+
21
+ # The index in the transaction array of the staking operation.
22
+ attr_accessor :transaction_index
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'signed_payload' => :'signed_payload',
28
+ :'transaction_index' => :'transaction_index'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'signed_payload' => :'String',
41
+ :'transaction_index' => :'Integer'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::BroadcastStakingOperationRequest` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::BroadcastStakingOperationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'signed_payload')
67
+ self.signed_payload = attributes[:'signed_payload']
68
+ else
69
+ self.signed_payload = nil
70
+ end
71
+
72
+ if attributes.key?(:'transaction_index')
73
+ self.transaction_index = attributes[:'transaction_index']
74
+ else
75
+ self.transaction_index = nil
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
83
+ invalid_properties = Array.new
84
+ if @signed_payload.nil?
85
+ invalid_properties.push('invalid value for "signed_payload", signed_payload cannot be nil.')
86
+ end
87
+
88
+ if @transaction_index.nil?
89
+ invalid_properties.push('invalid value for "transaction_index", transaction_index cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
+ return false if @signed_payload.nil?
100
+ return false if @transaction_index.nil?
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ signed_payload == o.signed_payload &&
110
+ transaction_index == o.transaction_index
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [signed_payload, transaction_index].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def self._deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = Coinbase::Client.const_get(type)
187
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end
@@ -0,0 +1,336 @@
1
+ =begin
2
+ #Coinbase Platform API
3
+
4
+ #This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
5
+
6
+ The version of the OpenAPI document: 0.0.1-alpha
7
+ Contact: yuga.cohler@coinbase.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Coinbase::Client
17
+ # Represents a single decoded event emitted by a smart contract
18
+ class ContractEvent
19
+ # The name of the blockchain network
20
+ attr_accessor :network_name
21
+
22
+ # The name of the blockchain project or protocol
23
+ attr_accessor :protocol_name
24
+
25
+ # The name of the specific contract within the project
26
+ attr_accessor :contract_name
27
+
28
+ # The name of the event emitted by the contract
29
+ attr_accessor :event_name
30
+
31
+ # The signature of the event, including parameter types
32
+ attr_accessor :sig
33
+
34
+ # The first four bytes of the Keccak hash of the event signature
35
+ attr_accessor :four_bytes
36
+
37
+ # The EVM address of the smart contract
38
+ attr_accessor :contract_address
39
+
40
+ # The timestamp of the block in which the event was emitted
41
+ attr_accessor :block_time
42
+
43
+ # The block number in which the event was emitted
44
+ attr_accessor :block_height
45
+
46
+ # The transaction hash in which the event was emitted
47
+ attr_accessor :tx_hash
48
+
49
+ # The index of the transaction within the block
50
+ attr_accessor :tx_index
51
+
52
+ # The index of the event within the transaction
53
+ attr_accessor :event_index
54
+
55
+ # The event data in a stringified format
56
+ attr_accessor :data
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'network_name' => :'network_name',
62
+ :'protocol_name' => :'protocol_name',
63
+ :'contract_name' => :'contract_name',
64
+ :'event_name' => :'event_name',
65
+ :'sig' => :'sig',
66
+ :'four_bytes' => :'fourBytes',
67
+ :'contract_address' => :'contract_address',
68
+ :'block_time' => :'block_time',
69
+ :'block_height' => :'block_height',
70
+ :'tx_hash' => :'tx_hash',
71
+ :'tx_index' => :'tx_index',
72
+ :'event_index' => :'event_index',
73
+ :'data' => :'data'
74
+ }
75
+ end
76
+
77
+ # Returns all the JSON keys this model knows about
78
+ def self.acceptable_attributes
79
+ attribute_map.values
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'network_name' => :'String',
86
+ :'protocol_name' => :'String',
87
+ :'contract_name' => :'String',
88
+ :'event_name' => :'String',
89
+ :'sig' => :'String',
90
+ :'four_bytes' => :'String',
91
+ :'contract_address' => :'String',
92
+ :'block_time' => :'Time',
93
+ :'block_height' => :'Integer',
94
+ :'tx_hash' => :'String',
95
+ :'tx_index' => :'Integer',
96
+ :'event_index' => :'Integer',
97
+ :'data' => :'String'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ ])
105
+ end
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ def initialize(attributes = {})
110
+ if (!attributes.is_a?(Hash))
111
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::ContractEvent` initialize method"
112
+ end
113
+
114
+ # check to see if the attribute exists and convert string to symbol for hash key
115
+ attributes = attributes.each_with_object({}) { |(k, v), h|
116
+ if (!self.class.attribute_map.key?(k.to_sym))
117
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::ContractEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
118
+ end
119
+ h[k.to_sym] = v
120
+ }
121
+
122
+ if attributes.key?(:'network_name')
123
+ self.network_name = attributes[:'network_name']
124
+ end
125
+
126
+ if attributes.key?(:'protocol_name')
127
+ self.protocol_name = attributes[:'protocol_name']
128
+ end
129
+
130
+ if attributes.key?(:'contract_name')
131
+ self.contract_name = attributes[:'contract_name']
132
+ end
133
+
134
+ if attributes.key?(:'event_name')
135
+ self.event_name = attributes[:'event_name']
136
+ end
137
+
138
+ if attributes.key?(:'sig')
139
+ self.sig = attributes[:'sig']
140
+ end
141
+
142
+ if attributes.key?(:'four_bytes')
143
+ self.four_bytes = attributes[:'four_bytes']
144
+ end
145
+
146
+ if attributes.key?(:'contract_address')
147
+ self.contract_address = attributes[:'contract_address']
148
+ end
149
+
150
+ if attributes.key?(:'block_time')
151
+ self.block_time = attributes[:'block_time']
152
+ end
153
+
154
+ if attributes.key?(:'block_height')
155
+ self.block_height = attributes[:'block_height']
156
+ end
157
+
158
+ if attributes.key?(:'tx_hash')
159
+ self.tx_hash = attributes[:'tx_hash']
160
+ end
161
+
162
+ if attributes.key?(:'tx_index')
163
+ self.tx_index = attributes[:'tx_index']
164
+ end
165
+
166
+ if attributes.key?(:'event_index')
167
+ self.event_index = attributes[:'event_index']
168
+ end
169
+
170
+ if attributes.key?(:'data')
171
+ self.data = attributes[:'data']
172
+ end
173
+ end
174
+
175
+ # Show invalid properties with the reasons. Usually used together with valid?
176
+ # @return Array for valid properties with the reasons
177
+ def list_invalid_properties
178
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
179
+ invalid_properties = Array.new
180
+ invalid_properties
181
+ end
182
+
183
+ # Check to see if the all the properties in the model are valid
184
+ # @return true if the model is valid
185
+ def valid?
186
+ warn '[DEPRECATED] the `valid?` method is obsolete'
187
+ true
188
+ end
189
+
190
+ # Checks equality by comparing each attribute.
191
+ # @param [Object] Object to be compared
192
+ def ==(o)
193
+ return true if self.equal?(o)
194
+ self.class == o.class &&
195
+ network_name == o.network_name &&
196
+ protocol_name == o.protocol_name &&
197
+ contract_name == o.contract_name &&
198
+ event_name == o.event_name &&
199
+ sig == o.sig &&
200
+ four_bytes == o.four_bytes &&
201
+ contract_address == o.contract_address &&
202
+ block_time == o.block_time &&
203
+ block_height == o.block_height &&
204
+ tx_hash == o.tx_hash &&
205
+ tx_index == o.tx_index &&
206
+ event_index == o.event_index &&
207
+ data == o.data
208
+ end
209
+
210
+ # @see the `==` method
211
+ # @param [Object] Object to be compared
212
+ def eql?(o)
213
+ self == o
214
+ end
215
+
216
+ # Calculates hash code according to all attributes.
217
+ # @return [Integer] Hash code
218
+ def hash
219
+ [network_name, protocol_name, contract_name, event_name, sig, four_bytes, contract_address, block_time, block_height, tx_hash, tx_index, event_index, data].hash
220
+ end
221
+
222
+ # Builds the object from hash
223
+ # @param [Hash] attributes Model attributes in the form of hash
224
+ # @return [Object] Returns the model itself
225
+ def self.build_from_hash(attributes)
226
+ return nil unless attributes.is_a?(Hash)
227
+ attributes = attributes.transform_keys(&:to_sym)
228
+ transformed_hash = {}
229
+ openapi_types.each_pair do |key, type|
230
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
231
+ transformed_hash["#{key}"] = nil
232
+ elsif type =~ /\AArray<(.*)>/i
233
+ # check to ensure the input is an array given that the attribute
234
+ # is documented as an array but the input is not
235
+ if attributes[attribute_map[key]].is_a?(Array)
236
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
237
+ end
238
+ elsif !attributes[attribute_map[key]].nil?
239
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
240
+ end
241
+ end
242
+ new(transformed_hash)
243
+ end
244
+
245
+ # Deserializes the data based on type
246
+ # @param string type Data type
247
+ # @param string value Value to be deserialized
248
+ # @return [Object] Deserialized data
249
+ def self._deserialize(type, value)
250
+ case type.to_sym
251
+ when :Time
252
+ Time.parse(value)
253
+ when :Date
254
+ Date.parse(value)
255
+ when :String
256
+ value.to_s
257
+ when :Integer
258
+ value.to_i
259
+ when :Float
260
+ value.to_f
261
+ when :Boolean
262
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
263
+ true
264
+ else
265
+ false
266
+ end
267
+ when :Object
268
+ # generic object (usually a Hash), return directly
269
+ value
270
+ when /\AArray<(?<inner_type>.+)>\z/
271
+ inner_type = Regexp.last_match[:inner_type]
272
+ value.map { |v| _deserialize(inner_type, v) }
273
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
274
+ k_type = Regexp.last_match[:k_type]
275
+ v_type = Regexp.last_match[:v_type]
276
+ {}.tap do |hash|
277
+ value.each do |k, v|
278
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
279
+ end
280
+ end
281
+ else # model
282
+ # models (e.g. Pet) or oneOf
283
+ klass = Coinbase::Client.const_get(type)
284
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
285
+ end
286
+ end
287
+
288
+ # Returns the string representation of the object
289
+ # @return [String] String presentation of the object
290
+ def to_s
291
+ to_hash.to_s
292
+ end
293
+
294
+ # to_body is an alias to to_hash (backward compatibility)
295
+ # @return [Hash] Returns the object in the form of hash
296
+ def to_body
297
+ to_hash
298
+ end
299
+
300
+ # Returns the object in the form of hash
301
+ # @return [Hash] Returns the object in the form of hash
302
+ def to_hash
303
+ hash = {}
304
+ self.class.attribute_map.each_pair do |attr, param|
305
+ value = self.send(attr)
306
+ if value.nil?
307
+ is_nullable = self.class.openapi_nullable.include?(attr)
308
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
309
+ end
310
+
311
+ hash[param] = _to_hash(value)
312
+ end
313
+ hash
314
+ end
315
+
316
+ # Outputs non-array value in the form of hash
317
+ # For object, use to_hash. Otherwise, just return the value
318
+ # @param [Object] value Any valid value
319
+ # @return [Hash] Returns the value in the form of hash
320
+ def _to_hash(value)
321
+ if value.is_a?(Array)
322
+ value.compact.map { |v| _to_hash(v) }
323
+ elsif value.is_a?(Hash)
324
+ {}.tap do |hash|
325
+ value.each { |k, v| hash[k] = _to_hash(v) }
326
+ end
327
+ elsif value.respond_to? :to_hash
328
+ value.to_hash
329
+ else
330
+ value
331
+ end
332
+ end
333
+
334
+ end
335
+
336
+ end