coinbase-sdk 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/external_address.rb +3 -166
  3. data/lib/coinbase/address/wallet_address.rb +44 -0
  4. data/lib/coinbase/address.rb +128 -0
  5. data/lib/coinbase/client/api/addresses_api.rb +1 -1
  6. data/lib/coinbase/client/api/assets_api.rb +3 -3
  7. data/lib/coinbase/client/api/contract_events_api.rb +121 -0
  8. data/lib/coinbase/client/api/external_addresses_api.rb +1 -1
  9. data/lib/coinbase/client/api/server_signers_api.rb +1 -1
  10. data/lib/coinbase/client/api/stake_api.rb +242 -1
  11. data/lib/coinbase/client/api/trades_api.rb +1 -1
  12. data/lib/coinbase/client/api/transfers_api.rb +1 -1
  13. data/lib/coinbase/client/api/users_api.rb +1 -1
  14. data/lib/coinbase/client/api/validators_api.rb +1 -1
  15. data/lib/coinbase/client/api/wallets_api.rb +1 -1
  16. data/lib/coinbase/client/api/webhooks_api.rb +286 -0
  17. data/lib/coinbase/client/api_client.rb +1 -1
  18. data/lib/coinbase/client/api_error.rb +1 -1
  19. data/lib/coinbase/client/configuration.rb +11 -1
  20. data/lib/coinbase/client/models/address.rb +1 -1
  21. data/lib/coinbase/client/models/address_balance_list.rb +1 -1
  22. data/lib/coinbase/client/models/address_list.rb +1 -1
  23. data/lib/coinbase/client/models/asset.rb +1 -1
  24. data/lib/coinbase/client/models/balance.rb +1 -1
  25. data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +239 -0
  26. data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
  27. data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
  28. data/lib/coinbase/client/models/build_staking_operation_request.rb +1 -1
  29. data/lib/coinbase/client/models/contract_event.rb +336 -0
  30. data/lib/coinbase/client/models/contract_event_list.rb +259 -0
  31. data/lib/coinbase/client/models/create_address_request.rb +1 -1
  32. data/lib/coinbase/client/models/create_server_signer_request.rb +1 -1
  33. data/lib/coinbase/client/models/create_staking_operation_request.rb +274 -0
  34. data/lib/coinbase/client/models/create_trade_request.rb +1 -1
  35. data/lib/coinbase/client/models/create_transfer_request.rb +1 -1
  36. data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
  37. data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
  38. data/lib/coinbase/client/models/create_webhook_request.rb +282 -0
  39. data/lib/coinbase/client/models/error.rb +1 -1
  40. data/lib/coinbase/client/models/ethereum_validator_metadata.rb +1 -1
  41. data/lib/coinbase/client/models/faucet_transaction.rb +1 -1
  42. data/lib/coinbase/client/models/feature.rb +1 -1
  43. data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +1 -1
  44. data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +1 -1
  45. data/lib/coinbase/client/models/get_staking_context_request.rb +1 -1
  46. data/lib/coinbase/client/models/native_eth_staking_context.rb +1 -1
  47. data/lib/coinbase/client/models/partial_eth_staking_context.rb +1 -1
  48. data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
  49. data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
  50. data/lib/coinbase/client/models/server_signer.rb +1 -1
  51. data/lib/coinbase/client/models/server_signer_event.rb +1 -1
  52. data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
  53. data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
  54. data/lib/coinbase/client/models/server_signer_list.rb +1 -1
  55. data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
  56. data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
  57. data/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +1 -1
  58. data/lib/coinbase/client/models/staking_context.rb +1 -1
  59. data/lib/coinbase/client/models/staking_context_context.rb +1 -1
  60. data/lib/coinbase/client/models/staking_operation.rb +16 -6
  61. data/lib/coinbase/client/models/staking_operation_metadata.rb +1 -1
  62. data/lib/coinbase/client/models/staking_reward.rb +1 -1
  63. data/lib/coinbase/client/models/staking_reward_format.rb +1 -1
  64. data/lib/coinbase/client/models/trade.rb +1 -1
  65. data/lib/coinbase/client/models/trade_list.rb +1 -1
  66. data/lib/coinbase/client/models/transaction.rb +1 -1
  67. data/lib/coinbase/client/models/transaction_type.rb +1 -1
  68. data/lib/coinbase/client/models/transfer.rb +5 -93
  69. data/lib/coinbase/client/models/transfer_list.rb +1 -1
  70. data/lib/coinbase/client/models/update_webhook_request.rb +289 -0
  71. data/lib/coinbase/client/models/user.rb +1 -1
  72. data/lib/coinbase/client/models/validator.rb +1 -1
  73. data/lib/coinbase/client/models/validator_details.rb +1 -1
  74. data/lib/coinbase/client/models/validator_list.rb +1 -1
  75. data/lib/coinbase/client/models/wallet.rb +1 -1
  76. data/lib/coinbase/client/models/wallet_list.rb +1 -1
  77. data/lib/coinbase/client/models/webhook.rb +299 -0
  78. data/lib/coinbase/client/models/webhook_event_filter.rb +236 -0
  79. data/lib/coinbase/client/models/webhook_event_type.rb +41 -0
  80. data/lib/coinbase/client/models/webhook_list.rb +244 -0
  81. data/lib/coinbase/client/version.rb +1 -1
  82. data/lib/coinbase/client.rb +13 -1
  83. data/lib/coinbase/middleware.rb +12 -0
  84. data/lib/coinbase/staking_operation.rb +106 -5
  85. data/lib/coinbase/trade.rb +1 -1
  86. data/lib/coinbase/transfer.rb +4 -5
  87. data/lib/coinbase/wallet.rb +76 -0
  88. data/lib/coinbase.rb +2 -1
  89. metadata +28 -2
@@ -0,0 +1,299 @@
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
+ Contact: yuga.cohler@coinbase.com
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
+ # Webhook that is used for getting notifications when monitored events occur.
18
+ class Webhook
19
+ # Identifier of the webhook.
20
+ attr_accessor :id
21
+
22
+ # The ID of the blockchain network
23
+ attr_accessor :network_id
24
+
25
+ attr_accessor :event_type
26
+
27
+ # Webhook will monitor all events that matches any one of the event filters.
28
+ attr_accessor :event_filters
29
+
30
+ # The URL to which the notifications will be sent.
31
+ attr_accessor :notification_uri
32
+
33
+ # The date and time the webhook was created.
34
+ attr_accessor :created_at
35
+
36
+ # The date and time the webhook was last updated.
37
+ attr_accessor :updated_at
38
+
39
+ class EnumAttributeValidator
40
+ attr_reader :datatype
41
+ attr_reader :allowable_values
42
+
43
+ def initialize(datatype, allowable_values)
44
+ @allowable_values = allowable_values.map do |value|
45
+ case datatype.to_s
46
+ when /Integer/i
47
+ value.to_i
48
+ when /Float/i
49
+ value.to_f
50
+ else
51
+ value
52
+ end
53
+ end
54
+ end
55
+
56
+ def valid?(value)
57
+ !value || allowable_values.include?(value)
58
+ end
59
+ end
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'id' => :'id',
65
+ :'network_id' => :'network_id',
66
+ :'event_type' => :'event_type',
67
+ :'event_filters' => :'event_filters',
68
+ :'notification_uri' => :'notification_uri',
69
+ :'created_at' => :'created_at',
70
+ :'updated_at' => :'updated_at'
71
+ }
72
+ end
73
+
74
+ # Returns all the JSON keys this model knows about
75
+ def self.acceptable_attributes
76
+ attribute_map.values
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'id' => :'String',
83
+ :'network_id' => :'String',
84
+ :'event_type' => :'WebhookEventType',
85
+ :'event_filters' => :'Array<WebhookEventFilter>',
86
+ :'notification_uri' => :'String',
87
+ :'created_at' => :'Time',
88
+ :'updated_at' => :'Time'
89
+ }
90
+ end
91
+
92
+ # List of attributes with nullable: true
93
+ def self.openapi_nullable
94
+ Set.new([
95
+ ])
96
+ end
97
+
98
+ # Initializes the object
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ def initialize(attributes = {})
101
+ if (!attributes.is_a?(Hash))
102
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::Webhook` initialize method"
103
+ end
104
+
105
+ # check to see if the attribute exists and convert string to symbol for hash key
106
+ attributes = attributes.each_with_object({}) { |(k, v), h|
107
+ if (!self.class.attribute_map.key?(k.to_sym))
108
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::Webhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
109
+ end
110
+ h[k.to_sym] = v
111
+ }
112
+
113
+ if attributes.key?(:'id')
114
+ self.id = attributes[:'id']
115
+ end
116
+
117
+ if attributes.key?(:'network_id')
118
+ self.network_id = attributes[:'network_id']
119
+ end
120
+
121
+ if attributes.key?(:'event_type')
122
+ self.event_type = attributes[:'event_type']
123
+ end
124
+
125
+ if attributes.key?(:'event_filters')
126
+ if (value = attributes[:'event_filters']).is_a?(Array)
127
+ self.event_filters = value
128
+ end
129
+ end
130
+
131
+ if attributes.key?(:'notification_uri')
132
+ self.notification_uri = attributes[:'notification_uri']
133
+ end
134
+
135
+ if attributes.key?(:'created_at')
136
+ self.created_at = attributes[:'created_at']
137
+ end
138
+
139
+ if attributes.key?(:'updated_at')
140
+ self.updated_at = attributes[:'updated_at']
141
+ end
142
+ end
143
+
144
+ # Show invalid properties with the reasons. Usually used together with valid?
145
+ # @return Array for valid properties with the reasons
146
+ def list_invalid_properties
147
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
148
+ invalid_properties = Array.new
149
+ invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ warn '[DEPRECATED] the `valid?` method is obsolete'
156
+ true
157
+ end
158
+
159
+ # Checks equality by comparing each attribute.
160
+ # @param [Object] Object to be compared
161
+ def ==(o)
162
+ return true if self.equal?(o)
163
+ self.class == o.class &&
164
+ id == o.id &&
165
+ network_id == o.network_id &&
166
+ event_type == o.event_type &&
167
+ event_filters == o.event_filters &&
168
+ notification_uri == o.notification_uri &&
169
+ created_at == o.created_at &&
170
+ updated_at == o.updated_at
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(o)
176
+ self == o
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Integer] Hash code
181
+ def hash
182
+ [id, network_id, event_type, event_filters, notification_uri, created_at, updated_at].hash
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def self.build_from_hash(attributes)
189
+ return nil unless attributes.is_a?(Hash)
190
+ attributes = attributes.transform_keys(&:to_sym)
191
+ transformed_hash = {}
192
+ openapi_types.each_pair do |key, type|
193
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
194
+ transformed_hash["#{key}"] = nil
195
+ elsif type =~ /\AArray<(.*)>/i
196
+ # check to ensure the input is an array given that the attribute
197
+ # is documented as an array but the input is not
198
+ if attributes[attribute_map[key]].is_a?(Array)
199
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
200
+ end
201
+ elsif !attributes[attribute_map[key]].nil?
202
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
203
+ end
204
+ end
205
+ new(transformed_hash)
206
+ end
207
+
208
+ # Deserializes the data based on type
209
+ # @param string type Data type
210
+ # @param string value Value to be deserialized
211
+ # @return [Object] Deserialized data
212
+ def self._deserialize(type, value)
213
+ case type.to_sym
214
+ when :Time
215
+ Time.parse(value)
216
+ when :Date
217
+ Date.parse(value)
218
+ when :String
219
+ value.to_s
220
+ when :Integer
221
+ value.to_i
222
+ when :Float
223
+ value.to_f
224
+ when :Boolean
225
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
226
+ true
227
+ else
228
+ false
229
+ end
230
+ when :Object
231
+ # generic object (usually a Hash), return directly
232
+ value
233
+ when /\AArray<(?<inner_type>.+)>\z/
234
+ inner_type = Regexp.last_match[:inner_type]
235
+ value.map { |v| _deserialize(inner_type, v) }
236
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
237
+ k_type = Regexp.last_match[:k_type]
238
+ v_type = Regexp.last_match[:v_type]
239
+ {}.tap do |hash|
240
+ value.each do |k, v|
241
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
242
+ end
243
+ end
244
+ else # model
245
+ # models (e.g. Pet) or oneOf
246
+ klass = Coinbase::Client.const_get(type)
247
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
248
+ end
249
+ end
250
+
251
+ # Returns the string representation of the object
252
+ # @return [String] String presentation of the object
253
+ def to_s
254
+ to_hash.to_s
255
+ end
256
+
257
+ # to_body is an alias to to_hash (backward compatibility)
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_body
260
+ to_hash
261
+ end
262
+
263
+ # Returns the object in the form of hash
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_hash
266
+ hash = {}
267
+ self.class.attribute_map.each_pair do |attr, param|
268
+ value = self.send(attr)
269
+ if value.nil?
270
+ is_nullable = self.class.openapi_nullable.include?(attr)
271
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
272
+ end
273
+
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map { |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+
297
+ end
298
+
299
+ end
@@ -0,0 +1,236 @@
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
+ Contact: yuga.cohler@coinbase.com
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
+ # The event_filter parameter specifies the criteria to filter events from the blockchain. It allows filtering events by contract address, sender address and receiver address. For a single event filter, not all of the properties need to be presented.
18
+ class WebhookEventFilter
19
+ # The onchain contract address of the token being transferred.
20
+ attr_accessor :contract_address
21
+
22
+ # The onchain address of the sender.
23
+ attr_accessor :from_address
24
+
25
+ # The onchain address of the receiver.
26
+ attr_accessor :to_address
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'contract_address' => :'contract_address',
32
+ :'from_address' => :'from_address',
33
+ :'to_address' => :'to_address'
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
+ :'contract_address' => :'String',
46
+ :'from_address' => :'String',
47
+ :'to_address' => :'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::WebhookEventFilter` 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::WebhookEventFilter`. 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?(:'contract_address')
73
+ self.contract_address = attributes[:'contract_address']
74
+ end
75
+
76
+ if attributes.key?(:'from_address')
77
+ self.from_address = attributes[:'from_address']
78
+ end
79
+
80
+ if attributes.key?(:'to_address')
81
+ self.to_address = attributes[:'to_address']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ warn '[DEPRECATED] the `valid?` method is obsolete'
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ contract_address == o.contract_address &&
106
+ from_address == o.from_address &&
107
+ to_address == o.to_address
108
+ end
109
+
110
+ # @see the `==` method
111
+ # @param [Object] Object to be compared
112
+ def eql?(o)
113
+ self == o
114
+ end
115
+
116
+ # Calculates hash code according to all attributes.
117
+ # @return [Integer] Hash code
118
+ def hash
119
+ [contract_address, from_address, to_address].hash
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def self.build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ attributes = attributes.transform_keys(&:to_sym)
128
+ transformed_hash = {}
129
+ openapi_types.each_pair do |key, type|
130
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
131
+ transformed_hash["#{key}"] = nil
132
+ elsif type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[attribute_map[key]].is_a?(Array)
136
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
137
+ end
138
+ elsif !attributes[attribute_map[key]].nil?
139
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
140
+ end
141
+ end
142
+ new(transformed_hash)
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def self._deserialize(type, value)
150
+ case type.to_sym
151
+ when :Time
152
+ Time.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ # models (e.g. Pet) or oneOf
183
+ klass = Coinbase::Client.const_get(type)
184
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
185
+ end
186
+ end
187
+
188
+ # Returns the string representation of the object
189
+ # @return [String] String presentation of the object
190
+ def to_s
191
+ to_hash.to_s
192
+ end
193
+
194
+ # to_body is an alias to to_hash (backward compatibility)
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_body
197
+ to_hash
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = self.send(attr)
206
+ if value.nil?
207
+ is_nullable = self.class.openapi_nullable.include?(attr)
208
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
+ end
210
+
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+
236
+ 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
+ Contact: yuga.cohler@coinbase.com
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 WebhookEventType
18
+ UNSPECIFIED = "unspecified".freeze
19
+ ERC20_TRANSFER = "erc20_transfer".freeze
20
+ ERC721_TRANSFER = "erc721_transfer".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [UNSPECIFIED, ERC20_TRANSFER, ERC721_TRANSFER].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 WebhookEventType.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #WebhookEventType"
39
+ end
40
+ end
41
+ end