coinbase-sdk 0.7.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coinbase/address.rb +8 -3
- data/lib/coinbase/client/api/external_addresses_api.rb +78 -0
- data/lib/coinbase/client/api/fund_api.rb +336 -0
- data/lib/coinbase/client/api/onchain_identity_api.rb +108 -0
- data/lib/coinbase/client/api/smart_contracts_api.rb +80 -0
- data/lib/coinbase/client/api/webhooks_api.rb +5 -5
- data/lib/coinbase/client/models/create_fund_operation_request.rb +249 -0
- data/lib/coinbase/client/models/create_fund_quote_request.rb +239 -0
- data/lib/coinbase/client/models/create_wallet_webhook_request.rb +1 -1
- data/lib/coinbase/client/models/crypto_amount.rb +239 -0
- data/lib/coinbase/client/models/ethereum_token_transfer.rb +327 -0
- data/lib/coinbase/client/models/ethereum_transaction.rb +12 -1
- data/lib/coinbase/client/models/faucet_transaction.rb +20 -4
- data/lib/coinbase/client/models/fiat_amount.rb +240 -0
- data/lib/coinbase/client/models/fund_operation.rb +373 -0
- data/lib/coinbase/client/models/fund_operation_fees.rb +238 -0
- data/lib/coinbase/client/models/fund_operation_list.rb +275 -0
- data/lib/coinbase/client/models/fund_quote.rb +339 -0
- data/lib/coinbase/client/models/onchain_name.rb +357 -0
- data/lib/coinbase/client/models/onchain_name_list.rb +262 -0
- data/lib/coinbase/client/models/read_contract_request.rb +249 -0
- data/lib/coinbase/client/models/solidity_value.rb +287 -0
- data/lib/coinbase/client/models/token_transfer_type.rb +43 -0
- data/lib/coinbase/client/models/update_webhook_request.rb +0 -7
- data/lib/coinbase/client.rb +17 -0
- data/lib/coinbase/faucet_transaction.rb +64 -4
- data/lib/coinbase/smart_contract.rb +95 -0
- data/lib/coinbase/transaction.rb +8 -2
- data/lib/coinbase/version.rb +1 -1
- metadata +18 -2
@@ -0,0 +1,339 @@
|
|
1
|
+
=begin
|
2
|
+
#Coinbase Platform API
|
3
|
+
|
4
|
+
#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.0.1-alpha
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.8.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
# A quote for a fund operation
|
18
|
+
class FundQuote
|
19
|
+
# The ID of the fund quote
|
20
|
+
attr_accessor :fund_quote_id
|
21
|
+
|
22
|
+
# The ID of the blockchain network
|
23
|
+
attr_accessor :network_id
|
24
|
+
|
25
|
+
# The ID of the wallet that will receive the crypto
|
26
|
+
attr_accessor :wallet_id
|
27
|
+
|
28
|
+
# The ID of the address that will receive the crypto
|
29
|
+
attr_accessor :address_id
|
30
|
+
|
31
|
+
attr_accessor :crypto_amount
|
32
|
+
|
33
|
+
attr_accessor :fiat_amount
|
34
|
+
|
35
|
+
# The time at which the quote expires
|
36
|
+
attr_accessor :expires_at
|
37
|
+
|
38
|
+
attr_accessor :fees
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'fund_quote_id' => :'fund_quote_id',
|
44
|
+
:'network_id' => :'network_id',
|
45
|
+
:'wallet_id' => :'wallet_id',
|
46
|
+
:'address_id' => :'address_id',
|
47
|
+
:'crypto_amount' => :'crypto_amount',
|
48
|
+
:'fiat_amount' => :'fiat_amount',
|
49
|
+
:'expires_at' => :'expires_at',
|
50
|
+
:'fees' => :'fees'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# Returns all the JSON keys this model knows about
|
55
|
+
def self.acceptable_attributes
|
56
|
+
attribute_map.values
|
57
|
+
end
|
58
|
+
|
59
|
+
# Attribute type mapping.
|
60
|
+
def self.openapi_types
|
61
|
+
{
|
62
|
+
:'fund_quote_id' => :'String',
|
63
|
+
:'network_id' => :'String',
|
64
|
+
:'wallet_id' => :'String',
|
65
|
+
:'address_id' => :'String',
|
66
|
+
:'crypto_amount' => :'CryptoAmount',
|
67
|
+
:'fiat_amount' => :'FiatAmount',
|
68
|
+
:'expires_at' => :'Time',
|
69
|
+
:'fees' => :'FundOperationFees'
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
# List of attributes with nullable: true
|
74
|
+
def self.openapi_nullable
|
75
|
+
Set.new([
|
76
|
+
])
|
77
|
+
end
|
78
|
+
|
79
|
+
# Initializes the object
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
81
|
+
def initialize(attributes = {})
|
82
|
+
if (!attributes.is_a?(Hash))
|
83
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::FundQuote` initialize method"
|
84
|
+
end
|
85
|
+
|
86
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
87
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
88
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
89
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::FundQuote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
90
|
+
end
|
91
|
+
h[k.to_sym] = v
|
92
|
+
}
|
93
|
+
|
94
|
+
if attributes.key?(:'fund_quote_id')
|
95
|
+
self.fund_quote_id = attributes[:'fund_quote_id']
|
96
|
+
else
|
97
|
+
self.fund_quote_id = nil
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'network_id')
|
101
|
+
self.network_id = attributes[:'network_id']
|
102
|
+
else
|
103
|
+
self.network_id = nil
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'wallet_id')
|
107
|
+
self.wallet_id = attributes[:'wallet_id']
|
108
|
+
else
|
109
|
+
self.wallet_id = nil
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.key?(:'address_id')
|
113
|
+
self.address_id = attributes[:'address_id']
|
114
|
+
else
|
115
|
+
self.address_id = nil
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'crypto_amount')
|
119
|
+
self.crypto_amount = attributes[:'crypto_amount']
|
120
|
+
else
|
121
|
+
self.crypto_amount = nil
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'fiat_amount')
|
125
|
+
self.fiat_amount = attributes[:'fiat_amount']
|
126
|
+
else
|
127
|
+
self.fiat_amount = nil
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'expires_at')
|
131
|
+
self.expires_at = attributes[:'expires_at']
|
132
|
+
else
|
133
|
+
self.expires_at = nil
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'fees')
|
137
|
+
self.fees = attributes[:'fees']
|
138
|
+
else
|
139
|
+
self.fees = nil
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
144
|
+
# @return Array for valid properties with the reasons
|
145
|
+
def list_invalid_properties
|
146
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
147
|
+
invalid_properties = Array.new
|
148
|
+
if @fund_quote_id.nil?
|
149
|
+
invalid_properties.push('invalid value for "fund_quote_id", fund_quote_id cannot be nil.')
|
150
|
+
end
|
151
|
+
|
152
|
+
if @network_id.nil?
|
153
|
+
invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
|
154
|
+
end
|
155
|
+
|
156
|
+
if @wallet_id.nil?
|
157
|
+
invalid_properties.push('invalid value for "wallet_id", wallet_id cannot be nil.')
|
158
|
+
end
|
159
|
+
|
160
|
+
if @address_id.nil?
|
161
|
+
invalid_properties.push('invalid value for "address_id", address_id cannot be nil.')
|
162
|
+
end
|
163
|
+
|
164
|
+
if @crypto_amount.nil?
|
165
|
+
invalid_properties.push('invalid value for "crypto_amount", crypto_amount cannot be nil.')
|
166
|
+
end
|
167
|
+
|
168
|
+
if @fiat_amount.nil?
|
169
|
+
invalid_properties.push('invalid value for "fiat_amount", fiat_amount cannot be nil.')
|
170
|
+
end
|
171
|
+
|
172
|
+
if @expires_at.nil?
|
173
|
+
invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
|
174
|
+
end
|
175
|
+
|
176
|
+
if @fees.nil?
|
177
|
+
invalid_properties.push('invalid value for "fees", fees cannot be nil.')
|
178
|
+
end
|
179
|
+
|
180
|
+
invalid_properties
|
181
|
+
end
|
182
|
+
|
183
|
+
# Check to see if the all the properties in the model are valid
|
184
|
+
# @return true if the model is valid
|
185
|
+
def valid?
|
186
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
187
|
+
return false if @fund_quote_id.nil?
|
188
|
+
return false if @network_id.nil?
|
189
|
+
return false if @wallet_id.nil?
|
190
|
+
return false if @address_id.nil?
|
191
|
+
return false if @crypto_amount.nil?
|
192
|
+
return false if @fiat_amount.nil?
|
193
|
+
return false if @expires_at.nil?
|
194
|
+
return false if @fees.nil?
|
195
|
+
true
|
196
|
+
end
|
197
|
+
|
198
|
+
# Checks equality by comparing each attribute.
|
199
|
+
# @param [Object] Object to be compared
|
200
|
+
def ==(o)
|
201
|
+
return true if self.equal?(o)
|
202
|
+
self.class == o.class &&
|
203
|
+
fund_quote_id == o.fund_quote_id &&
|
204
|
+
network_id == o.network_id &&
|
205
|
+
wallet_id == o.wallet_id &&
|
206
|
+
address_id == o.address_id &&
|
207
|
+
crypto_amount == o.crypto_amount &&
|
208
|
+
fiat_amount == o.fiat_amount &&
|
209
|
+
expires_at == o.expires_at &&
|
210
|
+
fees == o.fees
|
211
|
+
end
|
212
|
+
|
213
|
+
# @see the `==` method
|
214
|
+
# @param [Object] Object to be compared
|
215
|
+
def eql?(o)
|
216
|
+
self == o
|
217
|
+
end
|
218
|
+
|
219
|
+
# Calculates hash code according to all attributes.
|
220
|
+
# @return [Integer] Hash code
|
221
|
+
def hash
|
222
|
+
[fund_quote_id, network_id, wallet_id, address_id, crypto_amount, fiat_amount, expires_at, fees].hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Builds the object from hash
|
226
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
227
|
+
# @return [Object] Returns the model itself
|
228
|
+
def self.build_from_hash(attributes)
|
229
|
+
return nil unless attributes.is_a?(Hash)
|
230
|
+
attributes = attributes.transform_keys(&:to_sym)
|
231
|
+
transformed_hash = {}
|
232
|
+
openapi_types.each_pair do |key, type|
|
233
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
234
|
+
transformed_hash["#{key}"] = nil
|
235
|
+
elsif type =~ /\AArray<(.*)>/i
|
236
|
+
# check to ensure the input is an array given that the attribute
|
237
|
+
# is documented as an array but the input is not
|
238
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
239
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
240
|
+
end
|
241
|
+
elsif !attributes[attribute_map[key]].nil?
|
242
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
243
|
+
end
|
244
|
+
end
|
245
|
+
new(transformed_hash)
|
246
|
+
end
|
247
|
+
|
248
|
+
# Deserializes the data based on type
|
249
|
+
# @param string type Data type
|
250
|
+
# @param string value Value to be deserialized
|
251
|
+
# @return [Object] Deserialized data
|
252
|
+
def self._deserialize(type, value)
|
253
|
+
case type.to_sym
|
254
|
+
when :Time
|
255
|
+
Time.parse(value)
|
256
|
+
when :Date
|
257
|
+
Date.parse(value)
|
258
|
+
when :String
|
259
|
+
value.to_s
|
260
|
+
when :Integer
|
261
|
+
value.to_i
|
262
|
+
when :Float
|
263
|
+
value.to_f
|
264
|
+
when :Boolean
|
265
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
266
|
+
true
|
267
|
+
else
|
268
|
+
false
|
269
|
+
end
|
270
|
+
when :Object
|
271
|
+
# generic object (usually a Hash), return directly
|
272
|
+
value
|
273
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
274
|
+
inner_type = Regexp.last_match[:inner_type]
|
275
|
+
value.map { |v| _deserialize(inner_type, v) }
|
276
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
277
|
+
k_type = Regexp.last_match[:k_type]
|
278
|
+
v_type = Regexp.last_match[:v_type]
|
279
|
+
{}.tap do |hash|
|
280
|
+
value.each do |k, v|
|
281
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
else # model
|
285
|
+
# models (e.g. Pet) or oneOf
|
286
|
+
klass = Coinbase::Client.const_get(type)
|
287
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
# Returns the string representation of the object
|
292
|
+
# @return [String] String presentation of the object
|
293
|
+
def to_s
|
294
|
+
to_hash.to_s
|
295
|
+
end
|
296
|
+
|
297
|
+
# to_body is an alias to to_hash (backward compatibility)
|
298
|
+
# @return [Hash] Returns the object in the form of hash
|
299
|
+
def to_body
|
300
|
+
to_hash
|
301
|
+
end
|
302
|
+
|
303
|
+
# Returns the object in the form of hash
|
304
|
+
# @return [Hash] Returns the object in the form of hash
|
305
|
+
def to_hash
|
306
|
+
hash = {}
|
307
|
+
self.class.attribute_map.each_pair do |attr, param|
|
308
|
+
value = self.send(attr)
|
309
|
+
if value.nil?
|
310
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
311
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
312
|
+
end
|
313
|
+
|
314
|
+
hash[param] = _to_hash(value)
|
315
|
+
end
|
316
|
+
hash
|
317
|
+
end
|
318
|
+
|
319
|
+
# Outputs non-array value in the form of hash
|
320
|
+
# For object, use to_hash. Otherwise, just return the value
|
321
|
+
# @param [Object] value Any valid value
|
322
|
+
# @return [Hash] Returns the value in the form of hash
|
323
|
+
def _to_hash(value)
|
324
|
+
if value.is_a?(Array)
|
325
|
+
value.compact.map { |v| _to_hash(v) }
|
326
|
+
elsif value.is_a?(Hash)
|
327
|
+
{}.tap do |hash|
|
328
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
329
|
+
end
|
330
|
+
elsif value.respond_to? :to_hash
|
331
|
+
value.to_hash
|
332
|
+
else
|
333
|
+
value
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
end
|
338
|
+
|
339
|
+
end
|
@@ -0,0 +1,357 @@
|
|
1
|
+
=begin
|
2
|
+
#Coinbase Platform API
|
3
|
+
|
4
|
+
#This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.0.1-alpha
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.8.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Coinbase::Client
|
17
|
+
# A representation of an onchain stored name from name systems i.e. ENS or Basenames
|
18
|
+
class OnchainName
|
19
|
+
# The ID for the NFT related to this name
|
20
|
+
attr_accessor :token_id
|
21
|
+
|
22
|
+
# The onchain address of the owner of the name
|
23
|
+
attr_accessor :owner_address
|
24
|
+
|
25
|
+
# The onchain address of the manager of the name
|
26
|
+
attr_accessor :manager_address
|
27
|
+
|
28
|
+
# The primary onchain address of the name
|
29
|
+
attr_accessor :primary_address
|
30
|
+
|
31
|
+
# The readable format for the name in complete form
|
32
|
+
attr_accessor :domain
|
33
|
+
|
34
|
+
# The visual representation attached to this name
|
35
|
+
attr_accessor :avatar
|
36
|
+
|
37
|
+
# The ID of the blockchain network
|
38
|
+
attr_accessor :network_id
|
39
|
+
|
40
|
+
# The expiration date for this name's ownership
|
41
|
+
attr_accessor :expires_at
|
42
|
+
|
43
|
+
# The metadata attached to this name
|
44
|
+
attr_accessor :text_records
|
45
|
+
|
46
|
+
# Whether this name is the primary name for the owner (This is when the ETH coin address for this name is equal to the primary_address. More info here https://docs.ens.domains/ensip/19)
|
47
|
+
attr_accessor :is_primary
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:'token_id' => :'token_id',
|
53
|
+
:'owner_address' => :'owner_address',
|
54
|
+
:'manager_address' => :'manager_address',
|
55
|
+
:'primary_address' => :'primary_address',
|
56
|
+
:'domain' => :'domain',
|
57
|
+
:'avatar' => :'avatar',
|
58
|
+
:'network_id' => :'network_id',
|
59
|
+
:'expires_at' => :'expires_at',
|
60
|
+
:'text_records' => :'text_records',
|
61
|
+
:'is_primary' => :'is_primary'
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
# Returns all the JSON keys this model knows about
|
66
|
+
def self.acceptable_attributes
|
67
|
+
attribute_map.values
|
68
|
+
end
|
69
|
+
|
70
|
+
# Attribute type mapping.
|
71
|
+
def self.openapi_types
|
72
|
+
{
|
73
|
+
:'token_id' => :'String',
|
74
|
+
:'owner_address' => :'String',
|
75
|
+
:'manager_address' => :'String',
|
76
|
+
:'primary_address' => :'String',
|
77
|
+
:'domain' => :'String',
|
78
|
+
:'avatar' => :'String',
|
79
|
+
:'network_id' => :'String',
|
80
|
+
:'expires_at' => :'Time',
|
81
|
+
:'text_records' => :'Hash<String, String>',
|
82
|
+
:'is_primary' => :'Boolean'
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
# List of attributes with nullable: true
|
87
|
+
def self.openapi_nullable
|
88
|
+
Set.new([
|
89
|
+
])
|
90
|
+
end
|
91
|
+
|
92
|
+
# Initializes the object
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
94
|
+
def initialize(attributes = {})
|
95
|
+
if (!attributes.is_a?(Hash))
|
96
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::OnchainName` initialize method"
|
97
|
+
end
|
98
|
+
|
99
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
100
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
101
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
102
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::OnchainName`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
103
|
+
end
|
104
|
+
h[k.to_sym] = v
|
105
|
+
}
|
106
|
+
|
107
|
+
if attributes.key?(:'token_id')
|
108
|
+
self.token_id = attributes[:'token_id']
|
109
|
+
else
|
110
|
+
self.token_id = nil
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'owner_address')
|
114
|
+
self.owner_address = attributes[:'owner_address']
|
115
|
+
else
|
116
|
+
self.owner_address = nil
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'manager_address')
|
120
|
+
self.manager_address = attributes[:'manager_address']
|
121
|
+
else
|
122
|
+
self.manager_address = nil
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'primary_address')
|
126
|
+
self.primary_address = attributes[:'primary_address']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'domain')
|
130
|
+
self.domain = attributes[:'domain']
|
131
|
+
else
|
132
|
+
self.domain = nil
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'avatar')
|
136
|
+
self.avatar = attributes[:'avatar']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'network_id')
|
140
|
+
self.network_id = attributes[:'network_id']
|
141
|
+
else
|
142
|
+
self.network_id = nil
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.key?(:'expires_at')
|
146
|
+
self.expires_at = attributes[:'expires_at']
|
147
|
+
else
|
148
|
+
self.expires_at = nil
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.key?(:'text_records')
|
152
|
+
if (value = attributes[:'text_records']).is_a?(Hash)
|
153
|
+
self.text_records = value
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.key?(:'is_primary')
|
158
|
+
self.is_primary = attributes[:'is_primary']
|
159
|
+
else
|
160
|
+
self.is_primary = nil
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
165
|
+
# @return Array for valid properties with the reasons
|
166
|
+
def list_invalid_properties
|
167
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
168
|
+
invalid_properties = Array.new
|
169
|
+
if @token_id.nil?
|
170
|
+
invalid_properties.push('invalid value for "token_id", token_id cannot be nil.')
|
171
|
+
end
|
172
|
+
|
173
|
+
if @owner_address.nil?
|
174
|
+
invalid_properties.push('invalid value for "owner_address", owner_address cannot be nil.')
|
175
|
+
end
|
176
|
+
|
177
|
+
if @manager_address.nil?
|
178
|
+
invalid_properties.push('invalid value for "manager_address", manager_address cannot be nil.')
|
179
|
+
end
|
180
|
+
|
181
|
+
if @domain.nil?
|
182
|
+
invalid_properties.push('invalid value for "domain", domain cannot be nil.')
|
183
|
+
end
|
184
|
+
|
185
|
+
if @network_id.nil?
|
186
|
+
invalid_properties.push('invalid value for "network_id", network_id cannot be nil.')
|
187
|
+
end
|
188
|
+
|
189
|
+
if @expires_at.nil?
|
190
|
+
invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
|
191
|
+
end
|
192
|
+
|
193
|
+
if @is_primary.nil?
|
194
|
+
invalid_properties.push('invalid value for "is_primary", is_primary cannot be nil.')
|
195
|
+
end
|
196
|
+
|
197
|
+
invalid_properties
|
198
|
+
end
|
199
|
+
|
200
|
+
# Check to see if the all the properties in the model are valid
|
201
|
+
# @return true if the model is valid
|
202
|
+
def valid?
|
203
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
204
|
+
return false if @token_id.nil?
|
205
|
+
return false if @owner_address.nil?
|
206
|
+
return false if @manager_address.nil?
|
207
|
+
return false if @domain.nil?
|
208
|
+
return false if @network_id.nil?
|
209
|
+
return false if @expires_at.nil?
|
210
|
+
return false if @is_primary.nil?
|
211
|
+
true
|
212
|
+
end
|
213
|
+
|
214
|
+
# Checks equality by comparing each attribute.
|
215
|
+
# @param [Object] Object to be compared
|
216
|
+
def ==(o)
|
217
|
+
return true if self.equal?(o)
|
218
|
+
self.class == o.class &&
|
219
|
+
token_id == o.token_id &&
|
220
|
+
owner_address == o.owner_address &&
|
221
|
+
manager_address == o.manager_address &&
|
222
|
+
primary_address == o.primary_address &&
|
223
|
+
domain == o.domain &&
|
224
|
+
avatar == o.avatar &&
|
225
|
+
network_id == o.network_id &&
|
226
|
+
expires_at == o.expires_at &&
|
227
|
+
text_records == o.text_records &&
|
228
|
+
is_primary == o.is_primary
|
229
|
+
end
|
230
|
+
|
231
|
+
# @see the `==` method
|
232
|
+
# @param [Object] Object to be compared
|
233
|
+
def eql?(o)
|
234
|
+
self == o
|
235
|
+
end
|
236
|
+
|
237
|
+
# Calculates hash code according to all attributes.
|
238
|
+
# @return [Integer] Hash code
|
239
|
+
def hash
|
240
|
+
[token_id, owner_address, manager_address, primary_address, domain, avatar, network_id, expires_at, text_records, is_primary].hash
|
241
|
+
end
|
242
|
+
|
243
|
+
# Builds the object from hash
|
244
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
245
|
+
# @return [Object] Returns the model itself
|
246
|
+
def self.build_from_hash(attributes)
|
247
|
+
return nil unless attributes.is_a?(Hash)
|
248
|
+
attributes = attributes.transform_keys(&:to_sym)
|
249
|
+
transformed_hash = {}
|
250
|
+
openapi_types.each_pair do |key, type|
|
251
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
252
|
+
transformed_hash["#{key}"] = nil
|
253
|
+
elsif type =~ /\AArray<(.*)>/i
|
254
|
+
# check to ensure the input is an array given that the attribute
|
255
|
+
# is documented as an array but the input is not
|
256
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
257
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
258
|
+
end
|
259
|
+
elsif !attributes[attribute_map[key]].nil?
|
260
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
261
|
+
end
|
262
|
+
end
|
263
|
+
new(transformed_hash)
|
264
|
+
end
|
265
|
+
|
266
|
+
# Deserializes the data based on type
|
267
|
+
# @param string type Data type
|
268
|
+
# @param string value Value to be deserialized
|
269
|
+
# @return [Object] Deserialized data
|
270
|
+
def self._deserialize(type, value)
|
271
|
+
case type.to_sym
|
272
|
+
when :Time
|
273
|
+
Time.parse(value)
|
274
|
+
when :Date
|
275
|
+
Date.parse(value)
|
276
|
+
when :String
|
277
|
+
value.to_s
|
278
|
+
when :Integer
|
279
|
+
value.to_i
|
280
|
+
when :Float
|
281
|
+
value.to_f
|
282
|
+
when :Boolean
|
283
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
284
|
+
true
|
285
|
+
else
|
286
|
+
false
|
287
|
+
end
|
288
|
+
when :Object
|
289
|
+
# generic object (usually a Hash), return directly
|
290
|
+
value
|
291
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
292
|
+
inner_type = Regexp.last_match[:inner_type]
|
293
|
+
value.map { |v| _deserialize(inner_type, v) }
|
294
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
295
|
+
k_type = Regexp.last_match[:k_type]
|
296
|
+
v_type = Regexp.last_match[:v_type]
|
297
|
+
{}.tap do |hash|
|
298
|
+
value.each do |k, v|
|
299
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
else # model
|
303
|
+
# models (e.g. Pet) or oneOf
|
304
|
+
klass = Coinbase::Client.const_get(type)
|
305
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
# Returns the string representation of the object
|
310
|
+
# @return [String] String presentation of the object
|
311
|
+
def to_s
|
312
|
+
to_hash.to_s
|
313
|
+
end
|
314
|
+
|
315
|
+
# to_body is an alias to to_hash (backward compatibility)
|
316
|
+
# @return [Hash] Returns the object in the form of hash
|
317
|
+
def to_body
|
318
|
+
to_hash
|
319
|
+
end
|
320
|
+
|
321
|
+
# Returns the object in the form of hash
|
322
|
+
# @return [Hash] Returns the object in the form of hash
|
323
|
+
def to_hash
|
324
|
+
hash = {}
|
325
|
+
self.class.attribute_map.each_pair do |attr, param|
|
326
|
+
value = self.send(attr)
|
327
|
+
if value.nil?
|
328
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
329
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
330
|
+
end
|
331
|
+
|
332
|
+
hash[param] = _to_hash(value)
|
333
|
+
end
|
334
|
+
hash
|
335
|
+
end
|
336
|
+
|
337
|
+
# Outputs non-array value in the form of hash
|
338
|
+
# For object, use to_hash. Otherwise, just return the value
|
339
|
+
# @param [Object] value Any valid value
|
340
|
+
# @return [Hash] Returns the value in the form of hash
|
341
|
+
def _to_hash(value)
|
342
|
+
if value.is_a?(Array)
|
343
|
+
value.compact.map { |v| _to_hash(v) }
|
344
|
+
elsif value.is_a?(Hash)
|
345
|
+
{}.tap do |hash|
|
346
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
347
|
+
end
|
348
|
+
elsif value.respond_to? :to_hash
|
349
|
+
value.to_hash
|
350
|
+
else
|
351
|
+
value
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
end
|
356
|
+
|
357
|
+
end
|