cybrid_api_bank_ruby 0.0.35 → 0.1.2

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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +10 -5
  4. data/cybrid_api_bank_ruby.gemspec +2 -2
  5. data/docs/AssetBankModel.md +26 -0
  6. data/docs/AssetListBankModel.md +24 -0
  7. data/docs/AssetsBankApi.md +84 -0
  8. data/lib/cybrid_api_bank_ruby/api/accounts_bank_api.rb +2 -2
  9. data/lib/cybrid_api_bank_ruby/api/assets_bank_api.rb +97 -0
  10. data/lib/cybrid_api_bank_ruby/api/banks_bank_api.rb +2 -2
  11. data/lib/cybrid_api_bank_ruby/api/customers_bank_api.rb +2 -2
  12. data/lib/cybrid_api_bank_ruby/api/identity_records_bank_api.rb +2 -2
  13. data/lib/cybrid_api_bank_ruby/api/prices_bank_api.rb +2 -2
  14. data/lib/cybrid_api_bank_ruby/api/quotes_bank_api.rb +2 -2
  15. data/lib/cybrid_api_bank_ruby/api/symbols_bank_api.rb +2 -2
  16. data/lib/cybrid_api_bank_ruby/api/trades_bank_api.rb +2 -2
  17. data/lib/cybrid_api_bank_ruby/api/verification_keys_bank_api.rb +2 -2
  18. data/lib/cybrid_api_bank_ruby/api_client.rb +2 -2
  19. data/lib/cybrid_api_bank_ruby/api_error.rb +2 -2
  20. data/lib/cybrid_api_bank_ruby/configuration.rb +2 -2
  21. data/lib/cybrid_api_bank_ruby/models/account_bank_model.rb +2 -2
  22. data/lib/cybrid_api_bank_ruby/models/account_list_bank_model.rb +2 -2
  23. data/lib/cybrid_api_bank_ruby/models/asset_bank_model.rb +421 -0
  24. data/lib/cybrid_api_bank_ruby/models/asset_list_bank_model.rb +328 -0
  25. data/lib/cybrid_api_bank_ruby/models/attestation_details_bank_model.rb +2 -2
  26. data/lib/cybrid_api_bank_ruby/models/bank_bank_model.rb +2 -2
  27. data/lib/cybrid_api_bank_ruby/models/bank_list_bank_model.rb +2 -2
  28. data/lib/cybrid_api_bank_ruby/models/customer_bank_model.rb +2 -2
  29. data/lib/cybrid_api_bank_ruby/models/customer_list_bank_model.rb +2 -2
  30. data/lib/cybrid_api_bank_ruby/models/exchange_account_bank_model.rb +2 -2
  31. data/lib/cybrid_api_bank_ruby/models/exchange_bank_model.rb +2 -2
  32. data/lib/cybrid_api_bank_ruby/models/identity_record_bank_model.rb +2 -2
  33. data/lib/cybrid_api_bank_ruby/models/post_account_bank_model.rb +2 -2
  34. data/lib/cybrid_api_bank_ruby/models/post_bank_bank_model.rb +2 -2
  35. data/lib/cybrid_api_bank_ruby/models/post_customer_bank_model.rb +2 -2
  36. data/lib/cybrid_api_bank_ruby/models/post_identity_record_attestation_details_bank_model.rb +2 -2
  37. data/lib/cybrid_api_bank_ruby/models/post_identity_record_bank_model.rb +2 -2
  38. data/lib/cybrid_api_bank_ruby/models/post_quote_bank_model.rb +2 -2
  39. data/lib/cybrid_api_bank_ruby/models/post_trade_bank_model.rb +2 -2
  40. data/lib/cybrid_api_bank_ruby/models/post_verification_key_bank_model.rb +2 -2
  41. data/lib/cybrid_api_bank_ruby/models/quote_bank_model.rb +2 -2
  42. data/lib/cybrid_api_bank_ruby/models/quote_list_bank_model.rb +2 -2
  43. data/lib/cybrid_api_bank_ruby/models/symbol_price_bank_model.rb +2 -2
  44. data/lib/cybrid_api_bank_ruby/models/system_account_bank_model.rb +2 -2
  45. data/lib/cybrid_api_bank_ruby/models/trade_bank_model.rb +2 -2
  46. data/lib/cybrid_api_bank_ruby/models/trade_list_bank_model.rb +2 -2
  47. data/lib/cybrid_api_bank_ruby/models/verification_key_bank_model.rb +2 -2
  48. data/lib/cybrid_api_bank_ruby/version.rb +3 -3
  49. data/lib/cybrid_api_bank_ruby.rb +5 -2
  50. data/spec/api/accounts_bank_api_spec.rb +2 -2
  51. data/spec/api/assets_bank_api_spec.rb +48 -0
  52. data/spec/api/banks_bank_api_spec.rb +2 -2
  53. data/spec/api/customers_bank_api_spec.rb +2 -2
  54. data/spec/api/identity_records_bank_api_spec.rb +2 -2
  55. data/spec/api/prices_bank_api_spec.rb +2 -2
  56. data/spec/api/quotes_bank_api_spec.rb +2 -2
  57. data/spec/api/symbols_bank_api_spec.rb +2 -2
  58. data/spec/api/trades_bank_api_spec.rb +2 -2
  59. data/spec/api/verification_keys_bank_api_spec.rb +2 -2
  60. data/spec/api_client_spec.rb +2 -2
  61. data/spec/configuration_spec.rb +2 -2
  62. data/spec/models/account_bank_model_spec.rb +2 -2
  63. data/spec/models/account_list_bank_model_spec.rb +2 -2
  64. data/spec/models/asset_bank_model_spec.rb +62 -0
  65. data/spec/models/asset_list_bank_model_spec.rb +52 -0
  66. data/spec/models/attestation_details_bank_model_spec.rb +2 -2
  67. data/spec/models/bank_bank_model_spec.rb +2 -2
  68. data/spec/models/bank_list_bank_model_spec.rb +2 -2
  69. data/spec/models/customer_bank_model_spec.rb +2 -2
  70. data/spec/models/customer_list_bank_model_spec.rb +2 -2
  71. data/spec/models/exchange_account_bank_model_spec.rb +2 -2
  72. data/spec/models/exchange_bank_model_spec.rb +2 -2
  73. data/spec/models/identity_record_bank_model_spec.rb +2 -2
  74. data/spec/models/post_account_bank_model_spec.rb +2 -2
  75. data/spec/models/post_bank_bank_model_spec.rb +2 -2
  76. data/spec/models/post_customer_bank_model_spec.rb +2 -2
  77. data/spec/models/post_identity_record_attestation_details_bank_model_spec.rb +2 -2
  78. data/spec/models/post_identity_record_bank_model_spec.rb +2 -2
  79. data/spec/models/post_quote_bank_model_spec.rb +2 -2
  80. data/spec/models/post_trade_bank_model_spec.rb +2 -2
  81. data/spec/models/post_verification_key_bank_model_spec.rb +2 -2
  82. data/spec/models/quote_bank_model_spec.rb +2 -2
  83. data/spec/models/quote_list_bank_model_spec.rb +2 -2
  84. data/spec/models/symbol_price_bank_model_spec.rb +2 -2
  85. data/spec/models/system_account_bank_model_spec.rb +2 -2
  86. data/spec/models/trade_bank_model_spec.rb +2 -2
  87. data/spec/models/trade_list_bank_model_spec.rb +2 -2
  88. data/spec/models/verification_key_bank_model_spec.rb +2 -2
  89. data/spec/spec_helper.rb +2 -2
  90. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/byebug-11.1.3/gem_make.out +2 -2
  91. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/ffi-1.15.5/gem_make.out +2 -2
  92. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/jaro_winkler-1.5.4/gem_make.out +2 -2
  93. data/vendor/bundle/ruby/3.1.0/gems/byebug-11.1.3/ext/byebug/Makefile +2 -2
  94. data/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/ext/ffi_c/Makefile +2 -2
  95. data/vendor/bundle/ruby/3.1.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler/Makefile +2 -2
  96. metadata +13 -1
@@ -0,0 +1,421 @@
1
+ =begin
2
+ #Cybrid Bank API
3
+
4
+ ## Welcome Welcome to the Cybrid platform; enabling turnkey crypto banking services! In these documents, you will find information on the operations provided by our platform, as well as details on how our REST API operates more generally. Our complete set of APIs allows you to manage all your resources: your Organization, your banks and your identities. The complete set of APIs can be found on the following pages: | API | Description | |----------------------------------------------------------------|------------------------------| | [Organization API](https://organization.demo.cybrid.app/api/schema/swagger-ui) | APIs to manage organizations | | [Bank API](https://bank.demo.cybrid.app/api/schema/swagger-ui) | APIs to manage banks | | [Identities API](https://id.demo.cybrid.app/api/schema/swagger-ui) | APIs to manage identities | When you're ready, [request access](https://www.cybrid.xyz/access) to your Dashboard to view and administer your Organization. Once you've logged in, you can begin creating Banks, either for sandbox or production usage, and start enabling your customers to leverage DeFi and web3 with confidence. If you have any questions, please contact [Support](mailto:support@cybrid.app) at any time so that we can help. ## Authentication The Cybrid Platform uses OAuth 2.0 Bearer Tokens to authenticate requests to the platform. Credentials to create Organization and Bank tokens can be generated via your Dashboard ([request access](https://www.cybrid.xyz/access)). An Organization Token applies broadly to the whole Organization and all of its Banks, whereas, a Bank Token is specific to an individual Bank. Both Organization and Bank tokens can be created using the OAuth Client Credential Grant flow. Each Organization and Bank has its own unique Client ID and Secret that allows for machine-to-machine authentication. **Never share your Client ID or Secret publicly or in your source code repository** Your Client ID and Secret can be exchanged for a time-limited Bearer Token by interacting with the Cybrid Identity Provider or through interacting with the **Authorize** button in this document: ``` curl -X POST https://id.demo.cybrid.app/oauth/token -d '{ \"grant_type\": \"client_credentials\", \"client_id\": \"<Your Client ID>\", \"client_secret\": \"<Your Secret>\", \"scope\": \"<Your requested scopes -- space separated>\" }' -H \"Content-Type: application/json\" ``` ## Scopes The Cybrid platform supports the use of scopes to control the level of access a token is limited to. Scopes do not grant access to resources; instead, they provide limits, in support of the least privilege principal. The following scopes are available on the platform and can be requested when generating either an Organization or a Bank token. Generally speaking, the _Read_ scope is required to read and list resources, the _Write_ scope is required to update a resource and the _Execute_ scope is required to create a resource. | Resource | Read scope | Write scope | Execute scope | Token Type | |---------------|--------------------|----------------------|-------------------|--------------------| | Organizations | organizations:read | organizations:write | | Organization/ Bank | | Banks | banks:read | banks:write | banks:execute | Organization/ Bank | | Customers | customers:read | customers:write | customers:execute | Bank | | Assets | prices:read | | | Bank | | Accounts | accounts:read | | accounts:execute | Bank | | Prices | prices:read | | | Bank | | Symbols | prices:read | | | Bank | | Quotes | quotes:read | | quotes:execute | Bank | | Trades | trades:read | | trades:execute | Bank | ## Organizations An Organization is meant to model the organization partnering with Cybrid to use our platform. An Organization does not directly interact with customers. Instead, an Organization has one or more banks, which encompass the financial service offerings of the platform. ## Banks A Bank is owned by an Organization and can be thought of as an environment or container for Customers and product offerings. An example of a Bank would be your customer facing banking website, or an internal staging environment for testing and integration. An Organization can have multiple banks, in sandbox or production environments. A sandbox Bank will be backed by stubbed data and process flows. For instance, identity record and funding source processes will be simulated rather than performed. ## Customers Customers represent your banking users on the platform. At present, we offer support for Individuals as Customers. Customers must be verified in our system before they can play any part on the platform. See the Identity Records section for more details on how a customer can be verified. Customers must also have an account to be able to transact. See the Accounts APIs for more details on setting up accounts for the customer.
5
+
6
+ The version of the OpenAPI document: v0.1.2
7
+ Contact: support@cybrid.app
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module CybridApiBank
17
+ class AssetBankModel
18
+ # The asset type.
19
+ attr_accessor :type
20
+
21
+ # The unique code for the asset.
22
+ attr_accessor :code
23
+
24
+ # The name of the asset.
25
+ attr_accessor :name
26
+
27
+ # The currency symbol for the asset.
28
+ attr_accessor :symbol
29
+
30
+ # The number of decimals for the default unit of the asset.
31
+ attr_accessor :decimals
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'type' => :'type',
59
+ :'code' => :'code',
60
+ :'name' => :'name',
61
+ :'symbol' => :'symbol',
62
+ :'decimals' => :'decimals'
63
+ }
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'type' => :'String',
75
+ :'code' => :'String',
76
+ :'name' => :'String',
77
+ :'symbol' => :'String',
78
+ :'decimals' => :'Integer'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CybridApiBank::AssetBankModel` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!self.class.attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CybridApiBank::AssetBankModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'type')
104
+ self.type = attributes[:'type']
105
+ end
106
+
107
+ if attributes.key?(:'code')
108
+ self.code = attributes[:'code']
109
+ end
110
+
111
+ if attributes.key?(:'name')
112
+ self.name = attributes[:'name']
113
+ end
114
+
115
+ if attributes.key?(:'symbol')
116
+ self.symbol = attributes[:'symbol']
117
+ end
118
+
119
+ if attributes.key?(:'decimals')
120
+ self.decimals = attributes[:'decimals']
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ invalid_properties = Array.new
128
+ if @type.nil?
129
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
130
+ end
131
+
132
+ if @code.nil?
133
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
134
+ end
135
+
136
+ if @code.to_s.length > 8
137
+ invalid_properties.push('invalid value for "code", the character length must be smaller than or equal to 8.')
138
+ end
139
+
140
+ if @code.to_s.length < 1
141
+ invalid_properties.push('invalid value for "code", the character length must be great than or equal to 1.')
142
+ end
143
+
144
+ if @name.nil?
145
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
146
+ end
147
+
148
+ if @name.to_s.length > 128
149
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 128.')
150
+ end
151
+
152
+ if @name.to_s.length < 1
153
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
154
+ end
155
+
156
+ if @symbol.nil?
157
+ invalid_properties.push('invalid value for "symbol", symbol cannot be nil.')
158
+ end
159
+
160
+ if @symbol.to_s.length > 8
161
+ invalid_properties.push('invalid value for "symbol", the character length must be smaller than or equal to 8.')
162
+ end
163
+
164
+ if @symbol.to_s.length < 1
165
+ invalid_properties.push('invalid value for "symbol", the character length must be great than or equal to 1.')
166
+ end
167
+
168
+ if @decimals.nil?
169
+ invalid_properties.push('invalid value for "decimals", decimals cannot be nil.')
170
+ end
171
+
172
+ if @decimals < 0
173
+ invalid_properties.push('invalid value for "decimals", must be greater than or equal to 0.')
174
+ end
175
+
176
+ invalid_properties
177
+ end
178
+
179
+ # Check to see if the all the properties in the model are valid
180
+ # @return true if the model is valid
181
+ def valid?
182
+ return false if @type.nil?
183
+ type_validator = EnumAttributeValidator.new('String', ["fiat", "crypto"])
184
+ return false unless type_validator.valid?(@type)
185
+ return false if @code.nil?
186
+ return false if @code.to_s.length > 8
187
+ return false if @code.to_s.length < 1
188
+ return false if @name.nil?
189
+ return false if @name.to_s.length > 128
190
+ return false if @name.to_s.length < 1
191
+ return false if @symbol.nil?
192
+ return false if @symbol.to_s.length > 8
193
+ return false if @symbol.to_s.length < 1
194
+ return false if @decimals.nil?
195
+ return false if @decimals < 0
196
+ true
197
+ end
198
+
199
+ # Custom attribute writer method checking allowed values (enum).
200
+ # @param [Object] type Object to be assigned
201
+ def type=(type)
202
+ validator = EnumAttributeValidator.new('String', ["fiat", "crypto"])
203
+ unless validator.valid?(type)
204
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
205
+ end
206
+ @type = type
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] code Value to be assigned
211
+ def code=(code)
212
+ if code.nil?
213
+ fail ArgumentError, 'code cannot be nil'
214
+ end
215
+
216
+ if code.to_s.length > 8
217
+ fail ArgumentError, 'invalid value for "code", the character length must be smaller than or equal to 8.'
218
+ end
219
+
220
+ if code.to_s.length < 1
221
+ fail ArgumentError, 'invalid value for "code", the character length must be great than or equal to 1.'
222
+ end
223
+
224
+ @code = code
225
+ end
226
+
227
+ # Custom attribute writer method with validation
228
+ # @param [Object] name Value to be assigned
229
+ def name=(name)
230
+ if name.nil?
231
+ fail ArgumentError, 'name cannot be nil'
232
+ end
233
+
234
+ if name.to_s.length > 128
235
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 128.'
236
+ end
237
+
238
+ if name.to_s.length < 1
239
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
240
+ end
241
+
242
+ @name = name
243
+ end
244
+
245
+ # Custom attribute writer method with validation
246
+ # @param [Object] symbol Value to be assigned
247
+ def symbol=(symbol)
248
+ if symbol.nil?
249
+ fail ArgumentError, 'symbol cannot be nil'
250
+ end
251
+
252
+ if symbol.to_s.length > 8
253
+ fail ArgumentError, 'invalid value for "symbol", the character length must be smaller than or equal to 8.'
254
+ end
255
+
256
+ if symbol.to_s.length < 1
257
+ fail ArgumentError, 'invalid value for "symbol", the character length must be great than or equal to 1.'
258
+ end
259
+
260
+ @symbol = symbol
261
+ end
262
+
263
+ # Custom attribute writer method with validation
264
+ # @param [Object] decimals Value to be assigned
265
+ def decimals=(decimals)
266
+ if decimals.nil?
267
+ fail ArgumentError, 'decimals cannot be nil'
268
+ end
269
+
270
+ if decimals < 0
271
+ fail ArgumentError, 'invalid value for "decimals", must be greater than or equal to 0.'
272
+ end
273
+
274
+ @decimals = decimals
275
+ end
276
+
277
+ # Checks equality by comparing each attribute.
278
+ # @param [Object] Object to be compared
279
+ def ==(o)
280
+ return true if self.equal?(o)
281
+ self.class == o.class &&
282
+ type == o.type &&
283
+ code == o.code &&
284
+ name == o.name &&
285
+ symbol == o.symbol &&
286
+ decimals == o.decimals
287
+ end
288
+
289
+ # @see the `==` method
290
+ # @param [Object] Object to be compared
291
+ def eql?(o)
292
+ self == o
293
+ end
294
+
295
+ # Calculates hash code according to all attributes.
296
+ # @return [Integer] Hash code
297
+ def hash
298
+ [type, code, name, symbol, decimals].hash
299
+ end
300
+
301
+ # Builds the object from hash
302
+ # @param [Hash] attributes Model attributes in the form of hash
303
+ # @return [Object] Returns the model itself
304
+ def self.build_from_hash(attributes)
305
+ new.build_from_hash(attributes)
306
+ end
307
+
308
+ # Builds the object from hash
309
+ # @param [Hash] attributes Model attributes in the form of hash
310
+ # @return [Object] Returns the model itself
311
+ def build_from_hash(attributes)
312
+ return nil unless attributes.is_a?(Hash)
313
+ self.class.openapi_types.each_pair do |key, type|
314
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
315
+ self.send("#{key}=", nil)
316
+ elsif type =~ /\AArray<(.*)>/i
317
+ # check to ensure the input is an array given that the attribute
318
+ # is documented as an array but the input is not
319
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
320
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
321
+ end
322
+ elsif !attributes[self.class.attribute_map[key]].nil?
323
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
324
+ end
325
+ end
326
+
327
+ self
328
+ end
329
+
330
+ # Deserializes the data based on type
331
+ # @param string type Data type
332
+ # @param string value Value to be deserialized
333
+ # @return [Object] Deserialized data
334
+ def _deserialize(type, value)
335
+ case type.to_sym
336
+ when :Time
337
+ Time.parse(value)
338
+ when :Date
339
+ Date.parse(value)
340
+ when :String
341
+ value.to_s
342
+ when :Integer
343
+ value.to_i
344
+ when :Float
345
+ value.to_f
346
+ when :Boolean
347
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
348
+ true
349
+ else
350
+ false
351
+ end
352
+ when :Object
353
+ # generic object (usually a Hash), return directly
354
+ value
355
+ when /\AArray<(?<inner_type>.+)>\z/
356
+ inner_type = Regexp.last_match[:inner_type]
357
+ value.map { |v| _deserialize(inner_type, v) }
358
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
359
+ k_type = Regexp.last_match[:k_type]
360
+ v_type = Regexp.last_match[:v_type]
361
+ {}.tap do |hash|
362
+ value.each do |k, v|
363
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
364
+ end
365
+ end
366
+ else # model
367
+ # models (e.g. Pet) or oneOf
368
+ klass = CybridApiBank.const_get(type)
369
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
370
+ end
371
+ end
372
+
373
+ # Returns the string representation of the object
374
+ # @return [String] String presentation of the object
375
+ def to_s
376
+ to_hash.to_s
377
+ end
378
+
379
+ # to_body is an alias to to_hash (backward compatibility)
380
+ # @return [Hash] Returns the object in the form of hash
381
+ def to_body
382
+ to_hash
383
+ end
384
+
385
+ # Returns the object in the form of hash
386
+ # @return [Hash] Returns the object in the form of hash
387
+ def to_hash
388
+ hash = {}
389
+ self.class.attribute_map.each_pair do |attr, param|
390
+ value = self.send(attr)
391
+ if value.nil?
392
+ is_nullable = self.class.openapi_nullable.include?(attr)
393
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
394
+ end
395
+
396
+ hash[param] = _to_hash(value)
397
+ end
398
+ hash
399
+ end
400
+
401
+ # Outputs non-array value in the form of hash
402
+ # For object, use to_hash. Otherwise, just return the value
403
+ # @param [Object] value Any valid value
404
+ # @return [Hash] Returns the value in the form of hash
405
+ def _to_hash(value)
406
+ if value.is_a?(Array)
407
+ value.compact.map { |v| _to_hash(v) }
408
+ elsif value.is_a?(Hash)
409
+ {}.tap do |hash|
410
+ value.each { |k, v| hash[k] = _to_hash(v) }
411
+ end
412
+ elsif value.respond_to? :to_hash
413
+ value.to_hash
414
+ else
415
+ value
416
+ end
417
+ end
418
+
419
+ end
420
+
421
+ end