coinbase-sdk 0.6.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/wallet_address.rb +44 -0
  3. data/lib/coinbase/address.rb +13 -4
  4. data/lib/coinbase/client/api/external_addresses_api.rb +26 -27
  5. data/lib/coinbase/client/api/fund_api.rb +336 -0
  6. data/lib/coinbase/client/api/onchain_identity_api.rb +108 -0
  7. data/lib/coinbase/client/api/smart_contracts_api.rb +80 -0
  8. data/lib/coinbase/client/api/transaction_history_api.rb +101 -0
  9. data/lib/coinbase/client/api/webhooks_api.rb +70 -0
  10. data/lib/coinbase/client/models/create_fund_operation_request.rb +249 -0
  11. data/lib/coinbase/client/models/create_fund_quote_request.rb +239 -0
  12. data/lib/coinbase/client/models/create_wallet_webhook_request.rb +232 -0
  13. data/lib/coinbase/client/models/crypto_amount.rb +239 -0
  14. data/lib/coinbase/client/models/ethereum_token_transfer.rb +327 -0
  15. data/lib/coinbase/client/models/ethereum_transaction.rb +12 -1
  16. data/lib/coinbase/client/models/faucet_transaction.rb +20 -4
  17. data/lib/coinbase/client/models/fiat_amount.rb +240 -0
  18. data/lib/coinbase/client/models/fund_operation.rb +373 -0
  19. data/lib/coinbase/client/models/fund_operation_fees.rb +238 -0
  20. data/lib/coinbase/client/models/fund_operation_list.rb +275 -0
  21. data/lib/coinbase/client/models/fund_quote.rb +339 -0
  22. data/lib/coinbase/client/models/multi_token_contract_options.rb +223 -0
  23. data/lib/coinbase/client/models/network_identifier.rb +2 -1
  24. data/lib/coinbase/client/models/nft_contract_options.rb +21 -4
  25. data/lib/coinbase/client/models/onchain_name.rb +357 -0
  26. data/lib/coinbase/client/models/onchain_name_list.rb +262 -0
  27. data/lib/coinbase/client/models/read_contract_request.rb +249 -0
  28. data/lib/coinbase/client/models/smart_contract_options.rb +1 -0
  29. data/lib/coinbase/client/models/smart_contract_type.rb +2 -1
  30. data/lib/coinbase/client/models/solidity_value.rb +287 -0
  31. data/lib/coinbase/client/models/{feature.rb → token_transfer_type.rb} +10 -10
  32. data/lib/coinbase/client/models/update_webhook_request.rb +0 -7
  33. data/lib/coinbase/client.rb +19 -0
  34. data/lib/coinbase/faucet_transaction.rb +64 -4
  35. data/lib/coinbase/smart_contract.rb +149 -0
  36. data/lib/coinbase/transaction.rb +8 -2
  37. data/lib/coinbase/version.rb +1 -1
  38. data/lib/coinbase/wallet.rb +35 -1
  39. data/lib/coinbase/webhook.rb +3 -7
  40. metadata +21 -3
@@ -0,0 +1,275 @@
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
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Coinbase::Client
17
+ # Paginated list of fund operations
18
+ class FundOperationList
19
+ attr_accessor :data
20
+
21
+ # True if this list has another page of items after this one that can be fetched.
22
+ attr_accessor :has_more
23
+
24
+ # The page token to be used to fetch the next page.
25
+ attr_accessor :next_page
26
+
27
+ # The total number of fund operations
28
+ attr_accessor :total_count
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'data' => :'data',
34
+ :'has_more' => :'has_more',
35
+ :'next_page' => :'next_page',
36
+ :'total_count' => :'total_count'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'data' => :'Array<FundOperation>',
49
+ :'has_more' => :'Boolean',
50
+ :'next_page' => :'String',
51
+ :'total_count' => :'Integer'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::FundOperationList` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::FundOperationList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'data')
77
+ if (value = attributes[:'data']).is_a?(Array)
78
+ self.data = value
79
+ end
80
+ else
81
+ self.data = nil
82
+ end
83
+
84
+ if attributes.key?(:'has_more')
85
+ self.has_more = attributes[:'has_more']
86
+ else
87
+ self.has_more = nil
88
+ end
89
+
90
+ if attributes.key?(:'next_page')
91
+ self.next_page = attributes[:'next_page']
92
+ else
93
+ self.next_page = nil
94
+ end
95
+
96
+ if attributes.key?(:'total_count')
97
+ self.total_count = attributes[:'total_count']
98
+ else
99
+ self.total_count = nil
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
107
+ invalid_properties = Array.new
108
+ if @data.nil?
109
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
110
+ end
111
+
112
+ if @has_more.nil?
113
+ invalid_properties.push('invalid value for "has_more", has_more cannot be nil.')
114
+ end
115
+
116
+ if @next_page.nil?
117
+ invalid_properties.push('invalid value for "next_page", next_page cannot be nil.')
118
+ end
119
+
120
+ if @total_count.nil?
121
+ invalid_properties.push('invalid value for "total_count", total_count cannot be nil.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
131
+ return false if @data.nil?
132
+ return false if @has_more.nil?
133
+ return false if @next_page.nil?
134
+ return false if @total_count.nil?
135
+ true
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ data == o.data &&
144
+ has_more == o.has_more &&
145
+ next_page == o.next_page &&
146
+ total_count == o.total_count
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Integer] Hash code
157
+ def hash
158
+ [data, has_more, next_page, total_count].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def self.build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ attributes = attributes.transform_keys(&:to_sym)
167
+ transformed_hash = {}
168
+ openapi_types.each_pair do |key, type|
169
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
170
+ transformed_hash["#{key}"] = nil
171
+ elsif type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[attribute_map[key]].is_a?(Array)
175
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
176
+ end
177
+ elsif !attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
179
+ end
180
+ end
181
+ new(transformed_hash)
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def self._deserialize(type, value)
189
+ case type.to_sym
190
+ when :Time
191
+ Time.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :Boolean
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ # models (e.g. Pet) or oneOf
222
+ klass = Coinbase::Client.const_get(type)
223
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
+ end
225
+ end
226
+
227
+ # Returns the string representation of the object
228
+ # @return [String] String presentation of the object
229
+ def to_s
230
+ to_hash.to_s
231
+ end
232
+
233
+ # to_body is an alias to to_hash (backward compatibility)
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_body
236
+ to_hash
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+
273
+ end
274
+
275
+ end
@@ -0,0 +1,339 @@
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
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Coinbase::Client
17
+ # A quote for a fund operation
18
+ class FundQuote
19
+ # The ID of the fund quote
20
+ attr_accessor :fund_quote_id
21
+
22
+ # The ID of the blockchain network
23
+ attr_accessor :network_id
24
+
25
+ # The ID of the wallet that will receive the crypto
26
+ attr_accessor :wallet_id
27
+
28
+ # The ID of the address that will receive the crypto
29
+ attr_accessor :address_id
30
+
31
+ attr_accessor :crypto_amount
32
+
33
+ attr_accessor :fiat_amount
34
+
35
+ # The time at which the quote expires
36
+ attr_accessor :expires_at
37
+
38
+ attr_accessor :fees
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'fund_quote_id' => :'fund_quote_id',
44
+ :'network_id' => :'network_id',
45
+ :'wallet_id' => :'wallet_id',
46
+ :'address_id' => :'address_id',
47
+ :'crypto_amount' => :'crypto_amount',
48
+ :'fiat_amount' => :'fiat_amount',
49
+ :'expires_at' => :'expires_at',
50
+ :'fees' => :'fees'
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
+ :'fund_quote_id' => :'String',
63
+ :'network_id' => :'String',
64
+ :'wallet_id' => :'String',
65
+ :'address_id' => :'String',
66
+ :'crypto_amount' => :'CryptoAmount',
67
+ :'fiat_amount' => :'FiatAmount',
68
+ :'expires_at' => :'Time',
69
+ :'fees' => :'FundOperationFees'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::FundQuote` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::FundQuote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'fund_quote_id')
95
+ self.fund_quote_id = attributes[:'fund_quote_id']
96
+ else
97
+ self.fund_quote_id = nil
98
+ end
99
+
100
+ if attributes.key?(:'network_id')
101
+ self.network_id = attributes[:'network_id']
102
+ else
103
+ self.network_id = nil
104
+ end
105
+
106
+ if attributes.key?(:'wallet_id')
107
+ self.wallet_id = attributes[:'wallet_id']
108
+ else
109
+ self.wallet_id = nil
110
+ end
111
+
112
+ if attributes.key?(:'address_id')
113
+ self.address_id = attributes[:'address_id']
114
+ else
115
+ self.address_id = nil
116
+ end
117
+
118
+ if attributes.key?(:'crypto_amount')
119
+ self.crypto_amount = attributes[:'crypto_amount']
120
+ else
121
+ self.crypto_amount = nil
122
+ end
123
+
124
+ if attributes.key?(:'fiat_amount')
125
+ self.fiat_amount = attributes[:'fiat_amount']
126
+ else
127
+ self.fiat_amount = nil
128
+ end
129
+
130
+ if attributes.key?(:'expires_at')
131
+ self.expires_at = attributes[:'expires_at']
132
+ else
133
+ self.expires_at = nil
134
+ end
135
+
136
+ if attributes.key?(:'fees')
137
+ self.fees = attributes[:'fees']
138
+ else
139
+ self.fees = nil
140
+ end
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
147
+ invalid_properties = Array.new
148
+ if @fund_quote_id.nil?
149
+ invalid_properties.push('invalid value for "fund_quote_id", fund_quote_id cannot be nil.')
150
+ end
151
+
152
+ if @network_id.nil?
153
+ invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
154
+ end
155
+
156
+ if @wallet_id.nil?
157
+ invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.')
158
+ end
159
+
160
+ if @address_id.nil?
161
+ invalid_properties.push('invalid value for "address_id", address_id cannot be nil.')
162
+ end
163
+
164
+ if @crypto_amount.nil?
165
+ invalid_properties.push('invalid value for "crypto_amount", crypto_amount cannot be nil.')
166
+ end
167
+
168
+ if @fiat_amount.nil?
169
+ invalid_properties.push('invalid value for "fiat_amount", fiat_amount cannot be nil.')
170
+ end
171
+
172
+ if @expires_at.nil?
173
+ invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
174
+ end
175
+
176
+ if @fees.nil?
177
+ invalid_properties.push('invalid value for "fees", fees cannot be nil.')
178
+ end
179
+
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
+ return false if @fund_quote_id.nil?
188
+ return false if @network_id.nil?
189
+ return false if @wallet_id.nil?
190
+ return false if @address_id.nil?
191
+ return false if @crypto_amount.nil?
192
+ return false if @fiat_amount.nil?
193
+ return false if @expires_at.nil?
194
+ return false if @fees.nil?
195
+ true
196
+ end
197
+
198
+ # Checks equality by comparing each attribute.
199
+ # @param [Object] Object to be compared
200
+ def ==(o)
201
+ return true if self.equal?(o)
202
+ self.class == o.class &&
203
+ fund_quote_id == o.fund_quote_id &&
204
+ network_id == o.network_id &&
205
+ wallet_id == o.wallet_id &&
206
+ address_id == o.address_id &&
207
+ crypto_amount == o.crypto_amount &&
208
+ fiat_amount == o.fiat_amount &&
209
+ expires_at == o.expires_at &&
210
+ fees == o.fees
211
+ end
212
+
213
+ # @see the `==` method
214
+ # @param [Object] Object to be compared
215
+ def eql?(o)
216
+ self == o
217
+ end
218
+
219
+ # Calculates hash code according to all attributes.
220
+ # @return [Integer] Hash code
221
+ def hash
222
+ [fund_quote_id, network_id, wallet_id, address_id, crypto_amount, fiat_amount, expires_at, fees].hash
223
+ end
224
+
225
+ # Builds the object from hash
226
+ # @param [Hash] attributes Model attributes in the form of hash
227
+ # @return [Object] Returns the model itself
228
+ def self.build_from_hash(attributes)
229
+ return nil unless attributes.is_a?(Hash)
230
+ attributes = attributes.transform_keys(&:to_sym)
231
+ transformed_hash = {}
232
+ openapi_types.each_pair do |key, type|
233
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
234
+ transformed_hash["#{key}"] = nil
235
+ elsif type =~ /\AArray<(.*)>/i
236
+ # check to ensure the input is an array given that the attribute
237
+ # is documented as an array but the input is not
238
+ if attributes[attribute_map[key]].is_a?(Array)
239
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
240
+ end
241
+ elsif !attributes[attribute_map[key]].nil?
242
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
243
+ end
244
+ end
245
+ new(transformed_hash)
246
+ end
247
+
248
+ # Deserializes the data based on type
249
+ # @param string type Data type
250
+ # @param string value Value to be deserialized
251
+ # @return [Object] Deserialized data
252
+ def self._deserialize(type, value)
253
+ case type.to_sym
254
+ when :Time
255
+ Time.parse(value)
256
+ when :Date
257
+ Date.parse(value)
258
+ when :String
259
+ value.to_s
260
+ when :Integer
261
+ value.to_i
262
+ when :Float
263
+ value.to_f
264
+ when :Boolean
265
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
266
+ true
267
+ else
268
+ false
269
+ end
270
+ when :Object
271
+ # generic object (usually a Hash), return directly
272
+ value
273
+ when /\AArray<(?<inner_type>.+)>\z/
274
+ inner_type = Regexp.last_match[:inner_type]
275
+ value.map { |v| _deserialize(inner_type, v) }
276
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
277
+ k_type = Regexp.last_match[:k_type]
278
+ v_type = Regexp.last_match[:v_type]
279
+ {}.tap do |hash|
280
+ value.each do |k, v|
281
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
282
+ end
283
+ end
284
+ else # model
285
+ # models (e.g. Pet) or oneOf
286
+ klass = Coinbase::Client.const_get(type)
287
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
288
+ end
289
+ end
290
+
291
+ # Returns the string representation of the object
292
+ # @return [String] String presentation of the object
293
+ def to_s
294
+ to_hash.to_s
295
+ end
296
+
297
+ # to_body is an alias to to_hash (backward compatibility)
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_body
300
+ to_hash
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ if value.nil?
310
+ is_nullable = self.class.openapi_nullable.include?(attr)
311
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
+ end
313
+
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ # Outputs non-array value in the form of hash
320
+ # For object, use to_hash. Otherwise, just return the value
321
+ # @param [Object] value Any valid value
322
+ # @return [Hash] Returns the value in the form of hash
323
+ def _to_hash(value)
324
+ if value.is_a?(Array)
325
+ value.compact.map { |v| _to_hash(v) }
326
+ elsif value.is_a?(Hash)
327
+ {}.tap do |hash|
328
+ value.each { |k, v| hash[k] = _to_hash(v) }
329
+ end
330
+ elsif value.respond_to? :to_hash
331
+ value.to_hash
332
+ else
333
+ value
334
+ end
335
+ end
336
+
337
+ end
338
+
339
+ end