coinbase-sdk 0.0.13 → 0.0.16
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 +51 -4
- data/lib/coinbase/address.rb +164 -0
- data/lib/coinbase/client/api/assets_api.rb +2 -2
- data/lib/coinbase/client/api/contract_events_api.rb +121 -0
- data/lib/coinbase/client/api/external_addresses_api.rb +85 -0
- data/lib/coinbase/client/api/networks_api.rb +85 -0
- data/lib/coinbase/client/api/stake_api.rb +361 -0
- data/lib/coinbase/client/api/webhooks_api.rb +286 -0
- data/lib/coinbase/client/models/address_historical_balance_list.rb +258 -0
- data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +239 -0
- 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_staking_operation_request.rb +274 -0
- data/lib/coinbase/client/models/create_transfer_request.rb +14 -4
- data/lib/coinbase/client/models/create_webhook_request.rb +282 -0
- data/lib/coinbase/client/models/ethereum_validator.rb +374 -0
- data/lib/coinbase/client/models/feature_set.rb +307 -0
- data/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +258 -0
- data/lib/coinbase/client/models/get_validator200_response.rb +221 -0
- data/lib/coinbase/client/models/get_validator200_response_validator.rb +214 -0
- data/lib/coinbase/client/models/historical_balance.rb +273 -0
- data/lib/coinbase/client/models/network.rb +355 -0
- data/lib/coinbase/client/models/network_identifier.rb +44 -0
- data/lib/coinbase/client/models/sponsored_send.rb +338 -0
- data/lib/coinbase/client/models/staking_balance.rb +289 -0
- data/lib/coinbase/client/models/staking_context_context.rb +222 -74
- data/lib/coinbase/client/models/staking_operation.rb +15 -5
- data/lib/coinbase/client/models/staking_reward.rb +22 -6
- data/lib/coinbase/client/models/staking_reward_format.rb +2 -1
- data/lib/coinbase/client/models/staking_reward_usd_value.rb +257 -0
- data/lib/coinbase/client/models/transaction.rb +2 -2
- data/lib/coinbase/client/models/transaction_type.rb +2 -1
- data/lib/coinbase/client/models/transfer.rb +29 -24
- data/lib/coinbase/client/models/update_webhook_request.rb +289 -0
- data/lib/coinbase/client/models/validator_list_data.rb +216 -0
- data/lib/coinbase/client/models/wallet.rb +13 -16
- 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 +42 -0
- data/lib/coinbase/client/models/webhook_list.rb +244 -0
- data/lib/coinbase/client.rb +22 -3
- data/lib/coinbase/errors.rb +7 -0
- data/lib/coinbase/historical_balance.rb +53 -0
- data/lib/coinbase/middleware.rb +12 -0
- data/lib/coinbase/server_signer.rb +14 -3
- data/lib/coinbase/sponsored_send.rb +110 -0
- data/lib/coinbase/staking_balance.rb +86 -0
- data/lib/coinbase/staking_operation.rb +106 -5
- data/lib/coinbase/staking_reward.rb +18 -0
- data/lib/coinbase/trade.rb +1 -1
- data/lib/coinbase/transaction.rb +7 -3
- data/lib/coinbase/transfer.rb +56 -29
- data/lib/coinbase/wallet/data.rb +31 -0
- data/lib/coinbase/wallet.rb +91 -46
- data/lib/coinbase.rb +17 -4
- metadata +74 -2
@@ -0,0 +1,282 @@
|
|
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.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
class CreateWebhookRequest
|
18
|
+
# The ID of the blockchain network
|
19
|
+
attr_accessor :network_id
|
20
|
+
|
21
|
+
attr_accessor :event_type
|
22
|
+
|
23
|
+
# Webhook will monitor all events that matches any one of the event filters.
|
24
|
+
attr_accessor :event_filters
|
25
|
+
|
26
|
+
# The URL to which the notifications will be sent
|
27
|
+
attr_accessor :notification_uri
|
28
|
+
|
29
|
+
class EnumAttributeValidator
|
30
|
+
attr_reader :datatype
|
31
|
+
attr_reader :allowable_values
|
32
|
+
|
33
|
+
def initialize(datatype, allowable_values)
|
34
|
+
@allowable_values = allowable_values.map do |value|
|
35
|
+
case datatype.to_s
|
36
|
+
when /Integer/i
|
37
|
+
value.to_i
|
38
|
+
when /Float/i
|
39
|
+
value.to_f
|
40
|
+
else
|
41
|
+
value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def valid?(value)
|
47
|
+
!value || allowable_values.include?(value)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
52
|
+
def self.attribute_map
|
53
|
+
{
|
54
|
+
:'network_id' => :'network_id',
|
55
|
+
:'event_type' => :'event_type',
|
56
|
+
:'event_filters' => :'event_filters',
|
57
|
+
:'notification_uri' => :'notification_uri'
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Returns all the JSON keys this model knows about
|
62
|
+
def self.acceptable_attributes
|
63
|
+
attribute_map.values
|
64
|
+
end
|
65
|
+
|
66
|
+
# Attribute type mapping.
|
67
|
+
def self.openapi_types
|
68
|
+
{
|
69
|
+
:'network_id' => :'String',
|
70
|
+
:'event_type' => :'WebhookEventType',
|
71
|
+
:'event_filters' => :'Array<WebhookEventFilter>',
|
72
|
+
:'notification_uri' => :'String'
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
# List of attributes with nullable: true
|
77
|
+
def self.openapi_nullable
|
78
|
+
Set.new([
|
79
|
+
])
|
80
|
+
end
|
81
|
+
|
82
|
+
# Initializes the object
|
83
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
84
|
+
def initialize(attributes = {})
|
85
|
+
if (!attributes.is_a?(Hash))
|
86
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::CreateWebhookRequest` initialize method"
|
87
|
+
end
|
88
|
+
|
89
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
90
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
91
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
92
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::CreateWebhookRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
93
|
+
end
|
94
|
+
h[k.to_sym] = v
|
95
|
+
}
|
96
|
+
|
97
|
+
if attributes.key?(:'network_id')
|
98
|
+
self.network_id = attributes[:'network_id']
|
99
|
+
else
|
100
|
+
self.network_id = nil
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'event_type')
|
104
|
+
self.event_type = attributes[:'event_type']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'event_filters')
|
108
|
+
if (value = attributes[:'event_filters']).is_a?(Array)
|
109
|
+
self.event_filters = value
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'notification_uri')
|
114
|
+
self.notification_uri = attributes[:'notification_uri']
|
115
|
+
else
|
116
|
+
self.notification_uri = nil
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
121
|
+
# @return Array for valid properties with the reasons
|
122
|
+
def list_invalid_properties
|
123
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
124
|
+
invalid_properties = Array.new
|
125
|
+
if @network_id.nil?
|
126
|
+
invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
|
127
|
+
end
|
128
|
+
|
129
|
+
if @notification_uri.nil?
|
130
|
+
invalid_properties.push('invalid value for "notification_uri", notification_uri cannot be nil.')
|
131
|
+
end
|
132
|
+
|
133
|
+
invalid_properties
|
134
|
+
end
|
135
|
+
|
136
|
+
# Check to see if the all the properties in the model are valid
|
137
|
+
# @return true if the model is valid
|
138
|
+
def valid?
|
139
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
140
|
+
return false if @network_id.nil?
|
141
|
+
return false if @notification_uri.nil?
|
142
|
+
true
|
143
|
+
end
|
144
|
+
|
145
|
+
# Checks equality by comparing each attribute.
|
146
|
+
# @param [Object] Object to be compared
|
147
|
+
def ==(o)
|
148
|
+
return true if self.equal?(o)
|
149
|
+
self.class == o.class &&
|
150
|
+
network_id == o.network_id &&
|
151
|
+
event_type == o.event_type &&
|
152
|
+
event_filters == o.event_filters &&
|
153
|
+
notification_uri == o.notification_uri
|
154
|
+
end
|
155
|
+
|
156
|
+
# @see the `==` method
|
157
|
+
# @param [Object] Object to be compared
|
158
|
+
def eql?(o)
|
159
|
+
self == o
|
160
|
+
end
|
161
|
+
|
162
|
+
# Calculates hash code according to all attributes.
|
163
|
+
# @return [Integer] Hash code
|
164
|
+
def hash
|
165
|
+
[network_id, event_type, event_filters, notification_uri].hash
|
166
|
+
end
|
167
|
+
|
168
|
+
# Builds the object from hash
|
169
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
170
|
+
# @return [Object] Returns the model itself
|
171
|
+
def self.build_from_hash(attributes)
|
172
|
+
return nil unless attributes.is_a?(Hash)
|
173
|
+
attributes = attributes.transform_keys(&:to_sym)
|
174
|
+
transformed_hash = {}
|
175
|
+
openapi_types.each_pair do |key, type|
|
176
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
177
|
+
transformed_hash["#{key}"] = nil
|
178
|
+
elsif type =~ /\AArray<(.*)>/i
|
179
|
+
# check to ensure the input is an array given that the attribute
|
180
|
+
# is documented as an array but the input is not
|
181
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
182
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
183
|
+
end
|
184
|
+
elsif !attributes[attribute_map[key]].nil?
|
185
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
186
|
+
end
|
187
|
+
end
|
188
|
+
new(transformed_hash)
|
189
|
+
end
|
190
|
+
|
191
|
+
# Deserializes the data based on type
|
192
|
+
# @param string type Data type
|
193
|
+
# @param string value Value to be deserialized
|
194
|
+
# @return [Object] Deserialized data
|
195
|
+
def self._deserialize(type, value)
|
196
|
+
case type.to_sym
|
197
|
+
when :Time
|
198
|
+
Time.parse(value)
|
199
|
+
when :Date
|
200
|
+
Date.parse(value)
|
201
|
+
when :String
|
202
|
+
value.to_s
|
203
|
+
when :Integer
|
204
|
+
value.to_i
|
205
|
+
when :Float
|
206
|
+
value.to_f
|
207
|
+
when :Boolean
|
208
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
209
|
+
true
|
210
|
+
else
|
211
|
+
false
|
212
|
+
end
|
213
|
+
when :Object
|
214
|
+
# generic object (usually a Hash), return directly
|
215
|
+
value
|
216
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
217
|
+
inner_type = Regexp.last_match[:inner_type]
|
218
|
+
value.map { |v| _deserialize(inner_type, v) }
|
219
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
220
|
+
k_type = Regexp.last_match[:k_type]
|
221
|
+
v_type = Regexp.last_match[:v_type]
|
222
|
+
{}.tap do |hash|
|
223
|
+
value.each do |k, v|
|
224
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
else # model
|
228
|
+
# models (e.g. Pet) or oneOf
|
229
|
+
klass = Coinbase::Client.const_get(type)
|
230
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
# Returns the string representation of the object
|
235
|
+
# @return [String] String presentation of the object
|
236
|
+
def to_s
|
237
|
+
to_hash.to_s
|
238
|
+
end
|
239
|
+
|
240
|
+
# to_body is an alias to to_hash (backward compatibility)
|
241
|
+
# @return [Hash] Returns the object in the form of hash
|
242
|
+
def to_body
|
243
|
+
to_hash
|
244
|
+
end
|
245
|
+
|
246
|
+
# Returns the object in the form of hash
|
247
|
+
# @return [Hash] Returns the object in the form of hash
|
248
|
+
def to_hash
|
249
|
+
hash = {}
|
250
|
+
self.class.attribute_map.each_pair do |attr, param|
|
251
|
+
value = self.send(attr)
|
252
|
+
if value.nil?
|
253
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
254
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
255
|
+
end
|
256
|
+
|
257
|
+
hash[param] = _to_hash(value)
|
258
|
+
end
|
259
|
+
hash
|
260
|
+
end
|
261
|
+
|
262
|
+
# Outputs non-array value in the form of hash
|
263
|
+
# For object, use to_hash. Otherwise, just return the value
|
264
|
+
# @param [Object] value Any valid value
|
265
|
+
# @return [Hash] Returns the value in the form of hash
|
266
|
+
def _to_hash(value)
|
267
|
+
if value.is_a?(Array)
|
268
|
+
value.compact.map { |v| _to_hash(v) }
|
269
|
+
elsif value.is_a?(Hash)
|
270
|
+
{}.tap do |hash|
|
271
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
272
|
+
end
|
273
|
+
elsif value.respond_to? :to_hash
|
274
|
+
value.to_hash
|
275
|
+
else
|
276
|
+
value
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
end
|
281
|
+
|
282
|
+
end
|
@@ -0,0 +1,374 @@
|
|
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.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
# An Ethereum validator.
|
18
|
+
class EthereumValidator
|
19
|
+
# The index of the validator in the validator set.
|
20
|
+
attr_accessor :index
|
21
|
+
|
22
|
+
# The status of the validator.
|
23
|
+
attr_accessor :status
|
24
|
+
|
25
|
+
# The public key of the validator.
|
26
|
+
attr_accessor :public_key
|
27
|
+
|
28
|
+
# The address to which the validator's rewards are sent.
|
29
|
+
attr_accessor :withdrawl_address
|
30
|
+
|
31
|
+
# Whether the validator has been slashed.
|
32
|
+
attr_accessor :slashed
|
33
|
+
|
34
|
+
# The epoch at which the validator was activated.
|
35
|
+
attr_accessor :activation_epoch
|
36
|
+
|
37
|
+
# The epoch at which the validator exited.
|
38
|
+
attr_accessor :exit_epoch
|
39
|
+
|
40
|
+
# The epoch at which the validator can withdraw.
|
41
|
+
attr_accessor :withdrawable_epoch
|
42
|
+
|
43
|
+
attr_accessor :balance
|
44
|
+
|
45
|
+
attr_accessor :effective_balance
|
46
|
+
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
48
|
+
def self.attribute_map
|
49
|
+
{
|
50
|
+
:'index' => :'index',
|
51
|
+
:'status' => :'status',
|
52
|
+
:'public_key' => :'public_key',
|
53
|
+
:'withdrawl_address' => :'withdrawl_address',
|
54
|
+
:'slashed' => :'slashed',
|
55
|
+
:'activation_epoch' => :'activationEpoch',
|
56
|
+
:'exit_epoch' => :'exitEpoch',
|
57
|
+
:'withdrawable_epoch' => :'withdrawableEpoch',
|
58
|
+
:'balance' => :'balance',
|
59
|
+
:'effective_balance' => :'effective_balance'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Returns all the JSON keys this model knows about
|
64
|
+
def self.acceptable_attributes
|
65
|
+
attribute_map.values
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute type mapping.
|
69
|
+
def self.openapi_types
|
70
|
+
{
|
71
|
+
:'index' => :'String',
|
72
|
+
:'status' => :'String',
|
73
|
+
:'public_key' => :'String',
|
74
|
+
:'withdrawl_address' => :'String',
|
75
|
+
:'slashed' => :'Boolean',
|
76
|
+
:'activation_epoch' => :'String',
|
77
|
+
:'exit_epoch' => :'String',
|
78
|
+
:'withdrawable_epoch' => :'String',
|
79
|
+
:'balance' => :'Balance',
|
80
|
+
:'effective_balance' => :'Balance'
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
# List of attributes with nullable: true
|
85
|
+
def self.openapi_nullable
|
86
|
+
Set.new([
|
87
|
+
])
|
88
|
+
end
|
89
|
+
|
90
|
+
# Initializes the object
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
def initialize(attributes = {})
|
93
|
+
if (!attributes.is_a?(Hash))
|
94
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::EthereumValidator` initialize method"
|
95
|
+
end
|
96
|
+
|
97
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
98
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
99
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
100
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::EthereumValidator`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
101
|
+
end
|
102
|
+
h[k.to_sym] = v
|
103
|
+
}
|
104
|
+
|
105
|
+
if attributes.key?(:'index')
|
106
|
+
self.index = attributes[:'index']
|
107
|
+
else
|
108
|
+
self.index = nil
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'status')
|
112
|
+
self.status = attributes[:'status']
|
113
|
+
else
|
114
|
+
self.status = nil
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'public_key')
|
118
|
+
self.public_key = attributes[:'public_key']
|
119
|
+
else
|
120
|
+
self.public_key = nil
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'withdrawl_address')
|
124
|
+
self.withdrawl_address = attributes[:'withdrawl_address']
|
125
|
+
else
|
126
|
+
self.withdrawl_address = nil
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'slashed')
|
130
|
+
self.slashed = attributes[:'slashed']
|
131
|
+
else
|
132
|
+
self.slashed = nil
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'activation_epoch')
|
136
|
+
self.activation_epoch = attributes[:'activation_epoch']
|
137
|
+
else
|
138
|
+
self.activation_epoch = nil
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.key?(:'exit_epoch')
|
142
|
+
self.exit_epoch = attributes[:'exit_epoch']
|
143
|
+
else
|
144
|
+
self.exit_epoch = nil
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'withdrawable_epoch')
|
148
|
+
self.withdrawable_epoch = attributes[:'withdrawable_epoch']
|
149
|
+
else
|
150
|
+
self.withdrawable_epoch = nil
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'balance')
|
154
|
+
self.balance = attributes[:'balance']
|
155
|
+
else
|
156
|
+
self.balance = nil
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'effective_balance')
|
160
|
+
self.effective_balance = attributes[:'effective_balance']
|
161
|
+
else
|
162
|
+
self.effective_balance = nil
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
167
|
+
# @return Array for valid properties with the reasons
|
168
|
+
def list_invalid_properties
|
169
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
170
|
+
invalid_properties = Array.new
|
171
|
+
if @index.nil?
|
172
|
+
invalid_properties.push('invalid value for "index", index cannot be nil.')
|
173
|
+
end
|
174
|
+
|
175
|
+
if @status.nil?
|
176
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
177
|
+
end
|
178
|
+
|
179
|
+
if @public_key.nil?
|
180
|
+
invalid_properties.push('invalid value for "public_key", public_key cannot be nil.')
|
181
|
+
end
|
182
|
+
|
183
|
+
if @withdrawl_address.nil?
|
184
|
+
invalid_properties.push('invalid value for "withdrawl_address", withdrawl_address cannot be nil.')
|
185
|
+
end
|
186
|
+
|
187
|
+
if @slashed.nil?
|
188
|
+
invalid_properties.push('invalid value for "slashed", slashed cannot be nil.')
|
189
|
+
end
|
190
|
+
|
191
|
+
if @activation_epoch.nil?
|
192
|
+
invalid_properties.push('invalid value for "activation_epoch", activation_epoch cannot be nil.')
|
193
|
+
end
|
194
|
+
|
195
|
+
if @exit_epoch.nil?
|
196
|
+
invalid_properties.push('invalid value for "exit_epoch", exit_epoch cannot be nil.')
|
197
|
+
end
|
198
|
+
|
199
|
+
if @withdrawable_epoch.nil?
|
200
|
+
invalid_properties.push('invalid value for "withdrawable_epoch", withdrawable_epoch cannot be nil.')
|
201
|
+
end
|
202
|
+
|
203
|
+
if @balance.nil?
|
204
|
+
invalid_properties.push('invalid value for "balance", balance cannot be nil.')
|
205
|
+
end
|
206
|
+
|
207
|
+
if @effective_balance.nil?
|
208
|
+
invalid_properties.push('invalid value for "effective_balance", effective_balance cannot be nil.')
|
209
|
+
end
|
210
|
+
|
211
|
+
invalid_properties
|
212
|
+
end
|
213
|
+
|
214
|
+
# Check to see if the all the properties in the model are valid
|
215
|
+
# @return true if the model is valid
|
216
|
+
def valid?
|
217
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
218
|
+
return false if @index.nil?
|
219
|
+
return false if @status.nil?
|
220
|
+
return false if @public_key.nil?
|
221
|
+
return false if @withdrawl_address.nil?
|
222
|
+
return false if @slashed.nil?
|
223
|
+
return false if @activation_epoch.nil?
|
224
|
+
return false if @exit_epoch.nil?
|
225
|
+
return false if @withdrawable_epoch.nil?
|
226
|
+
return false if @balance.nil?
|
227
|
+
return false if @effective_balance.nil?
|
228
|
+
true
|
229
|
+
end
|
230
|
+
|
231
|
+
# Checks equality by comparing each attribute.
|
232
|
+
# @param [Object] Object to be compared
|
233
|
+
def ==(o)
|
234
|
+
return true if self.equal?(o)
|
235
|
+
self.class == o.class &&
|
236
|
+
index == o.index &&
|
237
|
+
status == o.status &&
|
238
|
+
public_key == o.public_key &&
|
239
|
+
withdrawl_address == o.withdrawl_address &&
|
240
|
+
slashed == o.slashed &&
|
241
|
+
activation_epoch == o.activation_epoch &&
|
242
|
+
exit_epoch == o.exit_epoch &&
|
243
|
+
withdrawable_epoch == o.withdrawable_epoch &&
|
244
|
+
balance == o.balance &&
|
245
|
+
effective_balance == o.effective_balance
|
246
|
+
end
|
247
|
+
|
248
|
+
# @see the `==` method
|
249
|
+
# @param [Object] Object to be compared
|
250
|
+
def eql?(o)
|
251
|
+
self == o
|
252
|
+
end
|
253
|
+
|
254
|
+
# Calculates hash code according to all attributes.
|
255
|
+
# @return [Integer] Hash code
|
256
|
+
def hash
|
257
|
+
[index, status, public_key, withdrawl_address, slashed, activation_epoch, exit_epoch, withdrawable_epoch, balance, effective_balance].hash
|
258
|
+
end
|
259
|
+
|
260
|
+
# Builds the object from hash
|
261
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
262
|
+
# @return [Object] Returns the model itself
|
263
|
+
def self.build_from_hash(attributes)
|
264
|
+
return nil unless attributes.is_a?(Hash)
|
265
|
+
attributes = attributes.transform_keys(&:to_sym)
|
266
|
+
transformed_hash = {}
|
267
|
+
openapi_types.each_pair do |key, type|
|
268
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
269
|
+
transformed_hash["#{key}"] = nil
|
270
|
+
elsif type =~ /\AArray<(.*)>/i
|
271
|
+
# check to ensure the input is an array given that the attribute
|
272
|
+
# is documented as an array but the input is not
|
273
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
274
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
275
|
+
end
|
276
|
+
elsif !attributes[attribute_map[key]].nil?
|
277
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
278
|
+
end
|
279
|
+
end
|
280
|
+
new(transformed_hash)
|
281
|
+
end
|
282
|
+
|
283
|
+
# Deserializes the data based on type
|
284
|
+
# @param string type Data type
|
285
|
+
# @param string value Value to be deserialized
|
286
|
+
# @return [Object] Deserialized data
|
287
|
+
def self._deserialize(type, value)
|
288
|
+
case type.to_sym
|
289
|
+
when :Time
|
290
|
+
Time.parse(value)
|
291
|
+
when :Date
|
292
|
+
Date.parse(value)
|
293
|
+
when :String
|
294
|
+
value.to_s
|
295
|
+
when :Integer
|
296
|
+
value.to_i
|
297
|
+
when :Float
|
298
|
+
value.to_f
|
299
|
+
when :Boolean
|
300
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
301
|
+
true
|
302
|
+
else
|
303
|
+
false
|
304
|
+
end
|
305
|
+
when :Object
|
306
|
+
# generic object (usually a Hash), return directly
|
307
|
+
value
|
308
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
309
|
+
inner_type = Regexp.last_match[:inner_type]
|
310
|
+
value.map { |v| _deserialize(inner_type, v) }
|
311
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
312
|
+
k_type = Regexp.last_match[:k_type]
|
313
|
+
v_type = Regexp.last_match[:v_type]
|
314
|
+
{}.tap do |hash|
|
315
|
+
value.each do |k, v|
|
316
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
317
|
+
end
|
318
|
+
end
|
319
|
+
else # model
|
320
|
+
# models (e.g. Pet) or oneOf
|
321
|
+
klass = Coinbase::Client.const_get(type)
|
322
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
# Returns the string representation of the object
|
327
|
+
# @return [String] String presentation of the object
|
328
|
+
def to_s
|
329
|
+
to_hash.to_s
|
330
|
+
end
|
331
|
+
|
332
|
+
# to_body is an alias to to_hash (backward compatibility)
|
333
|
+
# @return [Hash] Returns the object in the form of hash
|
334
|
+
def to_body
|
335
|
+
to_hash
|
336
|
+
end
|
337
|
+
|
338
|
+
# Returns the object in the form of hash
|
339
|
+
# @return [Hash] Returns the object in the form of hash
|
340
|
+
def to_hash
|
341
|
+
hash = {}
|
342
|
+
self.class.attribute_map.each_pair do |attr, param|
|
343
|
+
value = self.send(attr)
|
344
|
+
if value.nil?
|
345
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
346
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
347
|
+
end
|
348
|
+
|
349
|
+
hash[param] = _to_hash(value)
|
350
|
+
end
|
351
|
+
hash
|
352
|
+
end
|
353
|
+
|
354
|
+
# Outputs non-array value in the form of hash
|
355
|
+
# For object, use to_hash. Otherwise, just return the value
|
356
|
+
# @param [Object] value Any valid value
|
357
|
+
# @return [Hash] Returns the value in the form of hash
|
358
|
+
def _to_hash(value)
|
359
|
+
if value.is_a?(Array)
|
360
|
+
value.compact.map { |v| _to_hash(v) }
|
361
|
+
elsif value.is_a?(Hash)
|
362
|
+
{}.tap do |hash|
|
363
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
364
|
+
end
|
365
|
+
elsif value.respond_to? :to_hash
|
366
|
+
value.to_hash
|
367
|
+
else
|
368
|
+
value
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
end
|
373
|
+
|
374
|
+
end
|