coinbase-sdk 0.3.0 → 0.6.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 +35 -2
- data/lib/coinbase/address.rb +5 -1
- data/lib/coinbase/client/api/addresses_api.rb +10 -10
- data/lib/coinbase/client/api/assets_api.rb +2 -2
- data/lib/coinbase/client/api/balance_history_api.rb +107 -0
- data/lib/coinbase/client/api/contract_events_api.rb +4 -4
- data/lib/coinbase/client/api/contract_invocations_api.rb +5 -5
- data/lib/coinbase/client/api/external_addresses_api.rb +5 -90
- data/lib/coinbase/client/api/networks_api.rb +2 -2
- data/lib/coinbase/client/api/server_signers_api.rb +7 -7
- data/lib/coinbase/client/api/smart_contracts_api.rb +332 -0
- data/lib/coinbase/client/api/stake_api.rb +6 -14
- data/lib/coinbase/client/api/trades_api.rb +5 -5
- data/lib/coinbase/client/api/transfers_api.rb +5 -5
- data/lib/coinbase/client/api/users_api.rb +2 -2
- data/lib/coinbase/client/api/validators_api.rb +3 -3
- data/lib/coinbase/client/api/wallet_stake_api.rb +4 -4
- data/lib/coinbase/client/api/wallets_api.rb +6 -6
- data/lib/coinbase/client/api/webhooks_api.rb +5 -5
- data/lib/coinbase/client/api_client.rb +30 -24
- 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_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 +1 -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 +19 -2
- 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 +15 -5
- 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 +259 -0
- data/lib/coinbase/client/models/create_staking_operation_request.rb +1 -1
- data/lib/coinbase/client/models/create_trade_request.rb +1 -1
- data/lib/coinbase/client/models/create_transfer_request.rb +2 -2
- 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_webhook_request.rb +11 -9
- data/lib/coinbase/client/models/deploy_smart_contract_request.rb +222 -0
- data/lib/coinbase/client/models/erc20_transfer_event.rb +336 -0
- data/lib/coinbase/client/models/erc721_transfer_event.rb +336 -0
- data/lib/coinbase/client/models/error.rb +15 -5
- data/lib/coinbase/client/models/ethereum_transaction.rb +1 -1
- 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 +1 -1
- 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/get_staking_context_request.rb +1 -1
- data/lib/coinbase/client/models/historical_balance.rb +1 -1
- data/lib/coinbase/client/models/network.rb +1 -1
- data/lib/coinbase/client/models/network_identifier.rb +3 -2
- data/lib/coinbase/client/models/nft_contract_options.rb +240 -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/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 +378 -0
- data/lib/coinbase/client/models/smart_contract_list.rb +257 -0
- data/lib/coinbase/client/models/smart_contract_options.rb +106 -0
- data/lib/coinbase/client/models/smart_contract_type.rb +41 -0
- data/lib/coinbase/client/models/sponsored_send.rb +1 -1
- data/lib/coinbase/client/models/staking_balance.rb +3 -3
- 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 +3 -3
- 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 +257 -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 +11 -9
- 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 +11 -2
- data/lib/coinbase/client/models/webhook_event_filter.rb +4 -4
- data/lib/coinbase/client/models/webhook_event_type.rb +3 -2
- data/lib/coinbase/client/models/webhook_event_type_filter.rb +105 -0
- data/lib/coinbase/client/models/webhook_list.rb +1 -1
- data/lib/coinbase/client/models/webhook_wallet_activity_filter.rb +228 -0
- data/lib/coinbase/client/version.rb +1 -1
- data/lib/coinbase/client.rb +15 -1
- data/lib/coinbase/contract_invocation.rb +34 -10
- data/lib/coinbase/smart_contract.rb +216 -45
- data/lib/coinbase/transaction.rb +3 -0
- data/lib/coinbase/transfer.rb +1 -1
- data/lib/coinbase/version.rb +1 -1
- data/lib/coinbase/wallet.rb +11 -2
- metadata +16 -2
@@ -0,0 +1,106 @@
|
|
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.8.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
# Options for smart contract creation
|
18
|
+
module SmartContractOptions
|
19
|
+
class << self
|
20
|
+
# List of class defined in oneOf (OpenAPI v3)
|
21
|
+
def openapi_one_of
|
22
|
+
[
|
23
|
+
:'NFTContractOptions',
|
24
|
+
:'TokenContractOptions'
|
25
|
+
]
|
26
|
+
end
|
27
|
+
|
28
|
+
# Builds the object
|
29
|
+
# @param [Mixed] Data to be matched against the list of oneOf items
|
30
|
+
# @return [Object] Returns the model or the data itself
|
31
|
+
def build(data)
|
32
|
+
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
33
|
+
# Note:
|
34
|
+
# - We do not attempt to check whether exactly one item matches.
|
35
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
36
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
37
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
38
|
+
# - TODO: logging when debugging is set.
|
39
|
+
openapi_one_of.each do |klass|
|
40
|
+
begin
|
41
|
+
next if klass == :AnyType # "nullable: true"
|
42
|
+
typed_data = find_and_cast_into_type(klass, data)
|
43
|
+
return typed_data if typed_data
|
44
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
openapi_one_of.include?(:AnyType) ? data : nil
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
SchemaMismatchError = Class.new(StandardError)
|
54
|
+
|
55
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
56
|
+
def find_and_cast_into_type(klass, data)
|
57
|
+
return if data.nil?
|
58
|
+
|
59
|
+
case klass.to_s
|
60
|
+
when 'Boolean'
|
61
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
62
|
+
when 'Float'
|
63
|
+
return data if data.instance_of?(Float)
|
64
|
+
when 'Integer'
|
65
|
+
return data if data.instance_of?(Integer)
|
66
|
+
when 'Time'
|
67
|
+
return Time.parse(data)
|
68
|
+
when 'Date'
|
69
|
+
return Date.parse(data)
|
70
|
+
when 'String'
|
71
|
+
return data if data.instance_of?(String)
|
72
|
+
when 'Object' # "type: object"
|
73
|
+
return data if data.instance_of?(Hash)
|
74
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
75
|
+
if data.instance_of?(Array)
|
76
|
+
sub_type = Regexp.last_match[:sub_type]
|
77
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
78
|
+
end
|
79
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
80
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
81
|
+
sub_type = Regexp.last_match[:sub_type]
|
82
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
83
|
+
end
|
84
|
+
else # model
|
85
|
+
const = Coinbase::Client.const_get(klass)
|
86
|
+
if const
|
87
|
+
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
88
|
+
model = const.build(data)
|
89
|
+
return model if model
|
90
|
+
else
|
91
|
+
# raise if data contains keys that are not known to the model
|
92
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
93
|
+
model = const.build_from_hash(data)
|
94
|
+
return model if model
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
raise # if no match by now, raise
|
100
|
+
rescue
|
101
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
@@ -0,0 +1,41 @@
|
|
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.8.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
class SmartContractType
|
18
|
+
ERC20 = "erc20".freeze
|
19
|
+
ERC721 = "erc721".freeze
|
20
|
+
UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
|
21
|
+
|
22
|
+
def self.all_vars
|
23
|
+
@all_vars ||= [ERC20, ERC721, UNKNOWN_DEFAULT_OPEN_API].freeze
|
24
|
+
end
|
25
|
+
|
26
|
+
# Builds the enum from string
|
27
|
+
# @param [String] The enum value in the form of the string
|
28
|
+
# @return [String] The enum value
|
29
|
+
def self.build_from_hash(value)
|
30
|
+
new.build_from_hash(value)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Builds the enum from string
|
34
|
+
# @param [String] The enum value in the form of the string
|
35
|
+
# @return [String] The enum value
|
36
|
+
def build_from_hash(value)
|
37
|
+
return value if SmartContractType.all_vars.include?(value)
|
38
|
+
raise "Invalid ENUM value #{value} for class #SmartContractType"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
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.8.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -19,7 +19,7 @@ module Coinbase::Client
|
|
19
19
|
# The onchain address for which the staking balances are being fetched.
|
20
20
|
attr_accessor :address
|
21
21
|
|
22
|
-
# The
|
22
|
+
# The timestamp of the staking balance in UTC.
|
23
23
|
attr_accessor :date
|
24
24
|
|
25
25
|
attr_accessor :bonded_stake
|
@@ -49,7 +49,7 @@ module Coinbase::Client
|
|
49
49
|
def self.openapi_types
|
50
50
|
{
|
51
51
|
:'address' => :'String',
|
52
|
-
:'date' => :'
|
52
|
+
:'date' => :'Time',
|
53
53
|
:'bonded_stake' => :'Balance',
|
54
54
|
:'unbonded_balance' => :'Balance',
|
55
55
|
:'participant_type' => :'String'
|
@@ -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.8.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -19,7 +19,7 @@ module Coinbase::Client
|
|
19
19
|
# The onchain address for which the staking rewards are being fetched.
|
20
20
|
attr_accessor :address_id
|
21
21
|
|
22
|
-
# The
|
22
|
+
# The timestamp of the reward in UTC.
|
23
23
|
attr_accessor :date
|
24
24
|
|
25
25
|
# The reward amount in requested \"format\". Default is USD.
|
@@ -75,7 +75,7 @@ module Coinbase::Client
|
|
75
75
|
def self.openapi_types
|
76
76
|
{
|
77
77
|
:'address_id' => :'String',
|
78
|
-
:'date' => :'
|
78
|
+
:'date' => :'Time',
|
79
79
|
:'amount' => :'String',
|
80
80
|
:'state' => :'String',
|
81
81
|
:'format' => :'StakingRewardFormat',
|
@@ -0,0 +1,257 @@
|
|
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.8.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
# Options for token contract creation
|
18
|
+
class TokenContractOptions
|
19
|
+
# The name of the token
|
20
|
+
attr_accessor :name
|
21
|
+
|
22
|
+
# The symbol of the token
|
23
|
+
attr_accessor :symbol
|
24
|
+
|
25
|
+
# The total supply of the token denominated in the whole amount of the token.
|
26
|
+
attr_accessor :total_supply
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'name' => :'name',
|
32
|
+
:'symbol' => :'symbol',
|
33
|
+
:'total_supply' => :'total_supply'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Returns all the JSON keys this model knows about
|
38
|
+
def self.acceptable_attributes
|
39
|
+
attribute_map.values
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.openapi_types
|
44
|
+
{
|
45
|
+
:'name' => :'String',
|
46
|
+
:'symbol' => :'String',
|
47
|
+
:'total_supply' => :'String'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# List of attributes with nullable: true
|
52
|
+
def self.openapi_nullable
|
53
|
+
Set.new([
|
54
|
+
])
|
55
|
+
end
|
56
|
+
|
57
|
+
# Initializes the object
|
58
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
59
|
+
def initialize(attributes = {})
|
60
|
+
if (!attributes.is_a?(Hash))
|
61
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::TokenContractOptions` initialize method"
|
62
|
+
end
|
63
|
+
|
64
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
66
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::TokenContractOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
68
|
+
end
|
69
|
+
h[k.to_sym] = v
|
70
|
+
}
|
71
|
+
|
72
|
+
if attributes.key?(:'name')
|
73
|
+
self.name = attributes[:'name']
|
74
|
+
else
|
75
|
+
self.name = nil
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'symbol')
|
79
|
+
self.symbol = attributes[:'symbol']
|
80
|
+
else
|
81
|
+
self.symbol = nil
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'total_supply')
|
85
|
+
self.total_supply = attributes[:'total_supply']
|
86
|
+
else
|
87
|
+
self.total_supply = nil
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
92
|
+
# @return Array for valid properties with the reasons
|
93
|
+
def list_invalid_properties
|
94
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
95
|
+
invalid_properties = Array.new
|
96
|
+
if @name.nil?
|
97
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
98
|
+
end
|
99
|
+
|
100
|
+
if @symbol.nil?
|
101
|
+
invalid_properties.push('invalid value for "symbol", symbol cannot be nil.')
|
102
|
+
end
|
103
|
+
|
104
|
+
if @total_supply.nil?
|
105
|
+
invalid_properties.push('invalid value for "total_supply", total_supply cannot be nil.')
|
106
|
+
end
|
107
|
+
|
108
|
+
invalid_properties
|
109
|
+
end
|
110
|
+
|
111
|
+
# Check to see if the all the properties in the model are valid
|
112
|
+
# @return true if the model is valid
|
113
|
+
def valid?
|
114
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
115
|
+
return false if @name.nil?
|
116
|
+
return false if @symbol.nil?
|
117
|
+
return false if @total_supply.nil?
|
118
|
+
true
|
119
|
+
end
|
120
|
+
|
121
|
+
# Checks equality by comparing each attribute.
|
122
|
+
# @param [Object] Object to be compared
|
123
|
+
def ==(o)
|
124
|
+
return true if self.equal?(o)
|
125
|
+
self.class == o.class &&
|
126
|
+
name == o.name &&
|
127
|
+
symbol == o.symbol &&
|
128
|
+
total_supply == o.total_supply
|
129
|
+
end
|
130
|
+
|
131
|
+
# @see the `==` method
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def eql?(o)
|
134
|
+
self == o
|
135
|
+
end
|
136
|
+
|
137
|
+
# Calculates hash code according to all attributes.
|
138
|
+
# @return [Integer] Hash code
|
139
|
+
def hash
|
140
|
+
[name, symbol, total_supply].hash
|
141
|
+
end
|
142
|
+
|
143
|
+
# Builds the object from hash
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
145
|
+
# @return [Object] Returns the model itself
|
146
|
+
def self.build_from_hash(attributes)
|
147
|
+
return nil unless attributes.is_a?(Hash)
|
148
|
+
attributes = attributes.transform_keys(&:to_sym)
|
149
|
+
transformed_hash = {}
|
150
|
+
openapi_types.each_pair do |key, type|
|
151
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
152
|
+
transformed_hash["#{key}"] = nil
|
153
|
+
elsif type =~ /\AArray<(.*)>/i
|
154
|
+
# check to ensure the input is an array given that the attribute
|
155
|
+
# is documented as an array but the input is not
|
156
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
157
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
158
|
+
end
|
159
|
+
elsif !attributes[attribute_map[key]].nil?
|
160
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
161
|
+
end
|
162
|
+
end
|
163
|
+
new(transformed_hash)
|
164
|
+
end
|
165
|
+
|
166
|
+
# Deserializes the data based on type
|
167
|
+
# @param string type Data type
|
168
|
+
# @param string value Value to be deserialized
|
169
|
+
# @return [Object] Deserialized data
|
170
|
+
def self._deserialize(type, value)
|
171
|
+
case type.to_sym
|
172
|
+
when :Time
|
173
|
+
Time.parse(value)
|
174
|
+
when :Date
|
175
|
+
Date.parse(value)
|
176
|
+
when :String
|
177
|
+
value.to_s
|
178
|
+
when :Integer
|
179
|
+
value.to_i
|
180
|
+
when :Float
|
181
|
+
value.to_f
|
182
|
+
when :Boolean
|
183
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
184
|
+
true
|
185
|
+
else
|
186
|
+
false
|
187
|
+
end
|
188
|
+
when :Object
|
189
|
+
# generic object (usually a Hash), return directly
|
190
|
+
value
|
191
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
192
|
+
inner_type = Regexp.last_match[:inner_type]
|
193
|
+
value.map { |v| _deserialize(inner_type, v) }
|
194
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
195
|
+
k_type = Regexp.last_match[:k_type]
|
196
|
+
v_type = Regexp.last_match[:v_type]
|
197
|
+
{}.tap do |hash|
|
198
|
+
value.each do |k, v|
|
199
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
else # model
|
203
|
+
# models (e.g. Pet) or oneOf
|
204
|
+
klass = Coinbase::Client.const_get(type)
|
205
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns the string representation of the object
|
210
|
+
# @return [String] String presentation of the object
|
211
|
+
def to_s
|
212
|
+
to_hash.to_s
|
213
|
+
end
|
214
|
+
|
215
|
+
# to_body is an alias to to_hash (backward compatibility)
|
216
|
+
# @return [Hash] Returns the object in the form of hash
|
217
|
+
def to_body
|
218
|
+
to_hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# Returns the object in the form of hash
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
223
|
+
def to_hash
|
224
|
+
hash = {}
|
225
|
+
self.class.attribute_map.each_pair do |attr, param|
|
226
|
+
value = self.send(attr)
|
227
|
+
if value.nil?
|
228
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
229
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
230
|
+
end
|
231
|
+
|
232
|
+
hash[param] = _to_hash(value)
|
233
|
+
end
|
234
|
+
hash
|
235
|
+
end
|
236
|
+
|
237
|
+
# Outputs non-array value in the form of hash
|
238
|
+
# For object, use to_hash. Otherwise, just return the value
|
239
|
+
# @param [Object] value Any valid value
|
240
|
+
# @return [Hash] Returns the value in the form of hash
|
241
|
+
def _to_hash(value)
|
242
|
+
if value.is_a?(Array)
|
243
|
+
value.compact.map { |v| _to_hash(v) }
|
244
|
+
elsif value.is_a?(Hash)
|
245
|
+
{}.tap do |hash|
|
246
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
247
|
+
end
|
248
|
+
elsif value.respond_to? :to_hash
|
249
|
+
value.to_hash
|
250
|
+
else
|
251
|
+
value
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
end
|
256
|
+
|
257
|
+
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.8.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -15,6 +15,8 @@ require 'time'
|
|
15
15
|
|
16
16
|
module Coinbase::Client
|
17
17
|
class UpdateWebhookRequest
|
18
|
+
attr_accessor :event_type_filter
|
19
|
+
|
18
20
|
# Webhook will monitor all events that matches any one of the event filters.
|
19
21
|
attr_accessor :event_filters
|
20
22
|
|
@@ -24,6 +26,7 @@ module Coinbase::Client
|
|
24
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
25
27
|
def self.attribute_map
|
26
28
|
{
|
29
|
+
:'event_type_filter' => :'event_type_filter',
|
27
30
|
:'event_filters' => :'event_filters',
|
28
31
|
:'notification_uri' => :'notification_uri'
|
29
32
|
}
|
@@ -37,6 +40,7 @@ module Coinbase::Client
|
|
37
40
|
# Attribute type mapping.
|
38
41
|
def self.openapi_types
|
39
42
|
{
|
43
|
+
:'event_type_filter' => :'WebhookEventTypeFilter',
|
40
44
|
:'event_filters' => :'Array<WebhookEventFilter>',
|
41
45
|
:'notification_uri' => :'String'
|
42
46
|
}
|
@@ -63,12 +67,14 @@ module Coinbase::Client
|
|
63
67
|
h[k.to_sym] = v
|
64
68
|
}
|
65
69
|
|
70
|
+
if attributes.key?(:'event_type_filter')
|
71
|
+
self.event_type_filter = attributes[:'event_type_filter']
|
72
|
+
end
|
73
|
+
|
66
74
|
if attributes.key?(:'event_filters')
|
67
75
|
if (value = attributes[:'event_filters']).is_a?(Array)
|
68
76
|
self.event_filters = value
|
69
77
|
end
|
70
|
-
else
|
71
|
-
self.event_filters = nil
|
72
78
|
end
|
73
79
|
|
74
80
|
if attributes.key?(:'notification_uri')
|
@@ -83,10 +89,6 @@ module Coinbase::Client
|
|
83
89
|
def list_invalid_properties
|
84
90
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
85
91
|
invalid_properties = Array.new
|
86
|
-
if @event_filters.nil?
|
87
|
-
invalid_properties.push('invalid value for "event_filters", event_filters cannot be nil.')
|
88
|
-
end
|
89
|
-
|
90
92
|
if @notification_uri.nil?
|
91
93
|
invalid_properties.push('invalid value for "notification_uri", notification_uri cannot be nil.')
|
92
94
|
end
|
@@ -98,7 +100,6 @@ module Coinbase::Client
|
|
98
100
|
# @return true if the model is valid
|
99
101
|
def valid?
|
100
102
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
101
|
-
return false if @event_filters.nil?
|
102
103
|
return false if @notification_uri.nil?
|
103
104
|
true
|
104
105
|
end
|
@@ -108,6 +109,7 @@ module Coinbase::Client
|
|
108
109
|
def ==(o)
|
109
110
|
return true if self.equal?(o)
|
110
111
|
self.class == o.class &&
|
112
|
+
event_type_filter == o.event_type_filter &&
|
111
113
|
event_filters == o.event_filters &&
|
112
114
|
notification_uri == o.notification_uri
|
113
115
|
end
|
@@ -121,7 +123,7 @@ module Coinbase::Client
|
|
121
123
|
# Calculates hash code according to all attributes.
|
122
124
|
# @return [Integer] Hash code
|
123
125
|
def hash
|
124
|
-
[event_filters, notification_uri].hash
|
126
|
+
[event_type_filter, event_filters, notification_uri].hash
|
125
127
|
end
|
126
128
|
|
127
129
|
# Builds the object from hash
|