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
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.
|
9
|
+
Generator version: 7.9.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -419,5 +419,162 @@ module Coinbase::Client
|
|
419
419
|
end
|
420
420
|
return data, status_code, headers
|
421
421
|
end
|
422
|
+
|
423
|
+
# Get a validator belonging to the CDP project
|
424
|
+
# Get a validator belonging to the user for a given network, asset and id.
|
425
|
+
# @param network_id [String] The ID of the blockchain network.
|
426
|
+
# @param asset_id [String] The symbol of the asset to get the validator for.
|
427
|
+
# @param validator_id [String] The unique id of the validator to fetch details for.
|
428
|
+
# @param [Hash] opts the optional parameters
|
429
|
+
# @return [Validator]
|
430
|
+
def get_validator(network_id, asset_id, validator_id, opts = {})
|
431
|
+
data, _status_code, _headers = get_validator_with_http_info(network_id, asset_id, validator_id, opts)
|
432
|
+
data
|
433
|
+
end
|
434
|
+
|
435
|
+
# Get a validator belonging to the CDP project
|
436
|
+
# Get a validator belonging to the user for a given network, asset and id.
|
437
|
+
# @param network_id [String] The ID of the blockchain network.
|
438
|
+
# @param asset_id [String] The symbol of the asset to get the validator for.
|
439
|
+
# @param validator_id [String] The unique id of the validator to fetch details for.
|
440
|
+
# @param [Hash] opts the optional parameters
|
441
|
+
# @return [Array<(Validator, Integer, Hash)>] Validator data, response status code and response headers
|
442
|
+
def get_validator_with_http_info(network_id, asset_id, validator_id, opts = {})
|
443
|
+
if @api_client.config.debugging
|
444
|
+
@api_client.config.logger.debug 'Calling API: StakeApi.get_validator ...'
|
445
|
+
end
|
446
|
+
# verify the required parameter 'network_id' is set
|
447
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
448
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling StakeApi.get_validator"
|
449
|
+
end
|
450
|
+
# verify the required parameter 'asset_id' is set
|
451
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
452
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling StakeApi.get_validator"
|
453
|
+
end
|
454
|
+
# verify the required parameter 'validator_id' is set
|
455
|
+
if @api_client.config.client_side_validation && validator_id.nil?
|
456
|
+
fail ArgumentError, "Missing the required parameter 'validator_id' when calling StakeApi.get_validator"
|
457
|
+
end
|
458
|
+
# resource path
|
459
|
+
local_var_path = '/v1/networks/{network_id}/assets/{asset_id}/validators/{validator_id}'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_id.to_s)).sub('{' + 'validator_id' + '}', CGI.escape(validator_id.to_s))
|
460
|
+
|
461
|
+
# query parameters
|
462
|
+
query_params = opts[:query_params] || {}
|
463
|
+
|
464
|
+
# header parameters
|
465
|
+
header_params = opts[:header_params] || {}
|
466
|
+
# HTTP header 'Accept' (if needed)
|
467
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
468
|
+
|
469
|
+
# form parameters
|
470
|
+
form_params = opts[:form_params] || {}
|
471
|
+
|
472
|
+
# http body (model)
|
473
|
+
post_body = opts[:debug_body]
|
474
|
+
|
475
|
+
# return_type
|
476
|
+
return_type = opts[:debug_return_type] || 'Validator'
|
477
|
+
|
478
|
+
# auth_names
|
479
|
+
auth_names = opts[:debug_auth_names] || []
|
480
|
+
|
481
|
+
new_options = opts.merge(
|
482
|
+
:operation => :"StakeApi.get_validator",
|
483
|
+
:header_params => header_params,
|
484
|
+
:query_params => query_params,
|
485
|
+
:form_params => form_params,
|
486
|
+
:body => post_body,
|
487
|
+
:auth_names => auth_names,
|
488
|
+
:return_type => return_type
|
489
|
+
)
|
490
|
+
|
491
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
492
|
+
if @api_client.config.debugging
|
493
|
+
@api_client.config.logger.debug "API called: StakeApi#get_validator\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
494
|
+
end
|
495
|
+
return data, status_code, headers
|
496
|
+
end
|
497
|
+
|
498
|
+
# List validators belonging to the CDP project
|
499
|
+
# List validators belonging to the user for a given network and asset.
|
500
|
+
# @param network_id [String] The ID of the blockchain network.
|
501
|
+
# @param asset_id [String] The symbol of the asset to get the validators for.
|
502
|
+
# @param [Hash] opts the optional parameters
|
503
|
+
# @option opts [ValidatorStatus] :status A filter to list validators based on a status.
|
504
|
+
# @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50.
|
505
|
+
# @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
506
|
+
# @return [ValidatorList]
|
507
|
+
def list_validators(network_id, asset_id, opts = {})
|
508
|
+
data, _status_code, _headers = list_validators_with_http_info(network_id, asset_id, opts)
|
509
|
+
data
|
510
|
+
end
|
511
|
+
|
512
|
+
# List validators belonging to the CDP project
|
513
|
+
# List validators belonging to the user for a given network and asset.
|
514
|
+
# @param network_id [String] The ID of the blockchain network.
|
515
|
+
# @param asset_id [String] The symbol of the asset to get the validators for.
|
516
|
+
# @param [Hash] opts the optional parameters
|
517
|
+
# @option opts [ValidatorStatus] :status A filter to list validators based on a status.
|
518
|
+
# @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50.
|
519
|
+
# @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
520
|
+
# @return [Array<(ValidatorList, Integer, Hash)>] ValidatorList data, response status code and response headers
|
521
|
+
def list_validators_with_http_info(network_id, asset_id, opts = {})
|
522
|
+
if @api_client.config.debugging
|
523
|
+
@api_client.config.logger.debug 'Calling API: StakeApi.list_validators ...'
|
524
|
+
end
|
525
|
+
# verify the required parameter 'network_id' is set
|
526
|
+
if @api_client.config.client_side_validation && network_id.nil?
|
527
|
+
fail ArgumentError, "Missing the required parameter 'network_id' when calling StakeApi.list_validators"
|
528
|
+
end
|
529
|
+
# verify the required parameter 'asset_id' is set
|
530
|
+
if @api_client.config.client_side_validation && asset_id.nil?
|
531
|
+
fail ArgumentError, "Missing the required parameter 'asset_id' when calling StakeApi.list_validators"
|
532
|
+
end
|
533
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
534
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling StakeApi.list_validators, the character length must be smaller than or equal to 5000.'
|
535
|
+
end
|
536
|
+
|
537
|
+
# resource path
|
538
|
+
local_var_path = '/v1/networks/{network_id}/assets/{asset_id}/validators'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_id.to_s))
|
539
|
+
|
540
|
+
# query parameters
|
541
|
+
query_params = opts[:query_params] || {}
|
542
|
+
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
543
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
544
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
545
|
+
|
546
|
+
# header parameters
|
547
|
+
header_params = opts[:header_params] || {}
|
548
|
+
# HTTP header 'Accept' (if needed)
|
549
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
550
|
+
|
551
|
+
# form parameters
|
552
|
+
form_params = opts[:form_params] || {}
|
553
|
+
|
554
|
+
# http body (model)
|
555
|
+
post_body = opts[:debug_body]
|
556
|
+
|
557
|
+
# return_type
|
558
|
+
return_type = opts[:debug_return_type] || 'ValidatorList'
|
559
|
+
|
560
|
+
# auth_names
|
561
|
+
auth_names = opts[:debug_auth_names] || []
|
562
|
+
|
563
|
+
new_options = opts.merge(
|
564
|
+
:operation => :"StakeApi.list_validators",
|
565
|
+
:header_params => header_params,
|
566
|
+
:query_params => query_params,
|
567
|
+
:form_params => form_params,
|
568
|
+
:body => post_body,
|
569
|
+
:auth_names => auth_names,
|
570
|
+
:return_type => return_type
|
571
|
+
)
|
572
|
+
|
573
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
574
|
+
if @api_client.config.debugging
|
575
|
+
@api_client.config.logger.debug "API called: StakeApi#list_validators\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
576
|
+
end
|
577
|
+
return data, status_code, headers
|
578
|
+
end
|
422
579
|
end
|
423
580
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.
|
9
|
+
Generator version: 7.9.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -23,7 +23,7 @@ module Coinbase::Client
|
|
23
23
|
# Create a new webhook scoped to a wallet
|
24
24
|
# @param wallet_id [String] The ID of the wallet to create the webhook for.
|
25
25
|
# @param [Hash] opts the optional parameters
|
26
|
-
# @option opts [CreateWalletWebhookRequest] :create_wallet_webhook_request
|
26
|
+
# @option opts [CreateWalletWebhookRequest] :create_wallet_webhook_request
|
27
27
|
# @return [Webhook]
|
28
28
|
def create_wallet_webhook(wallet_id, opts = {})
|
29
29
|
data, _status_code, _headers = create_wallet_webhook_with_http_info(wallet_id, opts)
|
@@ -34,7 +34,7 @@ module Coinbase::Client
|
|
34
34
|
# Create a new webhook scoped to a wallet
|
35
35
|
# @param wallet_id [String] The ID of the wallet to create the webhook for.
|
36
36
|
# @param [Hash] opts the optional parameters
|
37
|
-
# @option opts [CreateWalletWebhookRequest] :create_wallet_webhook_request
|
37
|
+
# @option opts [CreateWalletWebhookRequest] :create_wallet_webhook_request
|
38
38
|
# @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
|
39
39
|
def create_wallet_webhook_with_http_info(wallet_id, opts = {})
|
40
40
|
if @api_client.config.debugging
|
@@ -57,7 +57,7 @@ module Coinbase::Client
|
|
57
57
|
# HTTP header 'Content-Type'
|
58
58
|
content_type = @api_client.select_header_content_type(['application/json'])
|
59
59
|
if !content_type.nil?
|
60
|
-
|
60
|
+
header_params['Content-Type'] = content_type
|
61
61
|
end
|
62
62
|
|
63
63
|
# form parameters
|
@@ -121,7 +121,7 @@ module Coinbase::Client
|
|
121
121
|
# HTTP header 'Content-Type'
|
122
122
|
content_type = @api_client.select_header_content_type(['application/json'])
|
123
123
|
if !content_type.nil?
|
124
|
-
|
124
|
+
header_params['Content-Type'] = content_type
|
125
125
|
end
|
126
126
|
|
127
127
|
# form parameters
|
@@ -321,7 +321,7 @@ module Coinbase::Client
|
|
321
321
|
# HTTP header 'Content-Type'
|
322
322
|
content_type = @api_client.select_header_content_type(['application/json'])
|
323
323
|
if !content_type.nil?
|
324
|
-
|
324
|
+
header_params['Content-Type'] = content_type
|
325
325
|
end
|
326
326
|
|
327
327
|
# form parameters
|
@@ -0,0 +1,232 @@
|
|
1
|
+
=begin
|
2
|
+
#Coinbase Platform API
|
3
|
+
|
4
|
+
#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.0.1-alpha
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.9.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
# The reputation score with metadata of a blockchain address.
|
18
|
+
class AddressReputation
|
19
|
+
# The reputation score of a wallet address which lie between 0 to 100.
|
20
|
+
attr_accessor :reputation_score
|
21
|
+
|
22
|
+
attr_accessor :metadata
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'reputation_score' => :'reputation_score',
|
28
|
+
:'metadata' => :'metadata'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns all the JSON keys this model knows about
|
33
|
+
def self.acceptable_attributes
|
34
|
+
attribute_map.values
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.openapi_types
|
39
|
+
{
|
40
|
+
:'reputation_score' => :'Integer',
|
41
|
+
:'metadata' => :'AddressReputationMetadata'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of attributes with nullable: true
|
46
|
+
def self.openapi_nullable
|
47
|
+
Set.new([
|
48
|
+
])
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
if (!attributes.is_a?(Hash))
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::AddressReputation` initialize method"
|
56
|
+
end
|
57
|
+
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::AddressReputation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
62
|
+
end
|
63
|
+
h[k.to_sym] = v
|
64
|
+
}
|
65
|
+
|
66
|
+
if attributes.key?(:'reputation_score')
|
67
|
+
self.reputation_score = attributes[:'reputation_score']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'metadata')
|
71
|
+
self.metadata = attributes[:'metadata']
|
72
|
+
else
|
73
|
+
self.metadata = nil
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
78
|
+
# @return Array for valid properties with the reasons
|
79
|
+
def list_invalid_properties
|
80
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
81
|
+
invalid_properties = Array.new
|
82
|
+
if @metadata.nil?
|
83
|
+
invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
|
84
|
+
end
|
85
|
+
|
86
|
+
invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
93
|
+
return false if @metadata.nil?
|
94
|
+
true
|
95
|
+
end
|
96
|
+
|
97
|
+
# Checks equality by comparing each attribute.
|
98
|
+
# @param [Object] Object to be compared
|
99
|
+
def ==(o)
|
100
|
+
return true if self.equal?(o)
|
101
|
+
self.class == o.class &&
|
102
|
+
reputation_score == o.reputation_score &&
|
103
|
+
metadata == o.metadata
|
104
|
+
end
|
105
|
+
|
106
|
+
# @see the `==` method
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def eql?(o)
|
109
|
+
self == o
|
110
|
+
end
|
111
|
+
|
112
|
+
# Calculates hash code according to all attributes.
|
113
|
+
# @return [Integer] Hash code
|
114
|
+
def hash
|
115
|
+
[reputation_score, metadata].hash
|
116
|
+
end
|
117
|
+
|
118
|
+
# Builds the object from hash
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
+
# @return [Object] Returns the model itself
|
121
|
+
def self.build_from_hash(attributes)
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
123
|
+
attributes = attributes.transform_keys(&:to_sym)
|
124
|
+
transformed_hash = {}
|
125
|
+
openapi_types.each_pair do |key, type|
|
126
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
127
|
+
transformed_hash["#{key}"] = nil
|
128
|
+
elsif type =~ /\AArray<(.*)>/i
|
129
|
+
# check to ensure the input is an array given that the attribute
|
130
|
+
# is documented as an array but the input is not
|
131
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
132
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
133
|
+
end
|
134
|
+
elsif !attributes[attribute_map[key]].nil?
|
135
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
136
|
+
end
|
137
|
+
end
|
138
|
+
new(transformed_hash)
|
139
|
+
end
|
140
|
+
|
141
|
+
# Deserializes the data based on type
|
142
|
+
# @param string type Data type
|
143
|
+
# @param string value Value to be deserialized
|
144
|
+
# @return [Object] Deserialized data
|
145
|
+
def self._deserialize(type, value)
|
146
|
+
case type.to_sym
|
147
|
+
when :Time
|
148
|
+
Time.parse(value)
|
149
|
+
when :Date
|
150
|
+
Date.parse(value)
|
151
|
+
when :String
|
152
|
+
value.to_s
|
153
|
+
when :Integer
|
154
|
+
value.to_i
|
155
|
+
when :Float
|
156
|
+
value.to_f
|
157
|
+
when :Boolean
|
158
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
159
|
+
true
|
160
|
+
else
|
161
|
+
false
|
162
|
+
end
|
163
|
+
when :Object
|
164
|
+
# generic object (usually a Hash), return directly
|
165
|
+
value
|
166
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
167
|
+
inner_type = Regexp.last_match[:inner_type]
|
168
|
+
value.map { |v| _deserialize(inner_type, v) }
|
169
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
170
|
+
k_type = Regexp.last_match[:k_type]
|
171
|
+
v_type = Regexp.last_match[:v_type]
|
172
|
+
{}.tap do |hash|
|
173
|
+
value.each do |k, v|
|
174
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
else # model
|
178
|
+
# models (e.g. Pet) or oneOf
|
179
|
+
klass = Coinbase::Client.const_get(type)
|
180
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the string representation of the object
|
185
|
+
# @return [String] String presentation of the object
|
186
|
+
def to_s
|
187
|
+
to_hash.to_s
|
188
|
+
end
|
189
|
+
|
190
|
+
# to_body is an alias to to_hash (backward compatibility)
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_body
|
193
|
+
to_hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns the object in the form of hash
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
198
|
+
def to_hash
|
199
|
+
hash = {}
|
200
|
+
self.class.attribute_map.each_pair do |attr, param|
|
201
|
+
value = self.send(attr)
|
202
|
+
if value.nil?
|
203
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
204
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
205
|
+
end
|
206
|
+
|
207
|
+
hash[param] = _to_hash(value)
|
208
|
+
end
|
209
|
+
hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# Outputs non-array value in the form of hash
|
213
|
+
# For object, use to_hash. Otherwise, just return the value
|
214
|
+
# @param [Object] value Any valid value
|
215
|
+
# @return [Hash] Returns the value in the form of hash
|
216
|
+
def _to_hash(value)
|
217
|
+
if value.is_a?(Array)
|
218
|
+
value.compact.map { |v| _to_hash(v) }
|
219
|
+
elsif value.is_a?(Hash)
|
220
|
+
{}.tap do |hash|
|
221
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
222
|
+
end
|
223
|
+
elsif value.respond_to? :to_hash
|
224
|
+
value.to_hash
|
225
|
+
else
|
226
|
+
value
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|