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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coinbase-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuga Cohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-14 00:00:00.000000000 Z
11
+ date: 2024-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal
@@ -288,6 +288,7 @@ files:
288
288
  - lib/coinbase/client/api/transfers_api.rb
289
289
  - lib/coinbase/client/api/users_api.rb
290
290
  - lib/coinbase/client/api/validators_api.rb
291
+ - lib/coinbase/client/api/wallet_stake_api.rb
291
292
  - lib/coinbase/client/api/wallets_api.rb
292
293
  - lib/coinbase/client/api/webhooks_api.rb
293
294
  - lib/coinbase/client/api_client.rb
@@ -314,7 +315,6 @@ files:
314
315
  - lib/coinbase/client/models/create_wallet_request_wallet.rb
315
316
  - lib/coinbase/client/models/create_webhook_request.rb
316
317
  - lib/coinbase/client/models/error.rb
317
- - lib/coinbase/client/models/ethereum_validator.rb
318
318
  - lib/coinbase/client/models/ethereum_validator_metadata.rb
319
319
  - lib/coinbase/client/models/faucet_transaction.rb
320
320
  - lib/coinbase/client/models/feature.rb
@@ -323,13 +323,9 @@ files:
323
323
  - lib/coinbase/client/models/fetch_staking_rewards200_response.rb
324
324
  - lib/coinbase/client/models/fetch_staking_rewards_request.rb
325
325
  - lib/coinbase/client/models/get_staking_context_request.rb
326
- - lib/coinbase/client/models/get_validator200_response.rb
327
- - lib/coinbase/client/models/get_validator200_response_validator.rb
328
326
  - lib/coinbase/client/models/historical_balance.rb
329
- - lib/coinbase/client/models/native_eth_staking_context.rb
330
327
  - lib/coinbase/client/models/network.rb
331
328
  - lib/coinbase/client/models/network_identifier.rb
332
- - lib/coinbase/client/models/partial_eth_staking_context.rb
333
329
  - lib/coinbase/client/models/seed_creation_event.rb
334
330
  - lib/coinbase/client/models/seed_creation_event_result.rb
335
331
  - lib/coinbase/client/models/server_signer.rb
@@ -360,7 +356,7 @@ files:
360
356
  - lib/coinbase/client/models/validator.rb
361
357
  - lib/coinbase/client/models/validator_details.rb
362
358
  - lib/coinbase/client/models/validator_list.rb
363
- - lib/coinbase/client/models/validator_list_data.rb
359
+ - lib/coinbase/client/models/validator_status.rb
364
360
  - lib/coinbase/client/models/wallet.rb
365
361
  - lib/coinbase/client/models/wallet_list.rb
366
362
  - lib/coinbase/client/models/webhook.rb
@@ -369,6 +365,8 @@ files:
369
365
  - lib/coinbase/client/models/webhook_list.rb
370
366
  - lib/coinbase/client/version.rb
371
367
  - lib/coinbase/constants.rb
368
+ - lib/coinbase/contract_event.rb
369
+ - lib/coinbase/correlation.rb
372
370
  - lib/coinbase/destination.rb
373
371
  - lib/coinbase/errors.rb
374
372
  - lib/coinbase/faucet_transaction.rb
@@ -377,6 +375,7 @@ files:
377
375
  - lib/coinbase/network.rb
378
376
  - lib/coinbase/pagination.rb
379
377
  - lib/coinbase/server_signer.rb
378
+ - lib/coinbase/smart_contract.rb
380
379
  - lib/coinbase/sponsored_send.rb
381
380
  - lib/coinbase/staking_balance.rb
382
381
  - lib/coinbase/staking_operation.rb
@@ -384,10 +383,11 @@ files:
384
383
  - lib/coinbase/trade.rb
385
384
  - lib/coinbase/transaction.rb
386
385
  - lib/coinbase/transfer.rb
387
- - lib/coinbase/user.rb
388
386
  - lib/coinbase/validator.rb
387
+ - lib/coinbase/version.rb
389
388
  - lib/coinbase/wallet.rb
390
389
  - lib/coinbase/wallet/data.rb
390
+ - lib/coinbase/webhook.rb
391
391
  homepage: https://github.com/coinbase/coinbase-sdk-ruby
392
392
  licenses:
393
393
  - Apache-2.0
@@ -1,374 +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
- # An Ethereum validator.
18
- class EthereumValidator
19
- # The index of the validator in the validator set.
20
- attr_accessor :index
21
-
22
- # The status of the validator.
23
- attr_accessor :status
24
-
25
- # The public key of the validator.
26
- attr_accessor :public_key
27
-
28
- # The address to which the validator's rewards are sent.
29
- attr_accessor :withdrawl_address
30
-
31
- # Whether the validator has been slashed.
32
- attr_accessor :slashed
33
-
34
- # The epoch at which the validator was activated.
35
- attr_accessor :activation_epoch
36
-
37
- # The epoch at which the validator exited.
38
- attr_accessor :exit_epoch
39
-
40
- # The epoch at which the validator can withdraw.
41
- attr_accessor :withdrawable_epoch
42
-
43
- attr_accessor :balance
44
-
45
- attr_accessor :effective_balance
46
-
47
- # Attribute mapping from ruby-style variable name to JSON key.
48
- def self.attribute_map
49
- {
50
- :'index' => :'index',
51
- :'status' => :'status',
52
- :'public_key' => :'public_key',
53
- :'withdrawl_address' => :'withdrawl_address',
54
- :'slashed' => :'slashed',
55
- :'activation_epoch' => :'activationEpoch',
56
- :'exit_epoch' => :'exitEpoch',
57
- :'withdrawable_epoch' => :'withdrawableEpoch',
58
- :'balance' => :'balance',
59
- :'effective_balance' => :'effective_balance'
60
- }
61
- end
62
-
63
- # Returns all the JSON keys this model knows about
64
- def self.acceptable_attributes
65
- attribute_map.values
66
- end
67
-
68
- # Attribute type mapping.
69
- def self.openapi_types
70
- {
71
- :'index' => :'String',
72
- :'status' => :'String',
73
- :'public_key' => :'String',
74
- :'withdrawl_address' => :'String',
75
- :'slashed' => :'Boolean',
76
- :'activation_epoch' => :'String',
77
- :'exit_epoch' => :'String',
78
- :'withdrawable_epoch' => :'String',
79
- :'balance' => :'Balance',
80
- :'effective_balance' => :'Balance'
81
- }
82
- end
83
-
84
- # List of attributes with nullable: true
85
- def self.openapi_nullable
86
- Set.new([
87
- ])
88
- end
89
-
90
- # Initializes the object
91
- # @param [Hash] attributes Model attributes in the form of hash
92
- def initialize(attributes = {})
93
- if (!attributes.is_a?(Hash))
94
- fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::EthereumValidator` initialize method"
95
- end
96
-
97
- # check to see if the attribute exists and convert string to symbol for hash key
98
- attributes = attributes.each_with_object({}) { |(k, v), h|
99
- if (!self.class.attribute_map.key?(k.to_sym))
100
- fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::EthereumValidator`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
- end
102
- h[k.to_sym] = v
103
- }
104
-
105
- if attributes.key?(:'index')
106
- self.index = attributes[:'index']
107
- else
108
- self.index = nil
109
- end
110
-
111
- if attributes.key?(:'status')
112
- self.status = attributes[:'status']
113
- else
114
- self.status = nil
115
- end
116
-
117
- if attributes.key?(:'public_key')
118
- self.public_key = attributes[:'public_key']
119
- else
120
- self.public_key = nil
121
- end
122
-
123
- if attributes.key?(:'withdrawl_address')
124
- self.withdrawl_address = attributes[:'withdrawl_address']
125
- else
126
- self.withdrawl_address = nil
127
- end
128
-
129
- if attributes.key?(:'slashed')
130
- self.slashed = attributes[:'slashed']
131
- else
132
- self.slashed = nil
133
- end
134
-
135
- if attributes.key?(:'activation_epoch')
136
- self.activation_epoch = attributes[:'activation_epoch']
137
- else
138
- self.activation_epoch = nil
139
- end
140
-
141
- if attributes.key?(:'exit_epoch')
142
- self.exit_epoch = attributes[:'exit_epoch']
143
- else
144
- self.exit_epoch = nil
145
- end
146
-
147
- if attributes.key?(:'withdrawable_epoch')
148
- self.withdrawable_epoch = attributes[:'withdrawable_epoch']
149
- else
150
- self.withdrawable_epoch = nil
151
- end
152
-
153
- if attributes.key?(:'balance')
154
- self.balance = attributes[:'balance']
155
- else
156
- self.balance = nil
157
- end
158
-
159
- if attributes.key?(:'effective_balance')
160
- self.effective_balance = attributes[:'effective_balance']
161
- else
162
- self.effective_balance = nil
163
- end
164
- end
165
-
166
- # Show invalid properties with the reasons. Usually used together with valid?
167
- # @return Array for valid properties with the reasons
168
- def list_invalid_properties
169
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
170
- invalid_properties = Array.new
171
- if @index.nil?
172
- invalid_properties.push('invalid value for "index", index cannot be nil.')
173
- end
174
-
175
- if @status.nil?
176
- invalid_properties.push('invalid value for "status", status cannot be nil.')
177
- end
178
-
179
- if @public_key.nil?
180
- invalid_properties.push('invalid value for "public_key", public_key cannot be nil.')
181
- end
182
-
183
- if @withdrawl_address.nil?
184
- invalid_properties.push('invalid value for "withdrawl_address", withdrawl_address cannot be nil.')
185
- end
186
-
187
- if @slashed.nil?
188
- invalid_properties.push('invalid value for "slashed", slashed cannot be nil.')
189
- end
190
-
191
- if @activation_epoch.nil?
192
- invalid_properties.push('invalid value for "activation_epoch", activation_epoch cannot be nil.')
193
- end
194
-
195
- if @exit_epoch.nil?
196
- invalid_properties.push('invalid value for "exit_epoch", exit_epoch cannot be nil.')
197
- end
198
-
199
- if @withdrawable_epoch.nil?
200
- invalid_properties.push('invalid value for "withdrawable_epoch", withdrawable_epoch cannot be nil.')
201
- end
202
-
203
- if @balance.nil?
204
- invalid_properties.push('invalid value for "balance", balance cannot be nil.')
205
- end
206
-
207
- if @effective_balance.nil?
208
- invalid_properties.push('invalid value for "effective_balance", effective_balance cannot be nil.')
209
- end
210
-
211
- invalid_properties
212
- end
213
-
214
- # Check to see if the all the properties in the model are valid
215
- # @return true if the model is valid
216
- def valid?
217
- warn '[DEPRECATED] the `valid?` method is obsolete'
218
- return false if @index.nil?
219
- return false if @status.nil?
220
- return false if @public_key.nil?
221
- return false if @withdrawl_address.nil?
222
- return false if @slashed.nil?
223
- return false if @activation_epoch.nil?
224
- return false if @exit_epoch.nil?
225
- return false if @withdrawable_epoch.nil?
226
- return false if @balance.nil?
227
- return false if @effective_balance.nil?
228
- true
229
- end
230
-
231
- # Checks equality by comparing each attribute.
232
- # @param [Object] Object to be compared
233
- def ==(o)
234
- return true if self.equal?(o)
235
- self.class == o.class &&
236
- index == o.index &&
237
- status == o.status &&
238
- public_key == o.public_key &&
239
- withdrawl_address == o.withdrawl_address &&
240
- slashed == o.slashed &&
241
- activation_epoch == o.activation_epoch &&
242
- exit_epoch == o.exit_epoch &&
243
- withdrawable_epoch == o.withdrawable_epoch &&
244
- balance == o.balance &&
245
- effective_balance == o.effective_balance
246
- end
247
-
248
- # @see the `==` method
249
- # @param [Object] Object to be compared
250
- def eql?(o)
251
- self == o
252
- end
253
-
254
- # Calculates hash code according to all attributes.
255
- # @return [Integer] Hash code
256
- def hash
257
- [index, status, public_key, withdrawl_address, slashed, activation_epoch, exit_epoch, withdrawable_epoch, balance, effective_balance].hash
258
- end
259
-
260
- # Builds the object from hash
261
- # @param [Hash] attributes Model attributes in the form of hash
262
- # @return [Object] Returns the model itself
263
- def self.build_from_hash(attributes)
264
- return nil unless attributes.is_a?(Hash)
265
- attributes = attributes.transform_keys(&:to_sym)
266
- transformed_hash = {}
267
- openapi_types.each_pair do |key, type|
268
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
269
- transformed_hash["#{key}"] = nil
270
- elsif type =~ /\AArray<(.*)>/i
271
- # check to ensure the input is an array given that the attribute
272
- # is documented as an array but the input is not
273
- if attributes[attribute_map[key]].is_a?(Array)
274
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
275
- end
276
- elsif !attributes[attribute_map[key]].nil?
277
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
278
- end
279
- end
280
- new(transformed_hash)
281
- end
282
-
283
- # Deserializes the data based on type
284
- # @param string type Data type
285
- # @param string value Value to be deserialized
286
- # @return [Object] Deserialized data
287
- def self._deserialize(type, value)
288
- case type.to_sym
289
- when :Time
290
- Time.parse(value)
291
- when :Date
292
- Date.parse(value)
293
- when :String
294
- value.to_s
295
- when :Integer
296
- value.to_i
297
- when :Float
298
- value.to_f
299
- when :Boolean
300
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
301
- true
302
- else
303
- false
304
- end
305
- when :Object
306
- # generic object (usually a Hash), return directly
307
- value
308
- when /\AArray<(?<inner_type>.+)>\z/
309
- inner_type = Regexp.last_match[:inner_type]
310
- value.map { |v| _deserialize(inner_type, v) }
311
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
312
- k_type = Regexp.last_match[:k_type]
313
- v_type = Regexp.last_match[:v_type]
314
- {}.tap do |hash|
315
- value.each do |k, v|
316
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
317
- end
318
- end
319
- else # model
320
- # models (e.g. Pet) or oneOf
321
- klass = Coinbase::Client.const_get(type)
322
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
323
- end
324
- end
325
-
326
- # Returns the string representation of the object
327
- # @return [String] String presentation of the object
328
- def to_s
329
- to_hash.to_s
330
- end
331
-
332
- # to_body is an alias to to_hash (backward compatibility)
333
- # @return [Hash] Returns the object in the form of hash
334
- def to_body
335
- to_hash
336
- end
337
-
338
- # Returns the object in the form of hash
339
- # @return [Hash] Returns the object in the form of hash
340
- def to_hash
341
- hash = {}
342
- self.class.attribute_map.each_pair do |attr, param|
343
- value = self.send(attr)
344
- if value.nil?
345
- is_nullable = self.class.openapi_nullable.include?(attr)
346
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
347
- end
348
-
349
- hash[param] = _to_hash(value)
350
- end
351
- hash
352
- end
353
-
354
- # Outputs non-array value in the form of hash
355
- # For object, use to_hash. Otherwise, just return the value
356
- # @param [Object] value Any valid value
357
- # @return [Hash] Returns the value in the form of hash
358
- def _to_hash(value)
359
- if value.is_a?(Array)
360
- value.compact.map { |v| _to_hash(v) }
361
- elsif value.is_a?(Hash)
362
- {}.tap do |hash|
363
- value.each { |k, v| hash[k] = _to_hash(v) }
364
- end
365
- elsif value.respond_to? :to_hash
366
- value.to_hash
367
- else
368
- value
369
- end
370
- end
371
-
372
- end
373
-
374
- end
@@ -1,221 +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 GetValidator200Response
18
- attr_accessor :validator
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'validator' => :'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
- :'validator' => :'GetValidator200ResponseValidator'
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::GetValidator200Response` 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::GetValidator200Response`. 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?(:'validator')
61
- self.validator = attributes[:'validator']
62
- else
63
- self.validator = nil
64
- end
65
- end
66
-
67
- # Show invalid properties with the reasons. Usually used together with valid?
68
- # @return Array for valid properties with the reasons
69
- def list_invalid_properties
70
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
71
- invalid_properties = Array.new
72
- if @validator.nil?
73
- invalid_properties.push('invalid value for "validator", validator cannot be nil.')
74
- end
75
-
76
- invalid_properties
77
- end
78
-
79
- # Check to see if the all the properties in the model are valid
80
- # @return true if the model is valid
81
- def valid?
82
- warn '[DEPRECATED] the `valid?` method is obsolete'
83
- return false if @validator.nil?
84
- true
85
- end
86
-
87
- # Checks equality by comparing each attribute.
88
- # @param [Object] Object to be compared
89
- def ==(o)
90
- return true if self.equal?(o)
91
- self.class == o.class &&
92
- validator == o.validator
93
- end
94
-
95
- # @see the `==` method
96
- # @param [Object] Object to be compared
97
- def eql?(o)
98
- self == o
99
- end
100
-
101
- # Calculates hash code according to all attributes.
102
- # @return [Integer] Hash code
103
- def hash
104
- [validator].hash
105
- end
106
-
107
- # Builds the object from hash
108
- # @param [Hash] attributes Model attributes in the form of hash
109
- # @return [Object] Returns the model itself
110
- def self.build_from_hash(attributes)
111
- return nil unless attributes.is_a?(Hash)
112
- attributes = attributes.transform_keys(&:to_sym)
113
- transformed_hash = {}
114
- openapi_types.each_pair do |key, type|
115
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
- transformed_hash["#{key}"] = nil
117
- elsif type =~ /\AArray<(.*)>/i
118
- # check to ensure the input is an array given that the attribute
119
- # is documented as an array but the input is not
120
- if attributes[attribute_map[key]].is_a?(Array)
121
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
122
- end
123
- elsif !attributes[attribute_map[key]].nil?
124
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
125
- end
126
- end
127
- new(transformed_hash)
128
- end
129
-
130
- # Deserializes the data based on type
131
- # @param string type Data type
132
- # @param string value Value to be deserialized
133
- # @return [Object] Deserialized data
134
- def self._deserialize(type, value)
135
- case type.to_sym
136
- when :Time
137
- Time.parse(value)
138
- when :Date
139
- Date.parse(value)
140
- when :String
141
- value.to_s
142
- when :Integer
143
- value.to_i
144
- when :Float
145
- value.to_f
146
- when :Boolean
147
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
- true
149
- else
150
- false
151
- end
152
- when :Object
153
- # generic object (usually a Hash), return directly
154
- value
155
- when /\AArray<(?<inner_type>.+)>\z/
156
- inner_type = Regexp.last_match[:inner_type]
157
- value.map { |v| _deserialize(inner_type, v) }
158
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
- k_type = Regexp.last_match[:k_type]
160
- v_type = Regexp.last_match[:v_type]
161
- {}.tap do |hash|
162
- value.each do |k, v|
163
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
- end
165
- end
166
- else # model
167
- # models (e.g. Pet) or oneOf
168
- klass = Coinbase::Client.const_get(type)
169
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
- end
171
- end
172
-
173
- # Returns the string representation of the object
174
- # @return [String] String presentation of the object
175
- def to_s
176
- to_hash.to_s
177
- end
178
-
179
- # to_body is an alias to to_hash (backward compatibility)
180
- # @return [Hash] Returns the object in the form of hash
181
- def to_body
182
- to_hash
183
- end
184
-
185
- # Returns the object in the form of hash
186
- # @return [Hash] Returns the object in the form of hash
187
- def to_hash
188
- hash = {}
189
- self.class.attribute_map.each_pair do |attr, param|
190
- value = self.send(attr)
191
- if value.nil?
192
- is_nullable = self.class.openapi_nullable.include?(attr)
193
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
- end
195
-
196
- hash[param] = _to_hash(value)
197
- end
198
- hash
199
- end
200
-
201
- # Outputs non-array value in the form of hash
202
- # For object, use to_hash. Otherwise, just return the value
203
- # @param [Object] value Any valid value
204
- # @return [Hash] Returns the value in the form of hash
205
- def _to_hash(value)
206
- if value.is_a?(Array)
207
- value.compact.map { |v| _to_hash(v) }
208
- elsif value.is_a?(Hash)
209
- {}.tap do |hash|
210
- value.each { |k, v| hash[k] = _to_hash(v) }
211
- end
212
- elsif value.respond_to? :to_hash
213
- value.to_hash
214
- else
215
- value
216
- end
217
- end
218
-
219
- end
220
-
221
- end