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,289 @@
|
|
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 UpdateWebhookRequest
|
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 Webhook uri that updates to
|
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::UpdateWebhookRequest` 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::UpdateWebhookRequest`. 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
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'event_type')
|
102
|
+
self.event_type = attributes[:'event_type']
|
103
|
+
else
|
104
|
+
self.event_type = nil
|
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
|
+
else
|
112
|
+
self.event_filters = nil
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'notification_uri')
|
116
|
+
self.notification_uri = attributes[:'notification_uri']
|
117
|
+
else
|
118
|
+
self.notification_uri = nil
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
123
|
+
# @return Array for valid properties with the reasons
|
124
|
+
def list_invalid_properties
|
125
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
126
|
+
invalid_properties = Array.new
|
127
|
+
if @event_type.nil?
|
128
|
+
invalid_properties.push('invalid value for "event_type", event_type cannot be nil.')
|
129
|
+
end
|
130
|
+
|
131
|
+
if @event_filters.nil?
|
132
|
+
invalid_properties.push('invalid value for "event_filters", event_filters cannot be nil.')
|
133
|
+
end
|
134
|
+
|
135
|
+
if @notification_uri.nil?
|
136
|
+
invalid_properties.push('invalid value for "notification_uri", notification_uri cannot be nil.')
|
137
|
+
end
|
138
|
+
|
139
|
+
invalid_properties
|
140
|
+
end
|
141
|
+
|
142
|
+
# Check to see if the all the properties in the model are valid
|
143
|
+
# @return true if the model is valid
|
144
|
+
def valid?
|
145
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
146
|
+
return false if @event_type.nil?
|
147
|
+
return false if @event_filters.nil?
|
148
|
+
return false if @notification_uri.nil?
|
149
|
+
true
|
150
|
+
end
|
151
|
+
|
152
|
+
# Checks equality by comparing each attribute.
|
153
|
+
# @param [Object] Object to be compared
|
154
|
+
def ==(o)
|
155
|
+
return true if self.equal?(o)
|
156
|
+
self.class == o.class &&
|
157
|
+
network_id == o.network_id &&
|
158
|
+
event_type == o.event_type &&
|
159
|
+
event_filters == o.event_filters &&
|
160
|
+
notification_uri == o.notification_uri
|
161
|
+
end
|
162
|
+
|
163
|
+
# @see the `==` method
|
164
|
+
# @param [Object] Object to be compared
|
165
|
+
def eql?(o)
|
166
|
+
self == o
|
167
|
+
end
|
168
|
+
|
169
|
+
# Calculates hash code according to all attributes.
|
170
|
+
# @return [Integer] Hash code
|
171
|
+
def hash
|
172
|
+
[network_id, event_type, event_filters, notification_uri].hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Builds the object from hash
|
176
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
177
|
+
# @return [Object] Returns the model itself
|
178
|
+
def self.build_from_hash(attributes)
|
179
|
+
return nil unless attributes.is_a?(Hash)
|
180
|
+
attributes = attributes.transform_keys(&:to_sym)
|
181
|
+
transformed_hash = {}
|
182
|
+
openapi_types.each_pair do |key, type|
|
183
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
184
|
+
transformed_hash["#{key}"] = nil
|
185
|
+
elsif type =~ /\AArray<(.*)>/i
|
186
|
+
# check to ensure the input is an array given that the attribute
|
187
|
+
# is documented as an array but the input is not
|
188
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
189
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
190
|
+
end
|
191
|
+
elsif !attributes[attribute_map[key]].nil?
|
192
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
193
|
+
end
|
194
|
+
end
|
195
|
+
new(transformed_hash)
|
196
|
+
end
|
197
|
+
|
198
|
+
# Deserializes the data based on type
|
199
|
+
# @param string type Data type
|
200
|
+
# @param string value Value to be deserialized
|
201
|
+
# @return [Object] Deserialized data
|
202
|
+
def self._deserialize(type, value)
|
203
|
+
case type.to_sym
|
204
|
+
when :Time
|
205
|
+
Time.parse(value)
|
206
|
+
when :Date
|
207
|
+
Date.parse(value)
|
208
|
+
when :String
|
209
|
+
value.to_s
|
210
|
+
when :Integer
|
211
|
+
value.to_i
|
212
|
+
when :Float
|
213
|
+
value.to_f
|
214
|
+
when :Boolean
|
215
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
216
|
+
true
|
217
|
+
else
|
218
|
+
false
|
219
|
+
end
|
220
|
+
when :Object
|
221
|
+
# generic object (usually a Hash), return directly
|
222
|
+
value
|
223
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
224
|
+
inner_type = Regexp.last_match[:inner_type]
|
225
|
+
value.map { |v| _deserialize(inner_type, v) }
|
226
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
227
|
+
k_type = Regexp.last_match[:k_type]
|
228
|
+
v_type = Regexp.last_match[:v_type]
|
229
|
+
{}.tap do |hash|
|
230
|
+
value.each do |k, v|
|
231
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
else # model
|
235
|
+
# models (e.g. Pet) or oneOf
|
236
|
+
klass = Coinbase::Client.const_get(type)
|
237
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
# Returns the string representation of the object
|
242
|
+
# @return [String] String presentation of the object
|
243
|
+
def to_s
|
244
|
+
to_hash.to_s
|
245
|
+
end
|
246
|
+
|
247
|
+
# to_body is an alias to to_hash (backward compatibility)
|
248
|
+
# @return [Hash] Returns the object in the form of hash
|
249
|
+
def to_body
|
250
|
+
to_hash
|
251
|
+
end
|
252
|
+
|
253
|
+
# Returns the object in the form of hash
|
254
|
+
# @return [Hash] Returns the object in the form of hash
|
255
|
+
def to_hash
|
256
|
+
hash = {}
|
257
|
+
self.class.attribute_map.each_pair do |attr, param|
|
258
|
+
value = self.send(attr)
|
259
|
+
if value.nil?
|
260
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
261
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
262
|
+
end
|
263
|
+
|
264
|
+
hash[param] = _to_hash(value)
|
265
|
+
end
|
266
|
+
hash
|
267
|
+
end
|
268
|
+
|
269
|
+
# Outputs non-array value in the form of hash
|
270
|
+
# For object, use to_hash. Otherwise, just return the value
|
271
|
+
# @param [Object] value Any valid value
|
272
|
+
# @return [Hash] Returns the value in the form of hash
|
273
|
+
def _to_hash(value)
|
274
|
+
if value.is_a?(Array)
|
275
|
+
value.compact.map { |v| _to_hash(v) }
|
276
|
+
elsif value.is_a?(Hash)
|
277
|
+
{}.tap do |hash|
|
278
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
279
|
+
end
|
280
|
+
elsif value.respond_to? :to_hash
|
281
|
+
value.to_hash
|
282
|
+
else
|
283
|
+
value
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|
@@ -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
|