coinbase-sdk 0.10.0 → 0.11.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.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/wallet_address.rb +28 -0
  3. data/lib/coinbase/balance.rb +1 -1
  4. data/lib/coinbase/client/api/addresses_api.rb +1 -1
  5. data/lib/coinbase/client/api/assets_api.rb +1 -1
  6. data/lib/coinbase/client/api/balance_history_api.rb +1 -1
  7. data/lib/coinbase/client/api/contract_events_api.rb +1 -1
  8. data/lib/coinbase/client/api/contract_invocations_api.rb +1 -1
  9. data/lib/coinbase/client/api/external_addresses_api.rb +1 -1
  10. data/lib/coinbase/client/api/fund_api.rb +1 -1
  11. data/lib/coinbase/client/api/{wallet_stake_api.rb → mpc_wallet_stake_api.rb} +21 -21
  12. data/lib/coinbase/client/api/networks_api.rb +1 -1
  13. data/lib/coinbase/client/api/onchain_identity_api.rb +1 -1
  14. data/lib/coinbase/client/api/reputation_api.rb +160 -0
  15. data/lib/coinbase/client/api/server_signers_api.rb +1 -1
  16. data/lib/coinbase/client/api/smart_contracts_api.rb +1 -1
  17. data/lib/coinbase/client/api/stake_api.rb +158 -1
  18. data/lib/coinbase/client/api/trades_api.rb +1 -1
  19. data/lib/coinbase/client/api/transaction_history_api.rb +1 -1
  20. data/lib/coinbase/client/api/transfers_api.rb +1 -1
  21. data/lib/coinbase/client/api/users_api.rb +1 -1
  22. data/lib/coinbase/client/api/wallets_api.rb +1 -1
  23. data/lib/coinbase/client/api/webhooks_api.rb +1 -1
  24. data/lib/coinbase/client/api_client.rb +1 -1
  25. data/lib/coinbase/client/api_error.rb +1 -1
  26. data/lib/coinbase/client/configuration.rb +1 -1
  27. data/lib/coinbase/client/models/address.rb +1 -1
  28. data/lib/coinbase/client/models/address_balance_list.rb +1 -1
  29. data/lib/coinbase/client/models/address_historical_balance_list.rb +1 -1
  30. data/lib/coinbase/client/models/address_list.rb +1 -1
  31. data/lib/coinbase/client/models/address_reputation.rb +232 -0
  32. data/lib/coinbase/client/models/address_reputation_metadata.rb +376 -0
  33. data/lib/coinbase/client/models/address_risk.rb +223 -0
  34. data/lib/coinbase/client/models/address_transaction_list.rb +1 -1
  35. data/lib/coinbase/client/models/asset.rb +1 -1
  36. data/lib/coinbase/client/models/balance.rb +1 -1
  37. data/lib/coinbase/client/models/broadcast_contract_invocation_request.rb +1 -1
  38. data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +1 -1
  39. data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
  40. data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
  41. data/lib/coinbase/client/models/build_staking_operation_request.rb +2 -1
  42. data/lib/coinbase/client/models/contract_event.rb +1 -1
  43. data/lib/coinbase/client/models/contract_event_list.rb +1 -1
  44. data/lib/coinbase/client/models/contract_invocation.rb +1 -1
  45. data/lib/coinbase/client/models/contract_invocation_list.rb +1 -1
  46. data/lib/coinbase/client/models/create_address_request.rb +1 -1
  47. data/lib/coinbase/client/models/create_contract_invocation_request.rb +1 -1
  48. data/lib/coinbase/client/models/create_fund_operation_request.rb +1 -1
  49. data/lib/coinbase/client/models/create_fund_quote_request.rb +1 -1
  50. data/lib/coinbase/client/models/create_payload_signature_request.rb +1 -1
  51. data/lib/coinbase/client/models/create_server_signer_request.rb +1 -1
  52. data/lib/coinbase/client/models/create_smart_contract_request.rb +1 -1
  53. data/lib/coinbase/client/models/create_staking_operation_request.rb +2 -1
  54. data/lib/coinbase/client/models/create_trade_request.rb +1 -1
  55. data/lib/coinbase/client/models/create_transfer_request.rb +1 -1
  56. data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
  57. data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
  58. data/lib/coinbase/client/models/create_wallet_webhook_request.rb +1 -1
  59. data/lib/coinbase/client/models/create_webhook_request.rb +1 -1
  60. data/lib/coinbase/client/models/crypto_amount.rb +1 -1
  61. data/lib/coinbase/client/models/deploy_smart_contract_request.rb +1 -1
  62. data/lib/coinbase/client/models/erc20_transfer_event.rb +1 -1
  63. data/lib/coinbase/client/models/erc721_transfer_event.rb +1 -1
  64. data/lib/coinbase/client/models/error.rb +1 -1
  65. data/lib/coinbase/client/models/ethereum_token_transfer.rb +1 -1
  66. data/lib/coinbase/client/models/ethereum_transaction.rb +1 -1
  67. data/lib/coinbase/client/models/ethereum_transaction_access.rb +1 -1
  68. data/lib/coinbase/client/models/ethereum_transaction_access_list.rb +1 -1
  69. data/lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb +1 -1
  70. data/lib/coinbase/client/models/ethereum_validator_metadata.rb +1 -1
  71. data/lib/coinbase/client/models/faucet_transaction.rb +1 -1
  72. data/lib/coinbase/client/models/feature_set.rb +1 -1
  73. data/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +1 -1
  74. data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +1 -1
  75. data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +1 -1
  76. data/lib/coinbase/client/models/fiat_amount.rb +1 -1
  77. data/lib/coinbase/client/models/fund_operation.rb +1 -1
  78. data/lib/coinbase/client/models/fund_operation_fees.rb +1 -1
  79. data/lib/coinbase/client/models/fund_operation_list.rb +1 -1
  80. data/lib/coinbase/client/models/fund_quote.rb +1 -1
  81. data/lib/coinbase/client/models/get_staking_context_request.rb +2 -1
  82. data/lib/coinbase/client/models/historical_balance.rb +1 -1
  83. data/lib/coinbase/client/models/multi_token_contract_options.rb +1 -1
  84. data/lib/coinbase/client/models/network.rb +1 -1
  85. data/lib/coinbase/client/models/network_identifier.rb +1 -1
  86. data/lib/coinbase/client/models/nft_contract_options.rb +1 -1
  87. data/lib/coinbase/client/models/onchain_name.rb +1 -1
  88. data/lib/coinbase/client/models/onchain_name_list.rb +1 -1
  89. data/lib/coinbase/client/models/payload_signature.rb +1 -1
  90. data/lib/coinbase/client/models/payload_signature_list.rb +1 -1
  91. data/lib/coinbase/client/models/read_contract_request.rb +1 -1
  92. data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
  93. data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
  94. data/lib/coinbase/client/models/server_signer.rb +1 -1
  95. data/lib/coinbase/client/models/server_signer_event.rb +1 -1
  96. data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
  97. data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
  98. data/lib/coinbase/client/models/server_signer_list.rb +1 -1
  99. data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
  100. data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
  101. data/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +1 -1
  102. data/lib/coinbase/client/models/smart_contract.rb +1 -1
  103. data/lib/coinbase/client/models/smart_contract_list.rb +1 -1
  104. data/lib/coinbase/client/models/smart_contract_options.rb +1 -1
  105. data/lib/coinbase/client/models/smart_contract_type.rb +1 -1
  106. data/lib/coinbase/client/models/solidity_value.rb +3 -3
  107. data/lib/coinbase/client/models/sponsored_send.rb +1 -1
  108. data/lib/coinbase/client/models/staking_balance.rb +1 -1
  109. data/lib/coinbase/client/models/staking_context.rb +1 -1
  110. data/lib/coinbase/client/models/staking_context_context.rb +1 -1
  111. data/lib/coinbase/client/models/staking_operation.rb +1 -1
  112. data/lib/coinbase/client/models/staking_operation_metadata.rb +1 -1
  113. data/lib/coinbase/client/models/staking_reward.rb +1 -1
  114. data/lib/coinbase/client/models/staking_reward_format.rb +1 -1
  115. data/lib/coinbase/client/models/staking_reward_usd_value.rb +1 -1
  116. data/lib/coinbase/client/models/token_contract_options.rb +1 -1
  117. data/lib/coinbase/client/models/token_transfer_type.rb +1 -1
  118. data/lib/coinbase/client/models/trade.rb +1 -1
  119. data/lib/coinbase/client/models/trade_list.rb +1 -1
  120. data/lib/coinbase/client/models/transaction.rb +1 -1
  121. data/lib/coinbase/client/models/transaction_content.rb +1 -1
  122. data/lib/coinbase/client/models/transaction_type.rb +1 -1
  123. data/lib/coinbase/client/models/transfer.rb +1 -1
  124. data/lib/coinbase/client/models/transfer_list.rb +1 -1
  125. data/lib/coinbase/client/models/update_webhook_request.rb +1 -1
  126. data/lib/coinbase/client/models/user.rb +1 -1
  127. data/lib/coinbase/client/models/validator.rb +1 -1
  128. data/lib/coinbase/client/models/validator_details.rb +1 -1
  129. data/lib/coinbase/client/models/validator_list.rb +1 -1
  130. data/lib/coinbase/client/models/validator_status.rb +1 -1
  131. data/lib/coinbase/client/models/wallet.rb +1 -1
  132. data/lib/coinbase/client/models/wallet_list.rb +1 -1
  133. data/lib/coinbase/client/models/webhook.rb +1 -1
  134. data/lib/coinbase/client/models/webhook_event_filter.rb +1 -1
  135. data/lib/coinbase/client/models/webhook_event_type.rb +1 -1
  136. data/lib/coinbase/client/models/webhook_event_type_filter.rb +1 -1
  137. data/lib/coinbase/client/models/webhook_list.rb +1 -1
  138. data/lib/coinbase/client/models/webhook_wallet_activity_filter.rb +1 -1
  139. data/lib/coinbase/client/version.rb +1 -1
  140. data/lib/coinbase/client.rb +6 -3
  141. data/lib/coinbase/crypto_amount.rb +62 -0
  142. data/lib/coinbase/fiat_amount.rb +40 -0
  143. data/lib/coinbase/fund_operation.rb +228 -0
  144. data/lib/coinbase/fund_quote.rb +149 -0
  145. data/lib/coinbase/smart_contract.rb +2 -2
  146. data/lib/coinbase/staking_operation.rb +2 -2
  147. data/lib/coinbase/validator.rb +7 -10
  148. data/lib/coinbase/version.rb +1 -1
  149. data/lib/coinbase/wallet.rb +13 -1
  150. data/lib/coinbase.rb +4 -0
  151. metadata +11 -4
  152. data/lib/coinbase/client/api/validators_api.rb +0 -179
@@ -0,0 +1,376 @@
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.9.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Coinbase::Client
17
+ # The metadata for the reputation score of onchain address.
18
+ class AddressReputationMetadata
19
+ # The total number of transactions performed by the address.
20
+ attr_accessor :total_transactions
21
+
22
+ # The number of unique days the address was active.
23
+ attr_accessor :unique_days_active
24
+
25
+ # The longest streak of consecutive active days.
26
+ attr_accessor :longest_active_streak
27
+
28
+ # The current streak of consecutive active days.
29
+ attr_accessor :current_active_streak
30
+
31
+ # The total number of days the address has been active.
32
+ attr_accessor :activity_period_days
33
+
34
+ # The number of token swaps performed by the address.
35
+ attr_accessor :token_swaps_performed
36
+
37
+ # The number of bridge transactions performed by the address.
38
+ attr_accessor :bridge_transactions_performed
39
+
40
+ # The number of lend, borrow, or stake transactions performed by the address.
41
+ attr_accessor :lend_borrow_stake_transactions
42
+
43
+ # The number of interactions with ENS contracts.
44
+ attr_accessor :ens_contract_interactions
45
+
46
+ # The number of smart contracts deployed by the address.
47
+ attr_accessor :smart_contract_deployments
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'total_transactions' => :'total_transactions',
53
+ :'unique_days_active' => :'unique_days_active',
54
+ :'longest_active_streak' => :'longest_active_streak',
55
+ :'current_active_streak' => :'current_active_streak',
56
+ :'activity_period_days' => :'activity_period_days',
57
+ :'token_swaps_performed' => :'token_swaps_performed',
58
+ :'bridge_transactions_performed' => :'bridge_transactions_performed',
59
+ :'lend_borrow_stake_transactions' => :'lend_borrow_stake_transactions',
60
+ :'ens_contract_interactions' => :'ens_contract_interactions',
61
+ :'smart_contract_deployments' => :'smart_contract_deployments'
62
+ }
63
+ end
64
+
65
+ # Returns all the JSON keys this model knows about
66
+ def self.acceptable_attributes
67
+ attribute_map.values
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :'total_transactions' => :'Integer',
74
+ :'unique_days_active' => :'Integer',
75
+ :'longest_active_streak' => :'Integer',
76
+ :'current_active_streak' => :'Integer',
77
+ :'activity_period_days' => :'Integer',
78
+ :'token_swaps_performed' => :'Integer',
79
+ :'bridge_transactions_performed' => :'Integer',
80
+ :'lend_borrow_stake_transactions' => :'Integer',
81
+ :'ens_contract_interactions' => :'Integer',
82
+ :'smart_contract_deployments' => :'Integer'
83
+ }
84
+ end
85
+
86
+ # List of attributes with nullable: true
87
+ def self.openapi_nullable
88
+ Set.new([
89
+ ])
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ if (!attributes.is_a?(Hash))
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::AddressReputationMetadata` initialize method"
97
+ end
98
+
99
+ # check to see if the attribute exists and convert string to symbol for hash key
100
+ attributes = attributes.each_with_object({}) { |(k, v), h|
101
+ if (!self.class.attribute_map.key?(k.to_sym))
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::AddressReputationMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
103
+ end
104
+ h[k.to_sym] = v
105
+ }
106
+
107
+ if attributes.key?(:'total_transactions')
108
+ self.total_transactions = attributes[:'total_transactions']
109
+ else
110
+ self.total_transactions = nil
111
+ end
112
+
113
+ if attributes.key?(:'unique_days_active')
114
+ self.unique_days_active = attributes[:'unique_days_active']
115
+ else
116
+ self.unique_days_active = nil
117
+ end
118
+
119
+ if attributes.key?(:'longest_active_streak')
120
+ self.longest_active_streak = attributes[:'longest_active_streak']
121
+ else
122
+ self.longest_active_streak = nil
123
+ end
124
+
125
+ if attributes.key?(:'current_active_streak')
126
+ self.current_active_streak = attributes[:'current_active_streak']
127
+ else
128
+ self.current_active_streak = nil
129
+ end
130
+
131
+ if attributes.key?(:'activity_period_days')
132
+ self.activity_period_days = attributes[:'activity_period_days']
133
+ else
134
+ self.activity_period_days = nil
135
+ end
136
+
137
+ if attributes.key?(:'token_swaps_performed')
138
+ self.token_swaps_performed = attributes[:'token_swaps_performed']
139
+ else
140
+ self.token_swaps_performed = nil
141
+ end
142
+
143
+ if attributes.key?(:'bridge_transactions_performed')
144
+ self.bridge_transactions_performed = attributes[:'bridge_transactions_performed']
145
+ else
146
+ self.bridge_transactions_performed = nil
147
+ end
148
+
149
+ if attributes.key?(:'lend_borrow_stake_transactions')
150
+ self.lend_borrow_stake_transactions = attributes[:'lend_borrow_stake_transactions']
151
+ else
152
+ self.lend_borrow_stake_transactions = nil
153
+ end
154
+
155
+ if attributes.key?(:'ens_contract_interactions')
156
+ self.ens_contract_interactions = attributes[:'ens_contract_interactions']
157
+ else
158
+ self.ens_contract_interactions = nil
159
+ end
160
+
161
+ if attributes.key?(:'smart_contract_deployments')
162
+ self.smart_contract_deployments = attributes[:'smart_contract_deployments']
163
+ else
164
+ self.smart_contract_deployments = nil
165
+ end
166
+ end
167
+
168
+ # Show invalid properties with the reasons. Usually used together with valid?
169
+ # @return Array for valid properties with the reasons
170
+ def list_invalid_properties
171
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
172
+ invalid_properties = Array.new
173
+ if @total_transactions.nil?
174
+ invalid_properties.push('invalid value for "total_transactions", total_transactions cannot be nil.')
175
+ end
176
+
177
+ if @unique_days_active.nil?
178
+ invalid_properties.push('invalid value for "unique_days_active", unique_days_active cannot be nil.')
179
+ end
180
+
181
+ if @longest_active_streak.nil?
182
+ invalid_properties.push('invalid value for "longest_active_streak", longest_active_streak cannot be nil.')
183
+ end
184
+
185
+ if @current_active_streak.nil?
186
+ invalid_properties.push('invalid value for "current_active_streak", current_active_streak cannot be nil.')
187
+ end
188
+
189
+ if @activity_period_days.nil?
190
+ invalid_properties.push('invalid value for "activity_period_days", activity_period_days cannot be nil.')
191
+ end
192
+
193
+ if @token_swaps_performed.nil?
194
+ invalid_properties.push('invalid value for "token_swaps_performed", token_swaps_performed cannot be nil.')
195
+ end
196
+
197
+ if @bridge_transactions_performed.nil?
198
+ invalid_properties.push('invalid value for "bridge_transactions_performed", bridge_transactions_performed cannot be nil.')
199
+ end
200
+
201
+ if @lend_borrow_stake_transactions.nil?
202
+ invalid_properties.push('invalid value for "lend_borrow_stake_transactions", lend_borrow_stake_transactions cannot be nil.')
203
+ end
204
+
205
+ if @ens_contract_interactions.nil?
206
+ invalid_properties.push('invalid value for "ens_contract_interactions", ens_contract_interactions cannot be nil.')
207
+ end
208
+
209
+ if @smart_contract_deployments.nil?
210
+ invalid_properties.push('invalid value for "smart_contract_deployments", smart_contract_deployments cannot be nil.')
211
+ end
212
+
213
+ invalid_properties
214
+ end
215
+
216
+ # Check to see if the all the properties in the model are valid
217
+ # @return true if the model is valid
218
+ def valid?
219
+ warn '[DEPRECATED] the `valid?` method is obsolete'
220
+ return false if @total_transactions.nil?
221
+ return false if @unique_days_active.nil?
222
+ return false if @longest_active_streak.nil?
223
+ return false if @current_active_streak.nil?
224
+ return false if @activity_period_days.nil?
225
+ return false if @token_swaps_performed.nil?
226
+ return false if @bridge_transactions_performed.nil?
227
+ return false if @lend_borrow_stake_transactions.nil?
228
+ return false if @ens_contract_interactions.nil?
229
+ return false if @smart_contract_deployments.nil?
230
+ true
231
+ end
232
+
233
+ # Checks equality by comparing each attribute.
234
+ # @param [Object] Object to be compared
235
+ def ==(o)
236
+ return true if self.equal?(o)
237
+ self.class == o.class &&
238
+ total_transactions == o.total_transactions &&
239
+ unique_days_active == o.unique_days_active &&
240
+ longest_active_streak == o.longest_active_streak &&
241
+ current_active_streak == o.current_active_streak &&
242
+ activity_period_days == o.activity_period_days &&
243
+ token_swaps_performed == o.token_swaps_performed &&
244
+ bridge_transactions_performed == o.bridge_transactions_performed &&
245
+ lend_borrow_stake_transactions == o.lend_borrow_stake_transactions &&
246
+ ens_contract_interactions == o.ens_contract_interactions &&
247
+ smart_contract_deployments == o.smart_contract_deployments
248
+ end
249
+
250
+ # @see the `==` method
251
+ # @param [Object] Object to be compared
252
+ def eql?(o)
253
+ self == o
254
+ end
255
+
256
+ # Calculates hash code according to all attributes.
257
+ # @return [Integer] Hash code
258
+ def hash
259
+ [total_transactions, unique_days_active, longest_active_streak, current_active_streak, activity_period_days, token_swaps_performed, bridge_transactions_performed, lend_borrow_stake_transactions, ens_contract_interactions, smart_contract_deployments].hash
260
+ end
261
+
262
+ # Builds the object from hash
263
+ # @param [Hash] attributes Model attributes in the form of hash
264
+ # @return [Object] Returns the model itself
265
+ def self.build_from_hash(attributes)
266
+ return nil unless attributes.is_a?(Hash)
267
+ attributes = attributes.transform_keys(&:to_sym)
268
+ transformed_hash = {}
269
+ openapi_types.each_pair do |key, type|
270
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
271
+ transformed_hash["#{key}"] = nil
272
+ elsif type =~ /\AArray<(.*)>/i
273
+ # check to ensure the input is an array given that the attribute
274
+ # is documented as an array but the input is not
275
+ if attributes[attribute_map[key]].is_a?(Array)
276
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
277
+ end
278
+ elsif !attributes[attribute_map[key]].nil?
279
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
280
+ end
281
+ end
282
+ new(transformed_hash)
283
+ end
284
+
285
+ # Deserializes the data based on type
286
+ # @param string type Data type
287
+ # @param string value Value to be deserialized
288
+ # @return [Object] Deserialized data
289
+ def self._deserialize(type, value)
290
+ case type.to_sym
291
+ when :Time
292
+ Time.parse(value)
293
+ when :Date
294
+ Date.parse(value)
295
+ when :String
296
+ value.to_s
297
+ when :Integer
298
+ value.to_i
299
+ when :Float
300
+ value.to_f
301
+ when :Boolean
302
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
303
+ true
304
+ else
305
+ false
306
+ end
307
+ when :Object
308
+ # generic object (usually a Hash), return directly
309
+ value
310
+ when /\AArray<(?<inner_type>.+)>\z/
311
+ inner_type = Regexp.last_match[:inner_type]
312
+ value.map { |v| _deserialize(inner_type, v) }
313
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
314
+ k_type = Regexp.last_match[:k_type]
315
+ v_type = Regexp.last_match[:v_type]
316
+ {}.tap do |hash|
317
+ value.each do |k, v|
318
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
319
+ end
320
+ end
321
+ else # model
322
+ # models (e.g. Pet) or oneOf
323
+ klass = Coinbase::Client.const_get(type)
324
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
325
+ end
326
+ end
327
+
328
+ # Returns the string representation of the object
329
+ # @return [String] String presentation of the object
330
+ def to_s
331
+ to_hash.to_s
332
+ end
333
+
334
+ # to_body is an alias to to_hash (backward compatibility)
335
+ # @return [Hash] Returns the object in the form of hash
336
+ def to_body
337
+ to_hash
338
+ end
339
+
340
+ # Returns the object in the form of hash
341
+ # @return [Hash] Returns the object in the form of hash
342
+ def to_hash
343
+ hash = {}
344
+ self.class.attribute_map.each_pair do |attr, param|
345
+ value = self.send(attr)
346
+ if value.nil?
347
+ is_nullable = self.class.openapi_nullable.include?(attr)
348
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
349
+ end
350
+
351
+ hash[param] = _to_hash(value)
352
+ end
353
+ hash
354
+ end
355
+
356
+ # Outputs non-array value in the form of hash
357
+ # For object, use to_hash. Otherwise, just return the value
358
+ # @param [Object] value Any valid value
359
+ # @return [Hash] Returns the value in the form of hash
360
+ def _to_hash(value)
361
+ if value.is_a?(Array)
362
+ value.compact.map { |v| _to_hash(v) }
363
+ elsif value.is_a?(Hash)
364
+ {}.tap do |hash|
365
+ value.each { |k, v| hash[k] = _to_hash(v) }
366
+ end
367
+ elsif value.respond_to? :to_hash
368
+ value.to_hash
369
+ else
370
+ value
371
+ end
372
+ end
373
+
374
+ end
375
+
376
+ end
@@ -0,0 +1,223 @@
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.9.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Coinbase::Client
17
+ # The risk score of a blockchain address.
18
+ class AddressRisk
19
+ # The lower the score is, the higher the risk is. The score lies between -100 to 0.
20
+ attr_accessor :risk_score
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'risk_score' => :'risk_score'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'risk_score' => :'Integer'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::AddressRisk` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::AddressRisk`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'risk_score')
63
+ self.risk_score = attributes[:'risk_score']
64
+ else
65
+ self.risk_score = nil
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
73
+ invalid_properties = Array.new
74
+ if @risk_score.nil?
75
+ invalid_properties.push('invalid value for "risk_score", risk_score cannot be nil.')
76
+ end
77
+
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ return false if @risk_score.nil?
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ risk_score == o.risk_score
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [risk_score].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def self._deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = Coinbase::Client.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
+
221
+ end
222
+
223
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12
 
@@ -27,6 +27,7 @@ module Coinbase::Client
27
27
  # The type of staking operation
28
28
  attr_accessor :action
29
29
 
30
+ # Additional options for the staking operation.
30
31
  attr_accessor :options
31
32
 
32
33
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.9.0
10
10
 
11
11
  =end
12
12