coinbase-sdk 0.0.16 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/wallet_address.rb +24 -17
  3. data/lib/coinbase/address.rb +17 -19
  4. data/lib/coinbase/asset.rb +11 -8
  5. data/lib/coinbase/client/api/addresses_api.rb +1 -1
  6. data/lib/coinbase/client/api/assets_api.rb +1 -1
  7. data/lib/coinbase/client/api/contract_events_api.rb +18 -10
  8. data/lib/coinbase/client/api/external_addresses_api.rb +1 -1
  9. data/lib/coinbase/client/api/networks_api.rb +1 -1
  10. data/lib/coinbase/client/api/server_signers_api.rb +1 -1
  11. data/lib/coinbase/client/api/stake_api.rb +1 -242
  12. data/lib/coinbase/client/api/trades_api.rb +1 -1
  13. data/lib/coinbase/client/api/transfers_api.rb +1 -1
  14. data/lib/coinbase/client/api/users_api.rb +1 -1
  15. data/lib/coinbase/client/api/validators_api.rb +3 -3
  16. data/lib/coinbase/client/api/wallet_stake_api.rb +263 -0
  17. data/lib/coinbase/client/api/wallets_api.rb +1 -1
  18. data/lib/coinbase/client/api/webhooks_api.rb +1 -1
  19. data/lib/coinbase/client/api_client.rb +1 -1
  20. data/lib/coinbase/client/api_error.rb +1 -1
  21. data/lib/coinbase/client/configuration.rb +11 -1
  22. data/lib/coinbase/client/models/address.rb +22 -5
  23. data/lib/coinbase/client/models/address_balance_list.rb +1 -1
  24. data/lib/coinbase/client/models/address_historical_balance_list.rb +1 -1
  25. data/lib/coinbase/client/models/address_list.rb +1 -1
  26. data/lib/coinbase/client/models/asset.rb +1 -1
  27. data/lib/coinbase/client/models/balance.rb +1 -1
  28. data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +1 -1
  29. data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
  30. data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
  31. data/lib/coinbase/client/models/build_staking_operation_request.rb +1 -1
  32. data/lib/coinbase/client/models/contract_event.rb +100 -9
  33. data/lib/coinbase/client/models/contract_event_list.rb +1 -1
  34. data/lib/coinbase/client/models/create_address_request.rb +15 -5
  35. data/lib/coinbase/client/models/create_server_signer_request.rb +1 -1
  36. data/lib/coinbase/client/models/create_staking_operation_request.rb +1 -1
  37. data/lib/coinbase/client/models/create_trade_request.rb +1 -1
  38. data/lib/coinbase/client/models/create_transfer_request.rb +1 -1
  39. data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
  40. data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
  41. data/lib/coinbase/client/models/create_webhook_request.rb +1 -1
  42. data/lib/coinbase/client/models/error.rb +1 -1
  43. data/lib/coinbase/client/models/ethereum_validator_metadata.rb +12 -12
  44. data/lib/coinbase/client/models/faucet_transaction.rb +1 -1
  45. data/lib/coinbase/client/models/feature.rb +3 -2
  46. data/lib/coinbase/client/models/feature_set.rb +1 -1
  47. data/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +1 -1
  48. data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +1 -1
  49. data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +1 -1
  50. data/lib/coinbase/client/models/get_staking_context_request.rb +1 -1
  51. data/lib/coinbase/client/models/historical_balance.rb +1 -1
  52. data/lib/coinbase/client/models/network.rb +15 -5
  53. data/lib/coinbase/client/models/network_identifier.rb +1 -1
  54. data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
  55. data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
  56. data/lib/coinbase/client/models/server_signer.rb +1 -1
  57. data/lib/coinbase/client/models/server_signer_event.rb +1 -1
  58. data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
  59. data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
  60. data/lib/coinbase/client/models/server_signer_list.rb +1 -1
  61. data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
  62. data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
  63. data/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +1 -1
  64. data/lib/coinbase/client/models/sponsored_send.rb +1 -1
  65. data/lib/coinbase/client/models/staking_balance.rb +1 -1
  66. data/lib/coinbase/client/models/staking_context.rb +1 -1
  67. data/lib/coinbase/client/models/staking_context_context.rb +1 -1
  68. data/lib/coinbase/client/models/staking_operation.rb +3 -3
  69. data/lib/coinbase/client/models/staking_operation_metadata.rb +1 -1
  70. data/lib/coinbase/client/models/staking_reward.rb +1 -1
  71. data/lib/coinbase/client/models/staking_reward_format.rb +1 -1
  72. data/lib/coinbase/client/models/staking_reward_usd_value.rb +1 -1
  73. data/lib/coinbase/client/models/trade.rb +1 -1
  74. data/lib/coinbase/client/models/trade_list.rb +1 -1
  75. data/lib/coinbase/client/models/transaction.rb +16 -6
  76. data/lib/coinbase/client/models/transaction_type.rb +1 -1
  77. data/lib/coinbase/client/models/transfer.rb +1 -1
  78. data/lib/coinbase/client/models/transfer_list.rb +1 -1
  79. data/lib/coinbase/client/models/update_webhook_request.rb +1 -1
  80. data/lib/coinbase/client/models/user.rb +1 -1
  81. data/lib/coinbase/client/models/validator.rb +24 -3
  82. data/lib/coinbase/client/models/validator_details.rb +1 -1
  83. data/lib/coinbase/client/models/validator_list.rb +1 -1
  84. data/lib/coinbase/client/models/validator_status.rb +52 -0
  85. data/lib/coinbase/client/models/wallet.rb +1 -1
  86. data/lib/coinbase/client/models/wallet_list.rb +1 -1
  87. data/lib/coinbase/client/models/webhook.rb +1 -1
  88. data/lib/coinbase/client/models/webhook_event_filter.rb +1 -1
  89. data/lib/coinbase/client/models/webhook_event_type.rb +1 -1
  90. data/lib/coinbase/client/models/webhook_list.rb +1 -1
  91. data/lib/coinbase/client/version.rb +1 -1
  92. data/lib/coinbase/client.rb +3 -1
  93. data/lib/coinbase/constants.rb +0 -10
  94. data/lib/coinbase/contract_event.rb +104 -0
  95. data/lib/coinbase/correlation.rb +30 -0
  96. data/lib/coinbase/destination.rb +11 -9
  97. data/lib/coinbase/errors.rb +7 -0
  98. data/lib/coinbase/middleware.rb +2 -0
  99. data/lib/coinbase/network.rb +103 -20
  100. data/lib/coinbase/smart_contract.rb +106 -0
  101. data/lib/coinbase/staking_balance.rb +11 -5
  102. data/lib/coinbase/staking_operation.rb +134 -36
  103. data/lib/coinbase/staking_reward.rb +1 -1
  104. data/lib/coinbase/trade.rb +10 -9
  105. data/lib/coinbase/transaction.rb +6 -0
  106. data/lib/coinbase/transfer.rb +11 -10
  107. data/lib/coinbase/validator.rb +18 -10
  108. data/lib/coinbase/version.rb +5 -0
  109. data/lib/coinbase/wallet.rb +137 -145
  110. data/lib/coinbase/webhook.rb +181 -0
  111. data/lib/coinbase.rb +50 -19
  112. metadata +9 -9
  113. data/lib/coinbase/client/models/ethereum_validator.rb +0 -374
  114. data/lib/coinbase/client/models/get_validator200_response.rb +0 -221
  115. data/lib/coinbase/client/models/get_validator200_response_validator.rb +0 -214
  116. data/lib/coinbase/client/models/native_eth_staking_context.rb +0 -254
  117. data/lib/coinbase/client/models/partial_eth_staking_context.rb +0 -254
  118. data/lib/coinbase/client/models/validator_list_data.rb +0 -216
  119. data/lib/coinbase/user.rb +0 -65
@@ -1,214 +0,0 @@
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 GetValidator200ResponseValidator
18
- attr_accessor :ethereum_validator
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'ethereum_validator' => :'ethereum_validator'
24
- }
25
- end
26
-
27
- # Returns all the JSON keys this model knows about
28
- def self.acceptable_attributes
29
- attribute_map.values
30
- end
31
-
32
- # Attribute type mapping.
33
- def self.openapi_types
34
- {
35
- :'ethereum_validator' => :'EthereumValidator'
36
- }
37
- end
38
-
39
- # List of attributes with nullable: true
40
- def self.openapi_nullable
41
- Set.new([
42
- ])
43
- end
44
-
45
- # Initializes the object
46
- # @param [Hash] attributes Model attributes in the form of hash
47
- def initialize(attributes = {})
48
- if (!attributes.is_a?(Hash))
49
- fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::GetValidator200ResponseValidator` initialize method"
50
- end
51
-
52
- # check to see if the attribute exists and convert string to symbol for hash key
53
- attributes = attributes.each_with_object({}) { |(k, v), h|
54
- if (!self.class.attribute_map.key?(k.to_sym))
55
- fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::GetValidator200ResponseValidator`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
- end
57
- h[k.to_sym] = v
58
- }
59
-
60
- if attributes.key?(:'ethereum_validator')
61
- self.ethereum_validator = attributes[:'ethereum_validator']
62
- end
63
- end
64
-
65
- # Show invalid properties with the reasons. Usually used together with valid?
66
- # @return Array for valid properties with the reasons
67
- def list_invalid_properties
68
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
69
- invalid_properties = Array.new
70
- invalid_properties
71
- end
72
-
73
- # Check to see if the all the properties in the model are valid
74
- # @return true if the model is valid
75
- def valid?
76
- warn '[DEPRECATED] the `valid?` method is obsolete'
77
- true
78
- end
79
-
80
- # Checks equality by comparing each attribute.
81
- # @param [Object] Object to be compared
82
- def ==(o)
83
- return true if self.equal?(o)
84
- self.class == o.class &&
85
- ethereum_validator == o.ethereum_validator
86
- end
87
-
88
- # @see the `==` method
89
- # @param [Object] Object to be compared
90
- def eql?(o)
91
- self == o
92
- end
93
-
94
- # Calculates hash code according to all attributes.
95
- # @return [Integer] Hash code
96
- def hash
97
- [ethereum_validator].hash
98
- end
99
-
100
- # Builds the object from hash
101
- # @param [Hash] attributes Model attributes in the form of hash
102
- # @return [Object] Returns the model itself
103
- def self.build_from_hash(attributes)
104
- return nil unless attributes.is_a?(Hash)
105
- attributes = attributes.transform_keys(&:to_sym)
106
- transformed_hash = {}
107
- openapi_types.each_pair do |key, type|
108
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
109
- transformed_hash["#{key}"] = nil
110
- elsif type =~ /\AArray<(.*)>/i
111
- # check to ensure the input is an array given that the attribute
112
- # is documented as an array but the input is not
113
- if attributes[attribute_map[key]].is_a?(Array)
114
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
115
- end
116
- elsif !attributes[attribute_map[key]].nil?
117
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
118
- end
119
- end
120
- new(transformed_hash)
121
- end
122
-
123
- # Deserializes the data based on type
124
- # @param string type Data type
125
- # @param string value Value to be deserialized
126
- # @return [Object] Deserialized data
127
- def self._deserialize(type, value)
128
- case type.to_sym
129
- when :Time
130
- Time.parse(value)
131
- when :Date
132
- Date.parse(value)
133
- when :String
134
- value.to_s
135
- when :Integer
136
- value.to_i
137
- when :Float
138
- value.to_f
139
- when :Boolean
140
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
- true
142
- else
143
- false
144
- end
145
- when :Object
146
- # generic object (usually a Hash), return directly
147
- value
148
- when /\AArray<(?<inner_type>.+)>\z/
149
- inner_type = Regexp.last_match[:inner_type]
150
- value.map { |v| _deserialize(inner_type, v) }
151
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
- k_type = Regexp.last_match[:k_type]
153
- v_type = Regexp.last_match[:v_type]
154
- {}.tap do |hash|
155
- value.each do |k, v|
156
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
- end
158
- end
159
- else # model
160
- # models (e.g. Pet) or oneOf
161
- klass = Coinbase::Client.const_get(type)
162
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
163
- end
164
- end
165
-
166
- # Returns the string representation of the object
167
- # @return [String] String presentation of the object
168
- def to_s
169
- to_hash.to_s
170
- end
171
-
172
- # to_body is an alias to to_hash (backward compatibility)
173
- # @return [Hash] Returns the object in the form of hash
174
- def to_body
175
- to_hash
176
- end
177
-
178
- # Returns the object in the form of hash
179
- # @return [Hash] Returns the object in the form of hash
180
- def to_hash
181
- hash = {}
182
- self.class.attribute_map.each_pair do |attr, param|
183
- value = self.send(attr)
184
- if value.nil?
185
- is_nullable = self.class.openapi_nullable.include?(attr)
186
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
- end
188
-
189
- hash[param] = _to_hash(value)
190
- end
191
- hash
192
- end
193
-
194
- # Outputs non-array value in the form of hash
195
- # For object, use to_hash. Otherwise, just return the value
196
- # @param [Object] value Any valid value
197
- # @return [Hash] Returns the value in the form of hash
198
- def _to_hash(value)
199
- if value.is_a?(Array)
200
- value.compact.map { |v| _to_hash(v) }
201
- elsif value.is_a?(Hash)
202
- {}.tap do |hash|
203
- value.each { |k, v| hash[k] = _to_hash(v) }
204
- end
205
- elsif value.respond_to? :to_hash
206
- value.to_hash
207
- else
208
- value
209
- end
210
- end
211
-
212
- end
213
-
214
- end
@@ -1,254 +0,0 @@
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
- # The native eth staking context.
18
- class NativeEthStakingContext
19
- attr_accessor :stakeable_balance
20
-
21
- attr_accessor :unstakeable_balance
22
-
23
- attr_accessor :claimable_balance
24
-
25
- # Attribute mapping from ruby-style variable name to JSON key.
26
- def self.attribute_map
27
- {
28
- :'stakeable_balance' => :'stakeable_balance',
29
- :'unstakeable_balance' => :'unstakeable_balance',
30
- :'claimable_balance' => :'claimable_balance'
31
- }
32
- end
33
-
34
- # Returns all the JSON keys this model knows about
35
- def self.acceptable_attributes
36
- attribute_map.values
37
- end
38
-
39
- # Attribute type mapping.
40
- def self.openapi_types
41
- {
42
- :'stakeable_balance' => :'Balance',
43
- :'unstakeable_balance' => :'Balance',
44
- :'claimable_balance' => :'Balance'
45
- }
46
- end
47
-
48
- # List of attributes with nullable: true
49
- def self.openapi_nullable
50
- Set.new([
51
- ])
52
- end
53
-
54
- # Initializes the object
55
- # @param [Hash] attributes Model attributes in the form of hash
56
- def initialize(attributes = {})
57
- if (!attributes.is_a?(Hash))
58
- fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::NativeEthStakingContext` initialize method"
59
- end
60
-
61
- # check to see if the attribute exists and convert string to symbol for hash key
62
- attributes = attributes.each_with_object({}) { |(k, v), h|
63
- if (!self.class.attribute_map.key?(k.to_sym))
64
- fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::NativeEthStakingContext`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
- end
66
- h[k.to_sym] = v
67
- }
68
-
69
- if attributes.key?(:'stakeable_balance')
70
- self.stakeable_balance = attributes[:'stakeable_balance']
71
- else
72
- self.stakeable_balance = nil
73
- end
74
-
75
- if attributes.key?(:'unstakeable_balance')
76
- self.unstakeable_balance = attributes[:'unstakeable_balance']
77
- else
78
- self.unstakeable_balance = nil
79
- end
80
-
81
- if attributes.key?(:'claimable_balance')
82
- self.claimable_balance = attributes[:'claimable_balance']
83
- else
84
- self.claimable_balance = nil
85
- end
86
- end
87
-
88
- # Show invalid properties with the reasons. Usually used together with valid?
89
- # @return Array for valid properties with the reasons
90
- def list_invalid_properties
91
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
92
- invalid_properties = Array.new
93
- if @stakeable_balance.nil?
94
- invalid_properties.push('invalid value for "stakeable_balance", stakeable_balance cannot be nil.')
95
- end
96
-
97
- if @unstakeable_balance.nil?
98
- invalid_properties.push('invalid value for "unstakeable_balance", unstakeable_balance cannot be nil.')
99
- end
100
-
101
- if @claimable_balance.nil?
102
- invalid_properties.push('invalid value for "claimable_balance", claimable_balance cannot be nil.')
103
- end
104
-
105
- invalid_properties
106
- end
107
-
108
- # Check to see if the all the properties in the model are valid
109
- # @return true if the model is valid
110
- def valid?
111
- warn '[DEPRECATED] the `valid?` method is obsolete'
112
- return false if @stakeable_balance.nil?
113
- return false if @unstakeable_balance.nil?
114
- return false if @claimable_balance.nil?
115
- true
116
- end
117
-
118
- # Checks equality by comparing each attribute.
119
- # @param [Object] Object to be compared
120
- def ==(o)
121
- return true if self.equal?(o)
122
- self.class == o.class &&
123
- stakeable_balance == o.stakeable_balance &&
124
- unstakeable_balance == o.unstakeable_balance &&
125
- claimable_balance == o.claimable_balance
126
- end
127
-
128
- # @see the `==` method
129
- # @param [Object] Object to be compared
130
- def eql?(o)
131
- self == o
132
- end
133
-
134
- # Calculates hash code according to all attributes.
135
- # @return [Integer] Hash code
136
- def hash
137
- [stakeable_balance, unstakeable_balance, claimable_balance].hash
138
- end
139
-
140
- # Builds the object from hash
141
- # @param [Hash] attributes Model attributes in the form of hash
142
- # @return [Object] Returns the model itself
143
- def self.build_from_hash(attributes)
144
- return nil unless attributes.is_a?(Hash)
145
- attributes = attributes.transform_keys(&:to_sym)
146
- transformed_hash = {}
147
- openapi_types.each_pair do |key, type|
148
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
149
- transformed_hash["#{key}"] = nil
150
- elsif type =~ /\AArray<(.*)>/i
151
- # check to ensure the input is an array given that the attribute
152
- # is documented as an array but the input is not
153
- if attributes[attribute_map[key]].is_a?(Array)
154
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
155
- end
156
- elsif !attributes[attribute_map[key]].nil?
157
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
158
- end
159
- end
160
- new(transformed_hash)
161
- end
162
-
163
- # Deserializes the data based on type
164
- # @param string type Data type
165
- # @param string value Value to be deserialized
166
- # @return [Object] Deserialized data
167
- def self._deserialize(type, value)
168
- case type.to_sym
169
- when :Time
170
- Time.parse(value)
171
- when :Date
172
- Date.parse(value)
173
- when :String
174
- value.to_s
175
- when :Integer
176
- value.to_i
177
- when :Float
178
- value.to_f
179
- when :Boolean
180
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
- true
182
- else
183
- false
184
- end
185
- when :Object
186
- # generic object (usually a Hash), return directly
187
- value
188
- when /\AArray<(?<inner_type>.+)>\z/
189
- inner_type = Regexp.last_match[:inner_type]
190
- value.map { |v| _deserialize(inner_type, v) }
191
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
- k_type = Regexp.last_match[:k_type]
193
- v_type = Regexp.last_match[:v_type]
194
- {}.tap do |hash|
195
- value.each do |k, v|
196
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
- end
198
- end
199
- else # model
200
- # models (e.g. Pet) or oneOf
201
- klass = Coinbase::Client.const_get(type)
202
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
203
- end
204
- end
205
-
206
- # Returns the string representation of the object
207
- # @return [String] String presentation of the object
208
- def to_s
209
- to_hash.to_s
210
- end
211
-
212
- # to_body is an alias to to_hash (backward compatibility)
213
- # @return [Hash] Returns the object in the form of hash
214
- def to_body
215
- to_hash
216
- end
217
-
218
- # Returns the object in the form of hash
219
- # @return [Hash] Returns the object in the form of hash
220
- def to_hash
221
- hash = {}
222
- self.class.attribute_map.each_pair do |attr, param|
223
- value = self.send(attr)
224
- if value.nil?
225
- is_nullable = self.class.openapi_nullable.include?(attr)
226
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
- end
228
-
229
- hash[param] = _to_hash(value)
230
- end
231
- hash
232
- end
233
-
234
- # Outputs non-array value in the form of hash
235
- # For object, use to_hash. Otherwise, just return the value
236
- # @param [Object] value Any valid value
237
- # @return [Hash] Returns the value in the form of hash
238
- def _to_hash(value)
239
- if value.is_a?(Array)
240
- value.compact.map { |v| _to_hash(v) }
241
- elsif value.is_a?(Hash)
242
- {}.tap do |hash|
243
- value.each { |k, v| hash[k] = _to_hash(v) }
244
- end
245
- elsif value.respond_to? :to_hash
246
- value.to_hash
247
- else
248
- value
249
- end
250
- end
251
-
252
- end
253
-
254
- end