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