coinbase-sdk 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/external_address.rb +173 -0
  3. data/lib/coinbase/address/wallet_address.rb +219 -0
  4. data/lib/coinbase/address.rb +32 -219
  5. data/lib/coinbase/asset.rb +1 -1
  6. data/lib/coinbase/authenticator.rb +2 -0
  7. data/lib/coinbase/client/api/addresses_api.rb +1 -1
  8. data/lib/coinbase/client/api/assets_api.rb +1 -1
  9. data/lib/coinbase/client/api/external_addresses_api.rb +1 -1
  10. data/lib/coinbase/client/api/server_signers_api.rb +1 -1
  11. data/lib/coinbase/client/api/stake_api.rb +1 -1
  12. data/lib/coinbase/client/api/trades_api.rb +1 -1
  13. data/lib/coinbase/client/api/transfers_api.rb +1 -1
  14. data/lib/coinbase/client/api/users_api.rb +1 -1
  15. data/lib/coinbase/client/api/wallets_api.rb +1 -1
  16. data/lib/coinbase/client/api_client.rb +3 -3
  17. data/lib/coinbase/client/api_error.rb +1 -1
  18. data/lib/coinbase/client/configuration.rb +1 -1
  19. data/lib/coinbase/client/models/address.rb +1 -1
  20. data/lib/coinbase/client/models/address_balance_list.rb +1 -1
  21. data/lib/coinbase/client/models/address_list.rb +1 -1
  22. data/lib/coinbase/client/models/asset.rb +1 -1
  23. data/lib/coinbase/client/models/balance.rb +1 -1
  24. data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
  25. data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
  26. data/lib/coinbase/client/models/build_staking_operation_request.rb +1 -1
  27. data/lib/coinbase/client/models/create_address_request.rb +1 -1
  28. data/lib/coinbase/client/models/create_server_signer_request.rb +22 -5
  29. data/lib/coinbase/client/models/create_trade_request.rb +1 -1
  30. data/lib/coinbase/client/models/create_transfer_request.rb +1 -1
  31. data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
  32. data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
  33. data/lib/coinbase/client/models/error.rb +1 -1
  34. data/lib/coinbase/client/models/faucet_transaction.rb +23 -5
  35. data/lib/coinbase/client/models/feature.rb +1 -1
  36. data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +1 -1
  37. data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +2 -15
  38. data/lib/coinbase/client/models/get_staking_context_request.rb +1 -1
  39. data/lib/coinbase/client/models/partial_eth_staking_context.rb +4 -7
  40. data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
  41. data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
  42. data/lib/coinbase/client/models/server_signer.rb +22 -5
  43. data/lib/coinbase/client/models/server_signer_event.rb +1 -1
  44. data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
  45. data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
  46. data/lib/coinbase/client/models/server_signer_list.rb +1 -1
  47. data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
  48. data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
  49. data/lib/coinbase/client/models/staking_context.rb +1 -1
  50. data/lib/coinbase/client/models/staking_context_context.rb +1 -1
  51. data/lib/coinbase/client/models/staking_operation.rb +15 -12
  52. data/lib/coinbase/client/models/staking_reward.rb +21 -5
  53. data/lib/coinbase/client/models/staking_reward_format.rb +40 -0
  54. data/lib/coinbase/client/models/trade.rb +1 -1
  55. data/lib/coinbase/client/models/trade_list.rb +1 -1
  56. data/lib/coinbase/client/models/transaction.rb +1 -1
  57. data/lib/coinbase/client/models/transaction_type.rb +1 -1
  58. data/lib/coinbase/client/models/transfer.rb +1 -1
  59. data/lib/coinbase/client/models/transfer_list.rb +1 -1
  60. data/lib/coinbase/client/models/user.rb +1 -1
  61. data/lib/coinbase/client/models/wallet.rb +1 -1
  62. data/lib/coinbase/client/models/wallet_list.rb +1 -1
  63. data/lib/coinbase/client/version.rb +1 -1
  64. data/lib/coinbase/client.rb +2 -1
  65. data/lib/coinbase/errors.rb +7 -0
  66. data/lib/coinbase/faucet_transaction.rb +5 -4
  67. data/lib/coinbase/pagination.rb +26 -0
  68. data/lib/coinbase/staking_operation.rb +29 -0
  69. data/lib/coinbase/staking_reward.rb +79 -0
  70. data/lib/coinbase/transaction.rb +6 -0
  71. data/lib/coinbase/user.rb +5 -51
  72. data/lib/coinbase/wallet.rb +95 -100
  73. data/lib/coinbase.rb +11 -0
  74. metadata +8 -19
  75. data/lib/coinbase/client/api/balances_api.rb +0 -97
  76. data/lib/coinbase/client/api/transfer_api.rb +0 -114
  77. data/lib/coinbase/client/models/request_faucet_funds200_response.rb +0 -222
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coinbase-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuga Cohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-20 00:00:00.000000000 Z
11
+ date: 2024-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: jimson
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: jwt
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -242,6 +228,8 @@ extra_rdoc_files: []
242
228
  files:
243
229
  - lib/coinbase.rb
244
230
  - lib/coinbase/address.rb
231
+ - lib/coinbase/address/external_address.rb
232
+ - lib/coinbase/address/wallet_address.rb
245
233
  - lib/coinbase/asset.rb
246
234
  - lib/coinbase/authenticator.rb
247
235
  - lib/coinbase/balance.rb
@@ -249,12 +237,10 @@ files:
249
237
  - lib/coinbase/client.rb
250
238
  - lib/coinbase/client/api/addresses_api.rb
251
239
  - lib/coinbase/client/api/assets_api.rb
252
- - lib/coinbase/client/api/balances_api.rb
253
240
  - lib/coinbase/client/api/external_addresses_api.rb
254
241
  - lib/coinbase/client/api/server_signers_api.rb
255
242
  - lib/coinbase/client/api/stake_api.rb
256
243
  - lib/coinbase/client/api/trades_api.rb
257
- - lib/coinbase/client/api/transfer_api.rb
258
244
  - lib/coinbase/client/api/transfers_api.rb
259
245
  - lib/coinbase/client/api/users_api.rb
260
246
  - lib/coinbase/client/api/wallets_api.rb
@@ -282,7 +268,6 @@ files:
282
268
  - lib/coinbase/client/models/fetch_staking_rewards_request.rb
283
269
  - lib/coinbase/client/models/get_staking_context_request.rb
284
270
  - lib/coinbase/client/models/partial_eth_staking_context.rb
285
- - lib/coinbase/client/models/request_faucet_funds200_response.rb
286
271
  - lib/coinbase/client/models/seed_creation_event.rb
287
272
  - lib/coinbase/client/models/seed_creation_event_result.rb
288
273
  - lib/coinbase/client/models/server_signer.rb
@@ -296,6 +281,7 @@ files:
296
281
  - lib/coinbase/client/models/staking_context_context.rb
297
282
  - lib/coinbase/client/models/staking_operation.rb
298
283
  - lib/coinbase/client/models/staking_reward.rb
284
+ - lib/coinbase/client/models/staking_reward_format.rb
299
285
  - lib/coinbase/client/models/trade.rb
300
286
  - lib/coinbase/client/models/trade_list.rb
301
287
  - lib/coinbase/client/models/transaction.rb
@@ -311,7 +297,10 @@ files:
311
297
  - lib/coinbase/faucet_transaction.rb
312
298
  - lib/coinbase/middleware.rb
313
299
  - lib/coinbase/network.rb
300
+ - lib/coinbase/pagination.rb
314
301
  - lib/coinbase/server_signer.rb
302
+ - lib/coinbase/staking_operation.rb
303
+ - lib/coinbase/staking_reward.rb
315
304
  - lib/coinbase/trade.rb
316
305
  - lib/coinbase/transaction.rb
317
306
  - lib/coinbase/transfer.rb
@@ -1,97 +0,0 @@
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.5.0
10
-
11
- =end
12
-
13
- require 'cgi'
14
-
15
- module Coinbase::Client
16
- class BalancesApi
17
- attr_accessor :api_client
18
-
19
- def initialize(api_client = ApiClient.default)
20
- @api_client = api_client
21
- end
22
- # Get the balance of an asset in an external address
23
- # Get the balance of an asset in an external address
24
- # @param network_id [String] The ID of the blockchain network
25
- # @param address_id [String] The ID of the address to fetch the balance for
26
- # @param asset_id [String] The ID of the asset to fetch the balance for
27
- # @param [Hash] opts the optional parameters
28
- # @return [Balance]
29
- def get_external_address_balance(network_id, address_id, asset_id, opts = {})
30
- data, _status_code, _headers = get_external_address_balance_with_http_info(network_id, address_id, asset_id, opts)
31
- data
32
- end
33
-
34
- # Get the balance of an asset in an external address
35
- # Get the balance of an asset in an external address
36
- # @param network_id [String] The ID of the blockchain network
37
- # @param address_id [String] The ID of the address to fetch the balance for
38
- # @param asset_id [String] The ID of the asset to fetch the balance for
39
- # @param [Hash] opts the optional parameters
40
- # @return [Array<(Balance, Integer, Hash)>] Balance data, response status code and response headers
41
- def get_external_address_balance_with_http_info(network_id, address_id, asset_id, opts = {})
42
- if @api_client.config.debugging
43
- @api_client.config.logger.debug 'Calling API: BalancesApi.get_external_address_balance ...'
44
- end
45
- # verify the required parameter 'network_id' is set
46
- if @api_client.config.client_side_validation && network_id.nil?
47
- fail ArgumentError, "Missing the required parameter 'network_id' when calling BalancesApi.get_external_address_balance"
48
- end
49
- # verify the required parameter 'address_id' is set
50
- if @api_client.config.client_side_validation && address_id.nil?
51
- fail ArgumentError, "Missing the required parameter 'address_id' when calling BalancesApi.get_external_address_balance"
52
- end
53
- # verify the required parameter 'asset_id' is set
54
- if @api_client.config.client_side_validation && asset_id.nil?
55
- fail ArgumentError, "Missing the required parameter 'asset_id' when calling BalancesApi.get_external_address_balance"
56
- end
57
- # resource path
58
- local_var_path = '/v1/networks/{network_id}/addresses/{address_id}/balances/{asset_id}'.sub('{' + 'network_id' + '}', CGI.escape(network_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_id.to_s))
59
-
60
- # query parameters
61
- query_params = opts[:query_params] || {}
62
-
63
- # header parameters
64
- header_params = opts[:header_params] || {}
65
- # HTTP header 'Accept' (if needed)
66
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
67
-
68
- # form parameters
69
- form_params = opts[:form_params] || {}
70
-
71
- # http body (model)
72
- post_body = opts[:debug_body]
73
-
74
- # return_type
75
- return_type = opts[:debug_return_type] || 'Balance'
76
-
77
- # auth_names
78
- auth_names = opts[:debug_auth_names] || []
79
-
80
- new_options = opts.merge(
81
- :operation => :"BalancesApi.get_external_address_balance",
82
- :header_params => header_params,
83
- :query_params => query_params,
84
- :form_params => form_params,
85
- :body => post_body,
86
- :auth_names => auth_names,
87
- :return_type => return_type
88
- )
89
-
90
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
91
- if @api_client.config.debugging
92
- @api_client.config.logger.debug "API called: BalancesApi#get_external_address_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
93
- end
94
- return data, status_code, headers
95
- end
96
- end
97
- end
@@ -1,114 +0,0 @@
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.5.0
10
-
11
- =end
12
-
13
- require 'cgi'
14
-
15
- module Coinbase::Client
16
- class TransferApi
17
- attr_accessor :api_client
18
-
19
- def initialize(api_client = ApiClient.default)
20
- @api_client = api_client
21
- end
22
- # Build a new transfer
23
- # Build a new transfer object without tracking anything server-side.
24
- # @param network_id [String] The ID of the blockchain network
25
- # @param address_id [String] The ID of the address to transfer from
26
- # @param amount [String] The amount to transfer
27
- # @param asset_id [String] The ID of the asset to transfer
28
- # @param destination [String] The destination address
29
- # @param [Hash] opts the optional parameters
30
- # @return [Transfer]
31
- def build_transfer(network_id, address_id, amount, asset_id, destination, opts = {})
32
- data, _status_code, _headers = build_transfer_with_http_info(network_id, address_id, amount, asset_id, destination, opts)
33
- data
34
- end
35
-
36
- # Build a new transfer
37
- # Build a new transfer object without tracking anything server-side.
38
- # @param network_id [String] The ID of the blockchain network
39
- # @param address_id [String] The ID of the address to transfer from
40
- # @param amount [String] The amount to transfer
41
- # @param asset_id [String] The ID of the asset to transfer
42
- # @param destination [String] The destination address
43
- # @param [Hash] opts the optional parameters
44
- # @return [Array<(Transfer, Integer, Hash)>] Transfer data, response status code and response headers
45
- def build_transfer_with_http_info(network_id, address_id, amount, asset_id, destination, opts = {})
46
- if @api_client.config.debugging
47
- @api_client.config.logger.debug 'Calling API: TransferApi.build_transfer ...'
48
- end
49
- # verify the required parameter 'network_id' is set
50
- if @api_client.config.client_side_validation && network_id.nil?
51
- fail ArgumentError, "Missing the required parameter 'network_id' when calling TransferApi.build_transfer"
52
- end
53
- # verify the required parameter 'address_id' is set
54
- if @api_client.config.client_side_validation && address_id.nil?
55
- fail ArgumentError, "Missing the required parameter 'address_id' when calling TransferApi.build_transfer"
56
- end
57
- # verify the required parameter 'amount' is set
58
- if @api_client.config.client_side_validation && amount.nil?
59
- fail ArgumentError, "Missing the required parameter 'amount' when calling TransferApi.build_transfer"
60
- end
61
- # verify the required parameter 'asset_id' is set
62
- if @api_client.config.client_side_validation && asset_id.nil?
63
- fail ArgumentError, "Missing the required parameter 'asset_id' when calling TransferApi.build_transfer"
64
- end
65
- # verify the required parameter 'destination' is set
66
- if @api_client.config.client_side_validation && destination.nil?
67
- fail ArgumentError, "Missing the required parameter 'destination' when calling TransferApi.build_transfer"
68
- end
69
- # resource path
70
- local_var_path = '/v1/transfers/build'
71
-
72
- # query parameters
73
- query_params = opts[:query_params] || {}
74
- query_params[:'network_id'] = network_id
75
- query_params[:'address_id'] = address_id
76
- query_params[:'amount'] = amount
77
- query_params[:'asset_id'] = asset_id
78
- query_params[:'destination'] = destination
79
-
80
- # header parameters
81
- header_params = opts[:header_params] || {}
82
- # HTTP header 'Accept' (if needed)
83
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
84
-
85
- # form parameters
86
- form_params = opts[:form_params] || {}
87
-
88
- # http body (model)
89
- post_body = opts[:debug_body]
90
-
91
- # return_type
92
- return_type = opts[:debug_return_type] || 'Transfer'
93
-
94
- # auth_names
95
- auth_names = opts[:debug_auth_names] || []
96
-
97
- new_options = opts.merge(
98
- :operation => :"TransferApi.build_transfer",
99
- :header_params => header_params,
100
- :query_params => query_params,
101
- :form_params => form_params,
102
- :body => post_body,
103
- :auth_names => auth_names,
104
- :return_type => return_type
105
- )
106
-
107
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
108
- if @api_client.config.debugging
109
- @api_client.config.logger.debug "API called: TransferApi#build_transfer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
110
- end
111
- return data, status_code, headers
112
- end
113
- end
114
- end
@@ -1,222 +0,0 @@
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.5.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module Coinbase::Client
17
- class RequestFaucetFunds200Response
18
- # The transaction hash of the transaction the faucet created.
19
- attr_accessor :transaction_hash
20
-
21
- # Attribute mapping from ruby-style variable name to JSON key.
22
- def self.attribute_map
23
- {
24
- :'transaction_hash' => :'transaction_hash'
25
- }
26
- end
27
-
28
- # Returns all the JSON keys this model knows about
29
- def self.acceptable_attributes
30
- attribute_map.values
31
- end
32
-
33
- # Attribute type mapping.
34
- def self.openapi_types
35
- {
36
- :'transaction_hash' => :'String'
37
- }
38
- end
39
-
40
- # List of attributes with nullable: true
41
- def self.openapi_nullable
42
- Set.new([
43
- ])
44
- end
45
-
46
- # Initializes the object
47
- # @param [Hash] attributes Model attributes in the form of hash
48
- def initialize(attributes = {})
49
- if (!attributes.is_a?(Hash))
50
- fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::RequestFaucetFunds200Response` initialize method"
51
- end
52
-
53
- # check to see if the attribute exists and convert string to symbol for hash key
54
- attributes = attributes.each_with_object({}) { |(k, v), h|
55
- if (!self.class.attribute_map.key?(k.to_sym))
56
- fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::RequestFaucetFunds200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
- end
58
- h[k.to_sym] = v
59
- }
60
-
61
- if attributes.key?(:'transaction_hash')
62
- self.transaction_hash = attributes[:'transaction_hash']
63
- else
64
- self.transaction_hash = nil
65
- end
66
- end
67
-
68
- # Show invalid properties with the reasons. Usually used together with valid?
69
- # @return Array for valid properties with the reasons
70
- def list_invalid_properties
71
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
72
- invalid_properties = Array.new
73
- if @transaction_hash.nil?
74
- invalid_properties.push('invalid value for "transaction_hash", transaction_hash cannot be nil.')
75
- end
76
-
77
- invalid_properties
78
- end
79
-
80
- # Check to see if the all the properties in the model are valid
81
- # @return true if the model is valid
82
- def valid?
83
- warn '[DEPRECATED] the `valid?` method is obsolete'
84
- return false if @transaction_hash.nil?
85
- true
86
- end
87
-
88
- # Checks equality by comparing each attribute.
89
- # @param [Object] Object to be compared
90
- def ==(o)
91
- return true if self.equal?(o)
92
- self.class == o.class &&
93
- transaction_hash == o.transaction_hash
94
- end
95
-
96
- # @see the `==` method
97
- # @param [Object] Object to be compared
98
- def eql?(o)
99
- self == o
100
- end
101
-
102
- # Calculates hash code according to all attributes.
103
- # @return [Integer] Hash code
104
- def hash
105
- [transaction_hash].hash
106
- end
107
-
108
- # Builds the object from hash
109
- # @param [Hash] attributes Model attributes in the form of hash
110
- # @return [Object] Returns the model itself
111
- def self.build_from_hash(attributes)
112
- return nil unless attributes.is_a?(Hash)
113
- attributes = attributes.transform_keys(&:to_sym)
114
- transformed_hash = {}
115
- openapi_types.each_pair do |key, type|
116
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
117
- transformed_hash["#{key}"] = nil
118
- elsif type =~ /\AArray<(.*)>/i
119
- # check to ensure the input is an array given that the attribute
120
- # is documented as an array but the input is not
121
- if attributes[attribute_map[key]].is_a?(Array)
122
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
123
- end
124
- elsif !attributes[attribute_map[key]].nil?
125
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
126
- end
127
- end
128
- new(transformed_hash)
129
- end
130
-
131
- # Deserializes the data based on type
132
- # @param string type Data type
133
- # @param string value Value to be deserialized
134
- # @return [Object] Deserialized data
135
- def self._deserialize(type, value)
136
- case type.to_sym
137
- when :Time
138
- Time.parse(value)
139
- when :Date
140
- Date.parse(value)
141
- when :String
142
- value.to_s
143
- when :Integer
144
- value.to_i
145
- when :Float
146
- value.to_f
147
- when :Boolean
148
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
- true
150
- else
151
- false
152
- end
153
- when :Object
154
- # generic object (usually a Hash), return directly
155
- value
156
- when /\AArray<(?<inner_type>.+)>\z/
157
- inner_type = Regexp.last_match[:inner_type]
158
- value.map { |v| _deserialize(inner_type, v) }
159
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
- k_type = Regexp.last_match[:k_type]
161
- v_type = Regexp.last_match[:v_type]
162
- {}.tap do |hash|
163
- value.each do |k, v|
164
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
- end
166
- end
167
- else # model
168
- # models (e.g. Pet) or oneOf
169
- klass = Coinbase::Client.const_get(type)
170
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
171
- end
172
- end
173
-
174
- # Returns the string representation of the object
175
- # @return [String] String presentation of the object
176
- def to_s
177
- to_hash.to_s
178
- end
179
-
180
- # to_body is an alias to to_hash (backward compatibility)
181
- # @return [Hash] Returns the object in the form of hash
182
- def to_body
183
- to_hash
184
- end
185
-
186
- # Returns the object in the form of hash
187
- # @return [Hash] Returns the object in the form of hash
188
- def to_hash
189
- hash = {}
190
- self.class.attribute_map.each_pair do |attr, param|
191
- value = self.send(attr)
192
- if value.nil?
193
- is_nullable = self.class.openapi_nullable.include?(attr)
194
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
- end
196
-
197
- hash[param] = _to_hash(value)
198
- end
199
- hash
200
- end
201
-
202
- # Outputs non-array value in the form of hash
203
- # For object, use to_hash. Otherwise, just return the value
204
- # @param [Object] value Any valid value
205
- # @return [Hash] Returns the value in the form of hash
206
- def _to_hash(value)
207
- if value.is_a?(Array)
208
- value.compact.map { |v| _to_hash(v) }
209
- elsif value.is_a?(Hash)
210
- {}.tap do |hash|
211
- value.each { |k, v| hash[k] = _to_hash(v) }
212
- end
213
- elsif value.respond_to? :to_hash
214
- value.to_hash
215
- else
216
- value
217
- end
218
- end
219
-
220
- end
221
-
222
- end