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,266 @@
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 CreateContractInvocationRequest
18
+ # The address of the contract to invoke.
19
+ attr_accessor :contract_address
20
+
21
+ # The method to invoke on the contract.
22
+ attr_accessor :method
23
+
24
+ # 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.
25
+ attr_accessor :args
26
+
27
+ # The JSON-encoded ABI of the contract.
28
+ attr_accessor :abi
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'contract_address' => :'contract_address',
34
+ :'method' => :'method',
35
+ :'args' => :'args',
36
+ :'abi' => :'abi'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'contract_address' => :'String',
49
+ :'method' => :'String',
50
+ :'args' => :'String',
51
+ :'abi' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::CreateContractInvocationRequest` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::CreateContractInvocationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'contract_address')
77
+ self.contract_address = attributes[:'contract_address']
78
+ else
79
+ self.contract_address = nil
80
+ end
81
+
82
+ if attributes.key?(:'method')
83
+ self.method = attributes[:'method']
84
+ else
85
+ self.method = nil
86
+ end
87
+
88
+ if attributes.key?(:'args')
89
+ self.args = attributes[:'args']
90
+ else
91
+ self.args = nil
92
+ end
93
+
94
+ if attributes.key?(:'abi')
95
+ self.abi = attributes[:'abi']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ if @contract_address.nil?
105
+ invalid_properties.push('invalid value for "contract_address", contract_address cannot be nil.')
106
+ end
107
+
108
+ if @method.nil?
109
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
110
+ end
111
+
112
+ if @args.nil?
113
+ invalid_properties.push('invalid value for "args", args cannot be nil.')
114
+ end
115
+
116
+ invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ warn '[DEPRECATED] the `valid?` method is obsolete'
123
+ return false if @contract_address.nil?
124
+ return false if @method.nil?
125
+ return false if @args.nil?
126
+ true
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ contract_address == o.contract_address &&
135
+ method == o.method &&
136
+ args == o.args &&
137
+ abi == o.abi
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [contract_address, method, args, abi].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ attributes = attributes.transform_keys(&:to_sym)
158
+ transformed_hash = {}
159
+ openapi_types.each_pair do |key, type|
160
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = nil
162
+ elsif type =~ /\AArray<(.*)>/i
163
+ # check to ensure the input is an array given that the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[attribute_map[key]].is_a?(Array)
166
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
167
+ end
168
+ elsif !attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
170
+ end
171
+ end
172
+ new(transformed_hash)
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def self._deserialize(type, value)
180
+ case type.to_sym
181
+ when :Time
182
+ Time.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value.to_s
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ # models (e.g. Pet) or oneOf
213
+ klass = Coinbase::Client.const_get(type)
214
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+
264
+ end
265
+
266
+ end
@@ -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.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Coinbase::Client
17
+ class CreatePayloadSignatureRequest
18
+ # The unsigned payload.
19
+ attr_accessor :unsigned_payload
20
+
21
+ # The signature of the payload.
22
+ attr_accessor :signature
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'unsigned_payload' => :'unsigned_payload',
28
+ :'signature' => :'signature'
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
+ :'unsigned_payload' => :'String',
41
+ :'signature' => :'String'
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::CreatePayloadSignatureRequest` 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::CreatePayloadSignatureRequest`. 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?(:'unsigned_payload')
67
+ self.unsigned_payload = attributes[:'unsigned_payload']
68
+ else
69
+ self.unsigned_payload = nil
70
+ end
71
+
72
+ if attributes.key?(:'signature')
73
+ self.signature = attributes[:'signature']
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 @unsigned_payload.nil?
83
+ invalid_properties.push('invalid value for "unsigned_payload", unsigned_payload 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 @unsigned_payload.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
+ unsigned_payload == o.unsigned_payload &&
103
+ signature == o.signature
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
+ [unsigned_payload, signature].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
@@ -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
 
@@ -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
 
@@ -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
 
@@ -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
 
@@ -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
 
@@ -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
 
@@ -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
 
@@ -26,6 +26,9 @@ module Coinbase::Client
26
26
  # The URL to which the notifications will be sent
27
27
  attr_accessor :notification_uri
28
28
 
29
+ # The custom header to be used for x-webhook-signature header on callbacks, so developers can verify the requests are coming from Coinbase.
30
+ attr_accessor :signature_header
31
+
29
32
  class EnumAttributeValidator
30
33
  attr_reader :datatype
31
34
  attr_reader :allowable_values
@@ -54,7 +57,8 @@ module Coinbase::Client
54
57
  :'network_id' => :'network_id',
55
58
  :'event_type' => :'event_type',
56
59
  :'event_filters' => :'event_filters',
57
- :'notification_uri' => :'notification_uri'
60
+ :'notification_uri' => :'notification_uri',
61
+ :'signature_header' => :'signature_header'
58
62
  }
59
63
  end
60
64
 
@@ -69,7 +73,8 @@ module Coinbase::Client
69
73
  :'network_id' => :'String',
70
74
  :'event_type' => :'WebhookEventType',
71
75
  :'event_filters' => :'Array<WebhookEventFilter>',
72
- :'notification_uri' => :'String'
76
+ :'notification_uri' => :'String',
77
+ :'signature_header' => :'String'
73
78
  }
74
79
  end
75
80
 
@@ -102,12 +107,16 @@ module Coinbase::Client
102
107
 
103
108
  if attributes.key?(:'event_type')
104
109
  self.event_type = attributes[:'event_type']
110
+ else
111
+ self.event_type = nil
105
112
  end
106
113
 
107
114
  if attributes.key?(:'event_filters')
108
115
  if (value = attributes[:'event_filters']).is_a?(Array)
109
116
  self.event_filters = value
110
117
  end
118
+ else
119
+ self.event_filters = nil
111
120
  end
112
121
 
113
122
  if attributes.key?(:'notification_uri')
@@ -115,6 +124,10 @@ module Coinbase::Client
115
124
  else
116
125
  self.notification_uri = nil
117
126
  end
127
+
128
+ if attributes.key?(:'signature_header')
129
+ self.signature_header = attributes[:'signature_header']
130
+ end
118
131
  end
119
132
 
120
133
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -126,6 +139,14 @@ module Coinbase::Client
126
139
  invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
127
140
  end
128
141
 
142
+ if @event_type.nil?
143
+ invalid_properties.push('invalid value for "event_type", event_type cannot be nil.')
144
+ end
145
+
146
+ if @event_filters.nil?
147
+ invalid_properties.push('invalid value for "event_filters", event_filters cannot be nil.')
148
+ end
149
+
129
150
  if @notification_uri.nil?
130
151
  invalid_properties.push('invalid value for "notification_uri", notification_uri cannot be nil.')
131
152
  end
@@ -138,6 +159,8 @@ module Coinbase::Client
138
159
  def valid?
139
160
  warn '[DEPRECATED] the `valid?` method is obsolete'
140
161
  return false if @network_id.nil?
162
+ return false if @event_type.nil?
163
+ return false if @event_filters.nil?
141
164
  return false if @notification_uri.nil?
142
165
  true
143
166
  end
@@ -150,7 +173,8 @@ module Coinbase::Client
150
173
  network_id == o.network_id &&
151
174
  event_type == o.event_type &&
152
175
  event_filters == o.event_filters &&
153
- notification_uri == o.notification_uri
176
+ notification_uri == o.notification_uri &&
177
+ signature_header == o.signature_header
154
178
  end
155
179
 
156
180
  # @see the `==` method
@@ -162,7 +186,7 @@ module Coinbase::Client
162
186
  # Calculates hash code according to all attributes.
163
187
  # @return [Integer] Hash code
164
188
  def hash
165
- [network_id, event_type, event_filters, notification_uri].hash
189
+ [network_id, event_type, event_filters, notification_uri, signature_header].hash
166
190
  end
167
191
 
168
192
  # Builds the object from hash
@@ -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