coinbase-sdk 0.0.10 → 0.0.14
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/external_address.rb +3 -166
- data/lib/coinbase/address/wallet_address.rb +80 -107
- data/lib/coinbase/address.rb +128 -0
- data/lib/coinbase/client/api/addresses_api.rb +1 -1
- data/lib/coinbase/client/api/assets_api.rb +3 -3
- data/lib/coinbase/client/api/contract_events_api.rb +121 -0
- data/lib/coinbase/client/api/external_addresses_api.rb +1 -1
- data/lib/coinbase/client/api/server_signers_api.rb +1 -1
- data/lib/coinbase/client/api/stake_api.rb +242 -1
- data/lib/coinbase/client/api/trades_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/validators_api.rb +1 -1
- data/lib/coinbase/client/api/wallets_api.rb +1 -1
- data/lib/coinbase/client/api/webhooks_api.rb +286 -0
- data/lib/coinbase/client/api_client.rb +1 -1
- data/lib/coinbase/client/api_error.rb +1 -1
- data/lib/coinbase/client/configuration.rb +11 -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_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_staking_operation_request.rb +239 -0
- 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 +336 -0
- data/lib/coinbase/client/models/contract_event_list.rb +259 -0
- data/lib/coinbase/client/models/create_address_request.rb +1 -1
- data/lib/coinbase/client/models/create_server_signer_request.rb +1 -1
- data/lib/coinbase/client/models/create_staking_operation_request.rb +274 -0
- 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_webhook_request.rb +282 -0
- data/lib/coinbase/client/models/error.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.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/native_eth_staking_context.rb +1 -1
- data/lib/coinbase/client/models/partial_eth_staking_context.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/staking_context.rb +1 -1
- data/lib/coinbase/client/models/staking_context_context.rb +1 -1
- data/lib/coinbase/client/models/staking_operation.rb +16 -6
- 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/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_type.rb +1 -1
- data/lib/coinbase/client/models/transfer.rb +5 -93
- data/lib/coinbase/client/models/transfer_list.rb +1 -1
- data/lib/coinbase/client/models/update_webhook_request.rb +289 -0
- 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/wallet.rb +1 -1
- data/lib/coinbase/client/models/wallet_list.rb +1 -1
- data/lib/coinbase/client/models/webhook.rb +299 -0
- data/lib/coinbase/client/models/webhook_event_filter.rb +236 -0
- data/lib/coinbase/client/models/webhook_event_type.rb +41 -0
- data/lib/coinbase/client/models/webhook_list.rb +244 -0
- data/lib/coinbase/client/version.rb +1 -1
- data/lib/coinbase/client.rb +13 -1
- data/lib/coinbase/constants.rb +3 -0
- data/lib/coinbase/destination.rb +51 -0
- data/lib/coinbase/errors.rb +14 -0
- data/lib/coinbase/middleware.rb +12 -0
- data/lib/coinbase/staking_operation.rb +106 -5
- data/lib/coinbase/trade.rb +87 -5
- data/lib/coinbase/transaction.rb +13 -2
- data/lib/coinbase/transfer.rb +86 -7
- data/lib/coinbase/wallet.rb +77 -4
- data/lib/coinbase.rb +3 -1
- metadata +29 -2
@@ -0,0 +1,286 @@
|
|
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 'cgi'
|
14
|
+
|
15
|
+
module Coinbase::Client
|
16
|
+
class WebhooksApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Create a new webhook
|
23
|
+
# Create a new webhook
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @option opts [CreateWebhookRequest] :create_webhook_request
|
26
|
+
# @return [Webhook]
|
27
|
+
def create_webhook(opts = {})
|
28
|
+
data, _status_code, _headers = create_webhook_with_http_info(opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Create a new webhook
|
33
|
+
# Create a new webhook
|
34
|
+
# @param [Hash] opts the optional parameters
|
35
|
+
# @option opts [CreateWebhookRequest] :create_webhook_request
|
36
|
+
# @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
|
37
|
+
def create_webhook_with_http_info(opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.create_webhook ...'
|
40
|
+
end
|
41
|
+
# resource path
|
42
|
+
local_var_path = '/v1/webhooks'
|
43
|
+
|
44
|
+
# query parameters
|
45
|
+
query_params = opts[:query_params] || {}
|
46
|
+
|
47
|
+
# header parameters
|
48
|
+
header_params = opts[:header_params] || {}
|
49
|
+
# HTTP header 'Accept' (if needed)
|
50
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
51
|
+
# HTTP header 'Content-Type'
|
52
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
53
|
+
if !content_type.nil?
|
54
|
+
header_params['Content-Type'] = content_type
|
55
|
+
end
|
56
|
+
|
57
|
+
# form parameters
|
58
|
+
form_params = opts[:form_params] || {}
|
59
|
+
|
60
|
+
# http body (model)
|
61
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_webhook_request'])
|
62
|
+
|
63
|
+
# return_type
|
64
|
+
return_type = opts[:debug_return_type] || 'Webhook'
|
65
|
+
|
66
|
+
# auth_names
|
67
|
+
auth_names = opts[:debug_auth_names] || []
|
68
|
+
|
69
|
+
new_options = opts.merge(
|
70
|
+
:operation => :"WebhooksApi.create_webhook",
|
71
|
+
:header_params => header_params,
|
72
|
+
:query_params => query_params,
|
73
|
+
:form_params => form_params,
|
74
|
+
:body => post_body,
|
75
|
+
:auth_names => auth_names,
|
76
|
+
:return_type => return_type
|
77
|
+
)
|
78
|
+
|
79
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
80
|
+
if @api_client.config.debugging
|
81
|
+
@api_client.config.logger.debug "API called: WebhooksApi#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
82
|
+
end
|
83
|
+
return data, status_code, headers
|
84
|
+
end
|
85
|
+
|
86
|
+
# Delete a webhook
|
87
|
+
# Delete a webhook
|
88
|
+
# @param webhook_id [String] The Webhook uuid that needs to be deleted
|
89
|
+
# @param [Hash] opts the optional parameters
|
90
|
+
# @return [nil]
|
91
|
+
def delete_webhook(webhook_id, opts = {})
|
92
|
+
delete_webhook_with_http_info(webhook_id, opts)
|
93
|
+
nil
|
94
|
+
end
|
95
|
+
|
96
|
+
# Delete a webhook
|
97
|
+
# Delete a webhook
|
98
|
+
# @param webhook_id [String] The Webhook uuid that needs to be deleted
|
99
|
+
# @param [Hash] opts the optional parameters
|
100
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
101
|
+
def delete_webhook_with_http_info(webhook_id, opts = {})
|
102
|
+
if @api_client.config.debugging
|
103
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.delete_webhook ...'
|
104
|
+
end
|
105
|
+
# verify the required parameter 'webhook_id' is set
|
106
|
+
if @api_client.config.client_side_validation && webhook_id.nil?
|
107
|
+
fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.delete_webhook"
|
108
|
+
end
|
109
|
+
# resource path
|
110
|
+
local_var_path = '/v1/webhooks/{webhook_id}'.sub('{' + 'webhook_id' + '}', CGI.escape(webhook_id.to_s))
|
111
|
+
|
112
|
+
# query parameters
|
113
|
+
query_params = opts[:query_params] || {}
|
114
|
+
|
115
|
+
# header parameters
|
116
|
+
header_params = opts[:header_params] || {}
|
117
|
+
# HTTP header 'Accept' (if needed)
|
118
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
119
|
+
|
120
|
+
# form parameters
|
121
|
+
form_params = opts[:form_params] || {}
|
122
|
+
|
123
|
+
# http body (model)
|
124
|
+
post_body = opts[:debug_body]
|
125
|
+
|
126
|
+
# return_type
|
127
|
+
return_type = opts[:debug_return_type]
|
128
|
+
|
129
|
+
# auth_names
|
130
|
+
auth_names = opts[:debug_auth_names] || []
|
131
|
+
|
132
|
+
new_options = opts.merge(
|
133
|
+
:operation => :"WebhooksApi.delete_webhook",
|
134
|
+
:header_params => header_params,
|
135
|
+
:query_params => query_params,
|
136
|
+
:form_params => form_params,
|
137
|
+
:body => post_body,
|
138
|
+
:auth_names => auth_names,
|
139
|
+
:return_type => return_type
|
140
|
+
)
|
141
|
+
|
142
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
143
|
+
if @api_client.config.debugging
|
144
|
+
@api_client.config.logger.debug "API called: WebhooksApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
145
|
+
end
|
146
|
+
return data, status_code, headers
|
147
|
+
end
|
148
|
+
|
149
|
+
# List webhooks
|
150
|
+
# List webhooks, optionally filtered by event type.
|
151
|
+
# @param [Hash] opts the optional parameters
|
152
|
+
# @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 10.
|
153
|
+
# @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.
|
154
|
+
# @return [WebhookList]
|
155
|
+
def list_webhooks(opts = {})
|
156
|
+
data, _status_code, _headers = list_webhooks_with_http_info(opts)
|
157
|
+
data
|
158
|
+
end
|
159
|
+
|
160
|
+
# List webhooks
|
161
|
+
# List webhooks, optionally filtered by event type.
|
162
|
+
# @param [Hash] opts the optional parameters
|
163
|
+
# @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 10.
|
164
|
+
# @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.
|
165
|
+
# @return [Array<(WebhookList, Integer, Hash)>] WebhookList data, response status code and response headers
|
166
|
+
def list_webhooks_with_http_info(opts = {})
|
167
|
+
if @api_client.config.debugging
|
168
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhooks ...'
|
169
|
+
end
|
170
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
171
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling WebhooksApi.list_webhooks, the character length must be smaller than or equal to 5000.'
|
172
|
+
end
|
173
|
+
|
174
|
+
# resource path
|
175
|
+
local_var_path = '/v1/webhooks'
|
176
|
+
|
177
|
+
# query parameters
|
178
|
+
query_params = opts[:query_params] || {}
|
179
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
180
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
181
|
+
|
182
|
+
# header parameters
|
183
|
+
header_params = opts[:header_params] || {}
|
184
|
+
# HTTP header 'Accept' (if needed)
|
185
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
186
|
+
|
187
|
+
# form parameters
|
188
|
+
form_params = opts[:form_params] || {}
|
189
|
+
|
190
|
+
# http body (model)
|
191
|
+
post_body = opts[:debug_body]
|
192
|
+
|
193
|
+
# return_type
|
194
|
+
return_type = opts[:debug_return_type] || 'WebhookList'
|
195
|
+
|
196
|
+
# auth_names
|
197
|
+
auth_names = opts[:debug_auth_names] || []
|
198
|
+
|
199
|
+
new_options = opts.merge(
|
200
|
+
:operation => :"WebhooksApi.list_webhooks",
|
201
|
+
:header_params => header_params,
|
202
|
+
:query_params => query_params,
|
203
|
+
:form_params => form_params,
|
204
|
+
:body => post_body,
|
205
|
+
:auth_names => auth_names,
|
206
|
+
:return_type => return_type
|
207
|
+
)
|
208
|
+
|
209
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
210
|
+
if @api_client.config.debugging
|
211
|
+
@api_client.config.logger.debug "API called: WebhooksApi#list_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
212
|
+
end
|
213
|
+
return data, status_code, headers
|
214
|
+
end
|
215
|
+
|
216
|
+
# Update a webhook
|
217
|
+
# Update a webhook
|
218
|
+
# @param webhook_id [String] The Webhook id that needs to be updated
|
219
|
+
# @param [Hash] opts the optional parameters
|
220
|
+
# @option opts [UpdateWebhookRequest] :update_webhook_request
|
221
|
+
# @return [Webhook]
|
222
|
+
def update_webhook(webhook_id, opts = {})
|
223
|
+
data, _status_code, _headers = update_webhook_with_http_info(webhook_id, opts)
|
224
|
+
data
|
225
|
+
end
|
226
|
+
|
227
|
+
# Update a webhook
|
228
|
+
# Update a webhook
|
229
|
+
# @param webhook_id [String] The Webhook id that needs to be updated
|
230
|
+
# @param [Hash] opts the optional parameters
|
231
|
+
# @option opts [UpdateWebhookRequest] :update_webhook_request
|
232
|
+
# @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
|
233
|
+
def update_webhook_with_http_info(webhook_id, opts = {})
|
234
|
+
if @api_client.config.debugging
|
235
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.update_webhook ...'
|
236
|
+
end
|
237
|
+
# verify the required parameter 'webhook_id' is set
|
238
|
+
if @api_client.config.client_side_validation && webhook_id.nil?
|
239
|
+
fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.update_webhook"
|
240
|
+
end
|
241
|
+
# resource path
|
242
|
+
local_var_path = '/v1/webhooks/{webhook_id}'.sub('{' + 'webhook_id' + '}', CGI.escape(webhook_id.to_s))
|
243
|
+
|
244
|
+
# query parameters
|
245
|
+
query_params = opts[:query_params] || {}
|
246
|
+
|
247
|
+
# header parameters
|
248
|
+
header_params = opts[:header_params] || {}
|
249
|
+
# HTTP header 'Accept' (if needed)
|
250
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
251
|
+
# HTTP header 'Content-Type'
|
252
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
253
|
+
if !content_type.nil?
|
254
|
+
header_params['Content-Type'] = content_type
|
255
|
+
end
|
256
|
+
|
257
|
+
# form parameters
|
258
|
+
form_params = opts[:form_params] || {}
|
259
|
+
|
260
|
+
# http body (model)
|
261
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_webhook_request'])
|
262
|
+
|
263
|
+
# return_type
|
264
|
+
return_type = opts[:debug_return_type] || 'Webhook'
|
265
|
+
|
266
|
+
# auth_names
|
267
|
+
auth_names = opts[:debug_auth_names] || []
|
268
|
+
|
269
|
+
new_options = opts.merge(
|
270
|
+
:operation => :"WebhooksApi.update_webhook",
|
271
|
+
:header_params => header_params,
|
272
|
+
:query_params => query_params,
|
273
|
+
:form_params => form_params,
|
274
|
+
:body => post_body,
|
275
|
+
:auth_names => auth_names,
|
276
|
+
:return_type => return_type
|
277
|
+
)
|
278
|
+
|
279
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
280
|
+
if @api_client.config.debugging
|
281
|
+
@api_client.config.logger.debug "API called: WebhooksApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
282
|
+
end
|
283
|
+
return data, status_code, headers
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 0.0.1-alpha
|
7
7
|
Contact: yuga.cohler@coinbase.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
Generator version: 7.
|
9
|
+
Generator version: 7.7.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -79,6 +79,14 @@ module Coinbase::Client
|
|
79
79
|
# @return [true, false]
|
80
80
|
attr_accessor :debugging
|
81
81
|
|
82
|
+
# Set this to ignore operation servers for the API client. This is useful when you need to
|
83
|
+
# send requests to a different server than the one specified in the OpenAPI document.
|
84
|
+
# Will default to the base url defined in the spec but can be overridden by setting
|
85
|
+
# `scheme`, `host`, `base_path` directly.
|
86
|
+
# Default to false.
|
87
|
+
# @return [true, false]
|
88
|
+
attr_accessor :ignore_operation_servers
|
89
|
+
|
82
90
|
# Defines the logger used for debugging.
|
83
91
|
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
84
92
|
#
|
@@ -170,6 +178,7 @@ module Coinbase::Client
|
|
170
178
|
@return_binary_data = false
|
171
179
|
@params_encoder = nil
|
172
180
|
@debugging = false
|
181
|
+
@ignore_operation_servers = false
|
173
182
|
@inject_format = false
|
174
183
|
@force_ending_format = false
|
175
184
|
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
@@ -204,6 +213,7 @@ module Coinbase::Client
|
|
204
213
|
|
205
214
|
# Returns base URL for specified operation based on server settings
|
206
215
|
def base_url(operation = nil)
|
216
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
|
207
217
|
if operation_server_settings.key?(operation) then
|
208
218
|
index = server_operation_index.fetch(operation, server_index)
|
209
219
|
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
@@ -0,0 +1,239 @@
|
|
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 BroadcastStakingOperationRequest
|
18
|
+
# The hex-encoded signed payload of the staking operation.
|
19
|
+
attr_accessor :signed_payload
|
20
|
+
|
21
|
+
# The index in the transaction array of the staking operation.
|
22
|
+
attr_accessor :transaction_index
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'signed_payload' => :'signed_payload',
|
28
|
+
:'transaction_index' => :'transaction_index'
|
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
|
+
:'signed_payload' => :'String',
|
41
|
+
:'transaction_index' => :'Integer'
|
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::BroadcastStakingOperationRequest` 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::BroadcastStakingOperationRequest`. 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?(:'signed_payload')
|
67
|
+
self.signed_payload = attributes[:'signed_payload']
|
68
|
+
else
|
69
|
+
self.signed_payload = nil
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'transaction_index')
|
73
|
+
self.transaction_index = attributes[:'transaction_index']
|
74
|
+
else
|
75
|
+
self.transaction_index = nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properties with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
83
|
+
invalid_properties = Array.new
|
84
|
+
if @signed_payload.nil?
|
85
|
+
invalid_properties.push('invalid value for "signed_payload", signed_payload cannot be nil.')
|
86
|
+
end
|
87
|
+
|
88
|
+
if @transaction_index.nil?
|
89
|
+
invalid_properties.push('invalid value for "transaction_index", transaction_index cannot be nil.')
|
90
|
+
end
|
91
|
+
|
92
|
+
invalid_properties
|
93
|
+
end
|
94
|
+
|
95
|
+
# Check to see if the all the properties in the model are valid
|
96
|
+
# @return true if the model is valid
|
97
|
+
def valid?
|
98
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
99
|
+
return false if @signed_payload.nil?
|
100
|
+
return false if @transaction_index.nil?
|
101
|
+
true
|
102
|
+
end
|
103
|
+
|
104
|
+
# Checks equality by comparing each attribute.
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def ==(o)
|
107
|
+
return true if self.equal?(o)
|
108
|
+
self.class == o.class &&
|
109
|
+
signed_payload == o.signed_payload &&
|
110
|
+
transaction_index == o.transaction_index
|
111
|
+
end
|
112
|
+
|
113
|
+
# @see the `==` method
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def eql?(o)
|
116
|
+
self == o
|
117
|
+
end
|
118
|
+
|
119
|
+
# Calculates hash code according to all attributes.
|
120
|
+
# @return [Integer] Hash code
|
121
|
+
def hash
|
122
|
+
[signed_payload, transaction_index].hash
|
123
|
+
end
|
124
|
+
|
125
|
+
# Builds the object from hash
|
126
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
127
|
+
# @return [Object] Returns the model itself
|
128
|
+
def self.build_from_hash(attributes)
|
129
|
+
return nil unless attributes.is_a?(Hash)
|
130
|
+
attributes = attributes.transform_keys(&:to_sym)
|
131
|
+
transformed_hash = {}
|
132
|
+
openapi_types.each_pair do |key, type|
|
133
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
134
|
+
transformed_hash["#{key}"] = nil
|
135
|
+
elsif type =~ /\AArray<(.*)>/i
|
136
|
+
# check to ensure the input is an array given that the attribute
|
137
|
+
# is documented as an array but the input is not
|
138
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
139
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
140
|
+
end
|
141
|
+
elsif !attributes[attribute_map[key]].nil?
|
142
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
143
|
+
end
|
144
|
+
end
|
145
|
+
new(transformed_hash)
|
146
|
+
end
|
147
|
+
|
148
|
+
# Deserializes the data based on type
|
149
|
+
# @param string type Data type
|
150
|
+
# @param string value Value to be deserialized
|
151
|
+
# @return [Object] Deserialized data
|
152
|
+
def self._deserialize(type, value)
|
153
|
+
case type.to_sym
|
154
|
+
when :Time
|
155
|
+
Time.parse(value)
|
156
|
+
when :Date
|
157
|
+
Date.parse(value)
|
158
|
+
when :String
|
159
|
+
value.to_s
|
160
|
+
when :Integer
|
161
|
+
value.to_i
|
162
|
+
when :Float
|
163
|
+
value.to_f
|
164
|
+
when :Boolean
|
165
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
166
|
+
true
|
167
|
+
else
|
168
|
+
false
|
169
|
+
end
|
170
|
+
when :Object
|
171
|
+
# generic object (usually a Hash), return directly
|
172
|
+
value
|
173
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
174
|
+
inner_type = Regexp.last_match[:inner_type]
|
175
|
+
value.map { |v| _deserialize(inner_type, v) }
|
176
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
177
|
+
k_type = Regexp.last_match[:k_type]
|
178
|
+
v_type = Regexp.last_match[:v_type]
|
179
|
+
{}.tap do |hash|
|
180
|
+
value.each do |k, v|
|
181
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
else # model
|
185
|
+
# models (e.g. Pet) or oneOf
|
186
|
+
klass = Coinbase::Client.const_get(type)
|
187
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Returns the string representation of the object
|
192
|
+
# @return [String] String presentation of the object
|
193
|
+
def to_s
|
194
|
+
to_hash.to_s
|
195
|
+
end
|
196
|
+
|
197
|
+
# to_body is an alias to to_hash (backward compatibility)
|
198
|
+
# @return [Hash] Returns the object in the form of hash
|
199
|
+
def to_body
|
200
|
+
to_hash
|
201
|
+
end
|
202
|
+
|
203
|
+
# Returns the object in the form of hash
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_hash
|
206
|
+
hash = {}
|
207
|
+
self.class.attribute_map.each_pair do |attr, param|
|
208
|
+
value = self.send(attr)
|
209
|
+
if value.nil?
|
210
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
211
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
212
|
+
end
|
213
|
+
|
214
|
+
hash[param] = _to_hash(value)
|
215
|
+
end
|
216
|
+
hash
|
217
|
+
end
|
218
|
+
|
219
|
+
# Outputs non-array value in the form of hash
|
220
|
+
# For object, use to_hash. Otherwise, just return the value
|
221
|
+
# @param [Object] value Any valid value
|
222
|
+
# @return [Hash] Returns the value in the form of hash
|
223
|
+
def _to_hash(value)
|
224
|
+
if value.is_a?(Array)
|
225
|
+
value.compact.map { |v| _to_hash(v) }
|
226
|
+
elsif value.is_a?(Hash)
|
227
|
+
{}.tap do |hash|
|
228
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
229
|
+
end
|
230
|
+
elsif value.respond_to? :to_hash
|
231
|
+
value.to_hash
|
232
|
+
else
|
233
|
+
value
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|