coinbase-sdk 0.0.14 → 0.0.16

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