coinbase-sdk 0.1.1 → 0.3.0

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