coinbase-sdk 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address/wallet_address.rb +10 -2
  3. data/lib/coinbase/address.rb +5 -1
  4. data/lib/coinbase/client/api/addresses_api.rb +10 -10
  5. data/lib/coinbase/client/api/assets_api.rb +2 -2
  6. data/lib/coinbase/client/api/balance_history_api.rb +107 -0
  7. data/lib/coinbase/client/api/contract_events_api.rb +4 -4
  8. data/lib/coinbase/client/api/contract_invocations_api.rb +5 -5
  9. data/lib/coinbase/client/api/external_addresses_api.rb +5 -90
  10. data/lib/coinbase/client/api/networks_api.rb +2 -2
  11. data/lib/coinbase/client/api/server_signers_api.rb +7 -7
  12. data/lib/coinbase/client/api/stake_api.rb +6 -6
  13. data/lib/coinbase/client/api/trades_api.rb +5 -5
  14. data/lib/coinbase/client/api/transfers_api.rb +5 -5
  15. data/lib/coinbase/client/api/validators_api.rb +7 -7
  16. data/lib/coinbase/client/api/wallet_stake_api.rb +4 -4
  17. data/lib/coinbase/client/api/wallets_api.rb +10 -10
  18. data/lib/coinbase/client/api/webhooks_api.rb +5 -5
  19. data/lib/coinbase/client/api_client.rb +30 -24
  20. data/lib/coinbase/client/api_error.rb +1 -1
  21. data/lib/coinbase/client/configuration.rb +1 -1
  22. data/lib/coinbase/client/models/address.rb +1 -1
  23. data/lib/coinbase/client/models/address_balance_list.rb +1 -1
  24. data/lib/coinbase/client/models/address_historical_balance_list.rb +1 -1
  25. data/lib/coinbase/client/models/address_list.rb +1 -1
  26. data/lib/coinbase/client/models/address_transaction_list.rb +1 -1
  27. data/lib/coinbase/client/models/asset.rb +1 -1
  28. data/lib/coinbase/client/models/balance.rb +1 -1
  29. data/lib/coinbase/client/models/broadcast_contract_invocation_request.rb +1 -1
  30. data/lib/coinbase/client/models/broadcast_staking_operation_request.rb +1 -1
  31. data/lib/coinbase/client/models/broadcast_trade_request.rb +1 -1
  32. data/lib/coinbase/client/models/broadcast_transfer_request.rb +1 -1
  33. data/lib/coinbase/client/models/build_staking_operation_request.rb +1 -1
  34. data/lib/coinbase/client/models/contract_event.rb +1 -1
  35. data/lib/coinbase/client/models/contract_event_list.rb +1 -1
  36. data/lib/coinbase/client/models/contract_invocation.rb +19 -2
  37. data/lib/coinbase/client/models/contract_invocation_list.rb +1 -1
  38. data/lib/coinbase/client/models/create_address_request.rb +1 -1
  39. data/lib/coinbase/client/models/create_contract_invocation_request.rb +15 -5
  40. data/lib/coinbase/client/models/create_payload_signature_request.rb +1 -1
  41. data/lib/coinbase/client/models/create_server_signer_request.rb +1 -1
  42. data/lib/coinbase/client/models/create_staking_operation_request.rb +1 -1
  43. data/lib/coinbase/client/models/create_trade_request.rb +1 -1
  44. data/lib/coinbase/client/models/create_transfer_request.rb +2 -2
  45. data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
  46. data/lib/coinbase/client/models/create_wallet_request_wallet.rb +1 -1
  47. data/lib/coinbase/client/models/create_webhook_request.rb +1 -1
  48. data/lib/coinbase/client/models/erc20_transfer_event.rb +336 -0
  49. data/lib/coinbase/client/models/{user.rb → erc721_transfer_event.rb} +130 -25
  50. data/lib/coinbase/client/models/error.rb +15 -5
  51. data/lib/coinbase/client/models/ethereum_transaction.rb +1 -1
  52. data/lib/coinbase/client/models/ethereum_transaction_access.rb +1 -1
  53. data/lib/coinbase/client/models/ethereum_transaction_access_list.rb +1 -1
  54. data/lib/coinbase/client/models/ethereum_transaction_flattened_trace.rb +1 -1
  55. data/lib/coinbase/client/models/ethereum_validator_metadata.rb +1 -1
  56. data/lib/coinbase/client/models/faucet_transaction.rb +1 -1
  57. data/lib/coinbase/client/models/feature_set.rb +1 -1
  58. data/lib/coinbase/client/models/fetch_historical_staking_balances200_response.rb +1 -1
  59. data/lib/coinbase/client/models/fetch_staking_rewards200_response.rb +1 -1
  60. data/lib/coinbase/client/models/fetch_staking_rewards_request.rb +1 -1
  61. data/lib/coinbase/client/models/get_staking_context_request.rb +1 -1
  62. data/lib/coinbase/client/models/historical_balance.rb +1 -1
  63. data/lib/coinbase/client/models/network.rb +1 -1
  64. data/lib/coinbase/client/models/network_identifier.rb +3 -2
  65. data/lib/coinbase/client/models/payload_signature.rb +1 -1
  66. data/lib/coinbase/client/models/payload_signature_list.rb +1 -1
  67. data/lib/coinbase/client/models/seed_creation_event.rb +1 -1
  68. data/lib/coinbase/client/models/seed_creation_event_result.rb +1 -1
  69. data/lib/coinbase/client/models/server_signer.rb +1 -1
  70. data/lib/coinbase/client/models/server_signer_event.rb +1 -1
  71. data/lib/coinbase/client/models/server_signer_event_event.rb +1 -1
  72. data/lib/coinbase/client/models/server_signer_event_list.rb +1 -1
  73. data/lib/coinbase/client/models/server_signer_list.rb +1 -1
  74. data/lib/coinbase/client/models/signature_creation_event.rb +1 -1
  75. data/lib/coinbase/client/models/signature_creation_event_result.rb +1 -1
  76. data/lib/coinbase/client/models/signed_voluntary_exit_message_metadata.rb +1 -1
  77. data/lib/coinbase/client/models/sponsored_send.rb +1 -1
  78. data/lib/coinbase/client/models/staking_balance.rb +1 -1
  79. data/lib/coinbase/client/models/staking_context.rb +1 -1
  80. data/lib/coinbase/client/models/staking_context_context.rb +1 -1
  81. data/lib/coinbase/client/models/staking_operation.rb +1 -1
  82. data/lib/coinbase/client/models/staking_operation_metadata.rb +1 -1
  83. data/lib/coinbase/client/models/staking_reward.rb +1 -1
  84. data/lib/coinbase/client/models/staking_reward_format.rb +1 -1
  85. data/lib/coinbase/client/models/staking_reward_usd_value.rb +1 -1
  86. data/lib/coinbase/client/models/trade.rb +1 -1
  87. data/lib/coinbase/client/models/trade_list.rb +1 -1
  88. data/lib/coinbase/client/models/transaction.rb +1 -1
  89. data/lib/coinbase/client/models/transaction_content.rb +1 -1
  90. data/lib/coinbase/client/models/transaction_type.rb +1 -1
  91. data/lib/coinbase/client/models/transfer.rb +1 -1
  92. data/lib/coinbase/client/models/transfer_list.rb +1 -1
  93. data/lib/coinbase/client/models/update_webhook_request.rb +1 -1
  94. data/lib/coinbase/client/models/validator.rb +1 -1
  95. data/lib/coinbase/client/models/validator_details.rb +1 -1
  96. data/lib/coinbase/client/models/validator_list.rb +1 -1
  97. data/lib/coinbase/client/models/validator_status.rb +1 -1
  98. data/lib/coinbase/client/models/wallet.rb +1 -1
  99. data/lib/coinbase/client/models/wallet_list.rb +1 -1
  100. data/lib/coinbase/client/models/webhook.rb +1 -1
  101. data/lib/coinbase/client/models/webhook_event_filter.rb +4 -4
  102. data/lib/coinbase/client/models/webhook_event_type.rb +1 -1
  103. data/lib/coinbase/client/models/webhook_list.rb +1 -1
  104. data/lib/coinbase/client/version.rb +1 -1
  105. data/lib/coinbase/client.rb +4 -3
  106. data/lib/coinbase/contract_invocation.rb +26 -1
  107. data/lib/coinbase/version.rb +1 -1
  108. metadata +5 -5
  109. data/lib/coinbase/client/api/users_api.rb +0 -79
  110. data/lib/coinbase/client/models/feature.rb +0 -43
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.7.0
9
+ Generator version: 7.8.0
10
10
 
11
11
  =end
12
12
 
@@ -27,13 +27,17 @@ module Coinbase::Client
27
27
  # The JSON-encoded ABI of the contract.
28
28
  attr_accessor :abi
29
29
 
30
+ # The amount in atomic units of the native asset to send to the contract for a payable method
31
+ attr_accessor :amount
32
+
30
33
  # Attribute mapping from ruby-style variable name to JSON key.
31
34
  def self.attribute_map
32
35
  {
33
36
  :'contract_address' => :'contract_address',
34
37
  :'method' => :'method',
35
38
  :'args' => :'args',
36
- :'abi' => :'abi'
39
+ :'abi' => :'abi',
40
+ :'amount' => :'amount'
37
41
  }
38
42
  end
39
43
 
@@ -48,7 +52,8 @@ module Coinbase::Client
48
52
  :'contract_address' => :'String',
49
53
  :'method' => :'String',
50
54
  :'args' => :'String',
51
- :'abi' => :'String'
55
+ :'abi' => :'String',
56
+ :'amount' => :'String'
52
57
  }
53
58
  end
54
59
 
@@ -94,6 +99,10 @@ module Coinbase::Client
94
99
  if attributes.key?(:'abi')
95
100
  self.abi = attributes[:'abi']
96
101
  end
102
+
103
+ if attributes.key?(:'amount')
104
+ self.amount = attributes[:'amount']
105
+ end
97
106
  end
98
107
 
99
108
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -134,7 +143,8 @@ module Coinbase::Client
134
143
  contract_address == o.contract_address &&
135
144
  method == o.method &&
136
145
  args == o.args &&
137
- abi == o.abi
146
+ abi == o.abi &&
147
+ amount == o.amount
138
148
  end
139
149
 
140
150
  # @see the `==` method
@@ -146,7 +156,7 @@ module Coinbase::Client
146
156
  # Calculates hash code according to all attributes.
147
157
  # @return [Integer] Hash code
148
158
  def hash
149
- [contract_address, method, args, abi].hash
159
+ [contract_address, method, args, abi, amount].hash
150
160
  end
151
161
 
152
162
  # Builds the object from hash
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.7.0
9
+ Generator version: 7.8.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.7.0
9
+ Generator version: 7.8.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.7.0
9
+ Generator version: 7.8.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.7.0
9
+ Generator version: 7.8.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.7.0
9
+ Generator version: 7.8.0
10
10
 
11
11
  =end
12
12
 
@@ -24,7 +24,7 @@ module Coinbase::Client
24
24
  # The ID of the asset to transfer
25
25
  attr_accessor :asset_id
26
26
 
27
- # The destination address
27
+ # The destination address, which can be a 0x address, Basename, or ENS name
28
28
  attr_accessor :destination
29
29
 
30
30
  # Whether the transfer uses sponsored gas
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.7.0
9
+ Generator version: 7.8.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.7.0
9
+ Generator version: 7.8.0
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 0.0.1-alpha
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.7.0
9
+ Generator version: 7.8.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,336 @@
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
+ # Represents an event triggered by an ERC-20 token transfer on the blockchain. Contains information about the transaction, block, and involved addresses.
18
+ class ERC20TransferEvent
19
+ # Unique identifier for the webhook that triggered this event.
20
+ attr_accessor :webhook_id
21
+
22
+ # Type of event, in this case, an ERC-20 token transfer.
23
+ attr_accessor :event_type
24
+
25
+ # Blockchain network where the event occurred.
26
+ attr_accessor :network
27
+
28
+ # Hash of the block containing the transaction.
29
+ attr_accessor :block_hash
30
+
31
+ # Number of the block containing the transaction.
32
+ attr_accessor :block_number
33
+
34
+ # Timestamp when the block was mined.
35
+ attr_accessor :block_time
36
+
37
+ # Hash of the transaction that triggered the event.
38
+ attr_accessor :transaction_hash
39
+
40
+ # Position of the transaction within the block.
41
+ attr_accessor :transaction_index
42
+
43
+ # Position of the event log within the transaction.
44
+ attr_accessor :log_index
45
+
46
+ # Address of the ERC-20 token contract.
47
+ attr_accessor :contract_address
48
+
49
+ # Address of the sender in the token transfer.
50
+ attr_accessor :from
51
+
52
+ # Address of the recipient in the token transfer.
53
+ attr_accessor :to
54
+
55
+ # Amount of tokens transferred, typically in the smallest unit (e.g., wei for Ethereum).
56
+ attr_accessor :value
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'webhook_id' => :'webhookId',
62
+ :'event_type' => :'eventType',
63
+ :'network' => :'network',
64
+ :'block_hash' => :'blockHash',
65
+ :'block_number' => :'blockNumber',
66
+ :'block_time' => :'blockTime',
67
+ :'transaction_hash' => :'transactionHash',
68
+ :'transaction_index' => :'transactionIndex',
69
+ :'log_index' => :'logIndex',
70
+ :'contract_address' => :'contractAddress',
71
+ :'from' => :'from',
72
+ :'to' => :'to',
73
+ :'value' => :'value'
74
+ }
75
+ end
76
+
77
+ # Returns all the JSON keys this model knows about
78
+ def self.acceptable_attributes
79
+ attribute_map.values
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'webhook_id' => :'String',
86
+ :'event_type' => :'String',
87
+ :'network' => :'String',
88
+ :'block_hash' => :'String',
89
+ :'block_number' => :'Integer',
90
+ :'block_time' => :'Time',
91
+ :'transaction_hash' => :'String',
92
+ :'transaction_index' => :'Integer',
93
+ :'log_index' => :'Integer',
94
+ :'contract_address' => :'String',
95
+ :'from' => :'String',
96
+ :'to' => :'String',
97
+ :'value' => :'String'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ ])
105
+ end
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ def initialize(attributes = {})
110
+ if (!attributes.is_a?(Hash))
111
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Coinbase::Client::ERC20TransferEvent` initialize method"
112
+ end
113
+
114
+ # check to see if the attribute exists and convert string to symbol for hash key
115
+ attributes = attributes.each_with_object({}) { |(k, v), h|
116
+ if (!self.class.attribute_map.key?(k.to_sym))
117
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Coinbase::Client::ERC20TransferEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
118
+ end
119
+ h[k.to_sym] = v
120
+ }
121
+
122
+ if attributes.key?(:'webhook_id')
123
+ self.webhook_id = attributes[:'webhook_id']
124
+ end
125
+
126
+ if attributes.key?(:'event_type')
127
+ self.event_type = attributes[:'event_type']
128
+ end
129
+
130
+ if attributes.key?(:'network')
131
+ self.network = attributes[:'network']
132
+ end
133
+
134
+ if attributes.key?(:'block_hash')
135
+ self.block_hash = attributes[:'block_hash']
136
+ end
137
+
138
+ if attributes.key?(:'block_number')
139
+ self.block_number = attributes[:'block_number']
140
+ end
141
+
142
+ if attributes.key?(:'block_time')
143
+ self.block_time = attributes[:'block_time']
144
+ end
145
+
146
+ if attributes.key?(:'transaction_hash')
147
+ self.transaction_hash = attributes[:'transaction_hash']
148
+ end
149
+
150
+ if attributes.key?(:'transaction_index')
151
+ self.transaction_index = attributes[:'transaction_index']
152
+ end
153
+
154
+ if attributes.key?(:'log_index')
155
+ self.log_index = attributes[:'log_index']
156
+ end
157
+
158
+ if attributes.key?(:'contract_address')
159
+ self.contract_address = attributes[:'contract_address']
160
+ end
161
+
162
+ if attributes.key?(:'from')
163
+ self.from = attributes[:'from']
164
+ end
165
+
166
+ if attributes.key?(:'to')
167
+ self.to = attributes[:'to']
168
+ end
169
+
170
+ if attributes.key?(:'value')
171
+ self.value = attributes[:'value']
172
+ end
173
+ end
174
+
175
+ # Show invalid properties with the reasons. Usually used together with valid?
176
+ # @return Array for valid properties with the reasons
177
+ def list_invalid_properties
178
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
179
+ invalid_properties = Array.new
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
+ true
188
+ end
189
+
190
+ # Checks equality by comparing each attribute.
191
+ # @param [Object] Object to be compared
192
+ def ==(o)
193
+ return true if self.equal?(o)
194
+ self.class == o.class &&
195
+ webhook_id == o.webhook_id &&
196
+ event_type == o.event_type &&
197
+ network == o.network &&
198
+ block_hash == o.block_hash &&
199
+ block_number == o.block_number &&
200
+ block_time == o.block_time &&
201
+ transaction_hash == o.transaction_hash &&
202
+ transaction_index == o.transaction_index &&
203
+ log_index == o.log_index &&
204
+ contract_address == o.contract_address &&
205
+ from == o.from &&
206
+ to == o.to &&
207
+ value == o.value
208
+ end
209
+
210
+ # @see the `==` method
211
+ # @param [Object] Object to be compared
212
+ def eql?(o)
213
+ self == o
214
+ end
215
+
216
+ # Calculates hash code according to all attributes.
217
+ # @return [Integer] Hash code
218
+ def hash
219
+ [webhook_id, event_type, network, block_hash, block_number, block_time, transaction_hash, transaction_index, log_index, contract_address, from, to, value].hash
220
+ end
221
+
222
+ # Builds the object from hash
223
+ # @param [Hash] attributes Model attributes in the form of hash
224
+ # @return [Object] Returns the model itself
225
+ def self.build_from_hash(attributes)
226
+ return nil unless attributes.is_a?(Hash)
227
+ attributes = attributes.transform_keys(&:to_sym)
228
+ transformed_hash = {}
229
+ openapi_types.each_pair do |key, type|
230
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
231
+ transformed_hash["#{key}"] = nil
232
+ elsif type =~ /\AArray<(.*)>/i
233
+ # check to ensure the input is an array given that the attribute
234
+ # is documented as an array but the input is not
235
+ if attributes[attribute_map[key]].is_a?(Array)
236
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
237
+ end
238
+ elsif !attributes[attribute_map[key]].nil?
239
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
240
+ end
241
+ end
242
+ new(transformed_hash)
243
+ end
244
+
245
+ # Deserializes the data based on type
246
+ # @param string type Data type
247
+ # @param string value Value to be deserialized
248
+ # @return [Object] Deserialized data
249
+ def self._deserialize(type, value)
250
+ case type.to_sym
251
+ when :Time
252
+ Time.parse(value)
253
+ when :Date
254
+ Date.parse(value)
255
+ when :String
256
+ value.to_s
257
+ when :Integer
258
+ value.to_i
259
+ when :Float
260
+ value.to_f
261
+ when :Boolean
262
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
263
+ true
264
+ else
265
+ false
266
+ end
267
+ when :Object
268
+ # generic object (usually a Hash), return directly
269
+ value
270
+ when /\AArray<(?<inner_type>.+)>\z/
271
+ inner_type = Regexp.last_match[:inner_type]
272
+ value.map { |v| _deserialize(inner_type, v) }
273
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
274
+ k_type = Regexp.last_match[:k_type]
275
+ v_type = Regexp.last_match[:v_type]
276
+ {}.tap do |hash|
277
+ value.each do |k, v|
278
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
279
+ end
280
+ end
281
+ else # model
282
+ # models (e.g. Pet) or oneOf
283
+ klass = Coinbase::Client.const_get(type)
284
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
285
+ end
286
+ end
287
+
288
+ # Returns the string representation of the object
289
+ # @return [String] String presentation of the object
290
+ def to_s
291
+ to_hash.to_s
292
+ end
293
+
294
+ # to_body is an alias to to_hash (backward compatibility)
295
+ # @return [Hash] Returns the object in the form of hash
296
+ def to_body
297
+ to_hash
298
+ end
299
+
300
+ # Returns the object in the form of hash
301
+ # @return [Hash] Returns the object in the form of hash
302
+ def to_hash
303
+ hash = {}
304
+ self.class.attribute_map.each_pair do |attr, param|
305
+ value = self.send(attr)
306
+ if value.nil?
307
+ is_nullable = self.class.openapi_nullable.include?(attr)
308
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
309
+ end
310
+
311
+ hash[param] = _to_hash(value)
312
+ end
313
+ hash
314
+ end
315
+
316
+ # Outputs non-array value in the form of hash
317
+ # For object, use to_hash. Otherwise, just return the value
318
+ # @param [Object] value Any valid value
319
+ # @return [Hash] Returns the value in the form of hash
320
+ def _to_hash(value)
321
+ if value.is_a?(Array)
322
+ value.compact.map { |v| _to_hash(v) }
323
+ elsif value.is_a?(Hash)
324
+ {}.tap do |hash|
325
+ value.each { |k, v| hash[k] = _to_hash(v) }
326
+ end
327
+ elsif value.respond_to? :to_hash
328
+ value.to_hash
329
+ else
330
+ value
331
+ end
332
+ end
333
+
334
+ end
335
+
336
+ end