ynab 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/DEVELOPMENT.md +6 -2
  3. data/Gemfile.lock +1 -1
  4. data/README.md +4 -2
  5. data/docs/BulkTransactions.md +1 -1
  6. data/docs/CategoriesApi.md +22 -0
  7. data/docs/ExistingTransaction.md +18 -0
  8. data/docs/HybridTransaction.md +3 -2
  9. data/docs/NewTransaction.md +19 -0
  10. data/docs/PatchCategoryWrapper.md +8 -0
  11. data/docs/PatchPayeeWrapper.md +8 -0
  12. data/docs/PatchTransactionsWrapper.md +1 -1
  13. data/docs/PayeesApi.md +22 -0
  14. data/docs/PostTransactionsWrapper.md +2 -2
  15. data/docs/PutTransactionWrapper.md +1 -1
  16. data/docs/SaveCategory.md +10 -0
  17. data/docs/SavePayee.md +8 -0
  18. data/docs/SavePayeeResponse.md +8 -0
  19. data/docs/SavePayeeResponseData.md +9 -0
  20. data/docs/SaveTransactionWithIdOrImportId.md +20 -0
  21. data/docs/SaveTransactionWithOptionalFields.md +2 -3
  22. data/docs/ScheduledTransactionDetail.md +2 -1
  23. data/docs/ScheduledTransactionSummary.md +2 -1
  24. data/docs/TransactionClearedStatus.md +7 -0
  25. data/docs/TransactionDetail.md +3 -2
  26. data/docs/TransactionFlagColor.md +7 -0
  27. data/docs/TransactionSummary.md +3 -2
  28. data/docs/TransactionsApi.md +7 -7
  29. data/lib/ynab/api/accounts_api.rb +2 -2
  30. data/lib/ynab/api/budgets_api.rb +2 -2
  31. data/lib/ynab/api/categories_api.rb +82 -2
  32. data/lib/ynab/api/months_api.rb +2 -2
  33. data/lib/ynab/api/payee_locations_api.rb +2 -2
  34. data/lib/ynab/api/payees_api.rb +82 -2
  35. data/lib/ynab/api/scheduled_transactions_api.rb +2 -2
  36. data/lib/ynab/api/transactions_api.rb +12 -28
  37. data/lib/ynab/api/user_api.rb +2 -2
  38. data/lib/ynab/api_client.rb +2 -2
  39. data/lib/ynab/configuration.rb +14 -11
  40. data/lib/ynab/models/account.rb +13 -56
  41. data/lib/ynab/models/account_response.rb +13 -24
  42. data/lib/ynab/models/account_response_data.rb +13 -24
  43. data/lib/ynab/models/account_type.rb +2 -2
  44. data/lib/ynab/models/accounts_response.rb +13 -24
  45. data/lib/ynab/models/accounts_response_data.rb +13 -28
  46. data/lib/ynab/models/budget_detail.rb +13 -29
  47. data/lib/ynab/models/budget_detail_response.rb +13 -24
  48. data/lib/ynab/models/budget_detail_response_data.rb +13 -28
  49. data/lib/ynab/models/budget_settings.rb +13 -20
  50. data/lib/ynab/models/budget_settings_response.rb +13 -24
  51. data/lib/ynab/models/budget_settings_response_data.rb +13 -24
  52. data/lib/ynab/models/budget_summary.rb +13 -28
  53. data/lib/ynab/models/budget_summary_response.rb +13 -24
  54. data/lib/ynab/models/budget_summary_response_data.rb +13 -24
  55. data/lib/ynab/models/bulk_response.rb +13 -24
  56. data/lib/ynab/models/bulk_response_data.rb +13 -24
  57. data/lib/ynab/models/bulk_response_data_bulk.rb +13 -28
  58. data/lib/ynab/models/bulk_transactions.rb +14 -25
  59. data/lib/ynab/models/categories_response.rb +13 -24
  60. data/lib/ynab/models/categories_response_data.rb +13 -28
  61. data/lib/ynab/models/category.rb +13 -56
  62. data/lib/ynab/models/category_group.rb +13 -36
  63. data/lib/ynab/models/category_group_with_categories.rb +14 -42
  64. data/lib/ynab/models/category_group_with_categories_all_of.rb +0 -4
  65. data/lib/ynab/models/category_response.rb +13 -24
  66. data/lib/ynab/models/category_response_data.rb +13 -24
  67. data/lib/ynab/models/currency_format.rb +13 -52
  68. data/lib/ynab/models/date_format.rb +13 -24
  69. data/lib/ynab/models/error_detail.rb +13 -32
  70. data/lib/ynab/models/error_response.rb +13 -24
  71. data/lib/ynab/models/existing_transaction.rb +359 -0
  72. data/lib/ynab/models/hybrid_transaction.rb +28 -95
  73. data/lib/ynab/models/hybrid_transaction_all_of.rb +0 -12
  74. data/lib/ynab/models/hybrid_transactions_response.rb +13 -24
  75. data/lib/ynab/models/hybrid_transactions_response_data.rb +13 -24
  76. data/lib/ynab/models/month_detail.rb +13 -49
  77. data/lib/ynab/models/month_detail_all_of.rb +0 -4
  78. data/lib/ynab/models/month_detail_response.rb +13 -24
  79. data/lib/ynab/models/month_detail_response_data.rb +13 -24
  80. data/lib/ynab/models/month_summaries_response.rb +13 -24
  81. data/lib/ynab/models/month_summaries_response_data.rb +13 -28
  82. data/lib/ynab/models/month_summary.rb +13 -44
  83. data/lib/ynab/models/new_transaction.rb +377 -0
  84. data/lib/ynab/models/patch_category_wrapper.rb +213 -0
  85. data/lib/ynab/models/patch_month_category_wrapper.rb +13 -24
  86. data/lib/ynab/models/patch_payee_wrapper.rb +213 -0
  87. data/lib/ynab/models/patch_transactions_wrapper.rb +14 -25
  88. data/lib/ynab/models/payee.rb +13 -32
  89. data/lib/ynab/models/payee_location.rb +13 -40
  90. data/lib/ynab/models/payee_location_response.rb +13 -24
  91. data/lib/ynab/models/payee_location_response_data.rb +13 -24
  92. data/lib/ynab/models/payee_locations_response.rb +13 -24
  93. data/lib/ynab/models/payee_locations_response_data.rb +13 -24
  94. data/lib/ynab/models/payee_response.rb +13 -24
  95. data/lib/ynab/models/payee_response_data.rb +13 -24
  96. data/lib/ynab/models/payees_response.rb +13 -24
  97. data/lib/ynab/models/payees_response_data.rb +13 -28
  98. data/lib/ynab/models/post_account_wrapper.rb +13 -24
  99. data/lib/ynab/models/post_transactions_wrapper.rb +15 -22
  100. data/lib/ynab/models/put_transaction_wrapper.rb +14 -25
  101. data/lib/ynab/models/save_account.rb +13 -32
  102. data/lib/ynab/models/save_category.rb +232 -0
  103. data/lib/ynab/models/save_category_response.rb +13 -24
  104. data/lib/ynab/models/save_category_response_data.rb +13 -28
  105. data/lib/ynab/models/save_month_category.rb +13 -24
  106. data/lib/ynab/models/save_payee.rb +220 -0
  107. data/lib/ynab/models/save_payee_response.rb +213 -0
  108. data/lib/ynab/models/save_payee_response_data.rb +224 -0
  109. data/lib/ynab/models/save_sub_transaction.rb +13 -40
  110. data/lib/ynab/models/save_transaction.rb +0 -32
  111. data/lib/ynab/models/save_transaction_with_id.rb +0 -32
  112. data/lib/ynab/models/save_transaction_with_id_or_import_id.rb +388 -0
  113. data/lib/ynab/models/save_transaction_with_optional_fields.rb +17 -91
  114. data/lib/ynab/models/save_transactions_response.rb +13 -24
  115. data/lib/ynab/models/save_transactions_response_data.rb +13 -28
  116. data/lib/ynab/models/scheduled_sub_transaction.rb +13 -36
  117. data/lib/ynab/models/scheduled_transaction_detail.rb +26 -76
  118. data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +0 -8
  119. data/lib/ynab/models/scheduled_transaction_response.rb +13 -24
  120. data/lib/ynab/models/scheduled_transaction_response_data.rb +13 -24
  121. data/lib/ynab/models/scheduled_transaction_summary.rb +26 -67
  122. data/lib/ynab/models/scheduled_transactions_response.rb +13 -24
  123. data/lib/ynab/models/scheduled_transactions_response_data.rb +13 -28
  124. data/lib/ynab/models/sub_transaction.rb +13 -36
  125. data/lib/ynab/models/transaction_cleared_status.rb +41 -0
  126. data/lib/ynab/models/transaction_detail.rb +28 -91
  127. data/lib/ynab/models/transaction_detail_all_of.rb +0 -8
  128. data/lib/ynab/models/transaction_flag_color.rb +45 -0
  129. data/lib/ynab/models/transaction_response.rb +13 -24
  130. data/lib/ynab/models/transaction_response_data.rb +13 -24
  131. data/lib/ynab/models/transaction_summary.rb +28 -82
  132. data/lib/ynab/models/transactions_import_response.rb +13 -24
  133. data/lib/ynab/models/transactions_import_response_data.rb +13 -24
  134. data/lib/ynab/models/transactions_response.rb +13 -24
  135. data/lib/ynab/models/transactions_response_data.rb +13 -28
  136. data/lib/ynab/models/user.rb +13 -24
  137. data/lib/ynab/models/user_response.rb +13 -24
  138. data/lib/ynab/models/user_response_data.rb +13 -24
  139. data/lib/ynab/version.rb +1 -1
  140. data/lib/ynab.rb +13 -12
  141. data/open_api_spec.yaml +455 -343
  142. data/templates/api.mustache +213 -0
  143. data/templates/partial_model_generic.mustache +305 -0
  144. data/ynab.gemspec +4 -3
  145. metadata +31 -7
@@ -3,10 +3,10 @@
3
3
 
4
4
  #Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
5
5
 
6
- The version of the OpenAPI document: 1.0.0
6
+ The version of the OpenAPI document: 1.69.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -25,15 +25,16 @@ module YNAB
25
25
 
26
26
  attr_accessor :memo
27
27
 
28
- # The cleared status of the transaction
29
28
  attr_accessor :cleared
30
29
 
31
30
  # Whether or not the transaction is approved
32
31
  attr_accessor :approved
33
32
 
34
- # The transaction flag
35
33
  attr_accessor :flag_color
36
34
 
35
+ # The customized name of a transaction flag
36
+ attr_accessor :flag_name
37
+
37
38
  attr_accessor :account_id
38
39
 
39
40
  attr_accessor :payee_id
@@ -106,6 +107,7 @@ module YNAB
106
107
  :'cleared' => :'cleared',
107
108
  :'approved' => :'approved',
108
109
  :'flag_color' => :'flag_color',
110
+ :'flag_name' => :'flag_name',
109
111
  :'account_id' => :'account_id',
110
112
  :'payee_id' => :'payee_id',
111
113
  :'category_id' => :'category_id',
@@ -136,9 +138,10 @@ module YNAB
136
138
  :'date' => :'Date',
137
139
  :'amount' => :'Integer',
138
140
  :'memo' => :'String',
139
- :'cleared' => :'String',
141
+ :'cleared' => :'TransactionClearedStatus',
140
142
  :'approved' => :'Boolean',
141
- :'flag_color' => :'String',
143
+ :'flag_color' => :'TransactionFlagColor',
144
+ :'flag_name' => :'String',
142
145
  :'account_id' => :'String',
143
146
  :'payee_id' => :'String',
144
147
  :'category_id' => :'String',
@@ -162,6 +165,7 @@ module YNAB
162
165
  Set.new([
163
166
  :'memo',
164
167
  :'flag_color',
168
+ :'flag_name',
165
169
  :'payee_id',
166
170
  :'category_id',
167
171
  :'transfer_account_id',
@@ -179,7 +183,6 @@ module YNAB
179
183
  # List of class defined in allOf (OpenAPI v3)
180
184
  def self.openapi_all_of
181
185
  [
182
- :'TransactionDetailAllOf',
183
186
  :'TransactionSummary'
184
187
  ]
185
188
  end
@@ -227,6 +230,10 @@ module YNAB
227
230
  self.flag_color = attributes[:'flag_color']
228
231
  end
229
232
 
233
+ if attributes.key?(:'flag_name')
234
+ self.flag_name = attributes[:'flag_name']
235
+ end
236
+
230
237
  if attributes.key?(:'account_id')
231
238
  self.account_id = attributes[:'account_id']
232
239
  end
@@ -294,42 +301,6 @@ module YNAB
294
301
  # @return Array for valid properties with the reasons
295
302
  def list_invalid_properties
296
303
  invalid_properties = Array.new
297
- if @id.nil?
298
- invalid_properties.push('invalid value for "id", id cannot be nil.')
299
- end
300
-
301
- if @date.nil?
302
- invalid_properties.push('invalid value for "date", date cannot be nil.')
303
- end
304
-
305
- if @amount.nil?
306
- invalid_properties.push('invalid value for "amount", amount cannot be nil.')
307
- end
308
-
309
- if @cleared.nil?
310
- invalid_properties.push('invalid value for "cleared", cleared cannot be nil.')
311
- end
312
-
313
- if @approved.nil?
314
- invalid_properties.push('invalid value for "approved", approved cannot be nil.')
315
- end
316
-
317
- if @account_id.nil?
318
- invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
319
- end
320
-
321
- if @deleted.nil?
322
- invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
323
- end
324
-
325
- if @account_name.nil?
326
- invalid_properties.push('invalid value for "account_name", account_name cannot be nil.')
327
- end
328
-
329
- if @subtransactions.nil?
330
- invalid_properties.push('invalid value for "subtransactions", subtransactions cannot be nil.')
331
- end
332
-
333
304
  invalid_properties
334
305
  end
335
306
 
@@ -340,13 +311,9 @@ module YNAB
340
311
  return false if @date.nil?
341
312
  return false if @amount.nil?
342
313
  return false if @cleared.nil?
343
- cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
344
- return false unless cleared_validator.valid?(@cleared)
345
314
  return false if @approved.nil?
346
- flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
347
- return false unless flag_color_validator.valid?(@flag_color)
348
315
  return false if @account_id.nil?
349
- debt_transaction_type_validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balancedAdjustment", "credit", "charge", "null"])
316
+ debt_transaction_type_validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balanceAdjustment", "credit", "charge", "null"])
350
317
  return false unless debt_transaction_type_validator.valid?(@debt_transaction_type)
351
318
  return false if @deleted.nil?
352
319
  return false if @account_name.nil?
@@ -354,33 +321,9 @@ module YNAB
354
321
  true
355
322
  end
356
323
 
357
- # Custom attribute writer method checking allowed values (enum).
358
- # @param [Object] cleared Object to be assigned
359
- def cleared=(cleared)
360
- validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
361
- unless validator.valid?(cleared)
362
- fail ArgumentError, "invalid value for \"cleared\", must be one of #{validator.allowable_values}."
363
- end
364
- @cleared = cleared
365
- end
366
-
367
- # Custom attribute writer method checking allowed values (enum).
368
- # @param [Object] flag_color Object to be assigned
369
- def flag_color=(flag_color)
370
- validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
371
- unless validator.valid?(flag_color)
372
- fail ArgumentError, "invalid value for \"flag_color\", must be one of #{validator.allowable_values}."
373
- end
374
- @flag_color = flag_color
375
- end
376
-
377
324
  # Custom attribute writer method checking allowed values (enum).
378
325
  # @param [Object] debt_transaction_type Object to be assigned
379
326
  def debt_transaction_type=(debt_transaction_type)
380
- validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balancedAdjustment", "credit", "charge", "null"])
381
- unless validator.valid?(debt_transaction_type)
382
- fail ArgumentError, "invalid value for \"debt_transaction_type\", must be one of #{validator.allowable_values}."
383
- end
384
327
  @debt_transaction_type = debt_transaction_type
385
328
  end
386
329
 
@@ -396,6 +339,7 @@ module YNAB
396
339
  cleared == o.cleared &&
397
340
  approved == o.approved &&
398
341
  flag_color == o.flag_color &&
342
+ flag_name == o.flag_name &&
399
343
  account_id == o.account_id &&
400
344
  payee_id == o.payee_id &&
401
345
  category_id == o.category_id &&
@@ -422,44 +366,37 @@ module YNAB
422
366
  # Calculates hash code according to all attributes.
423
367
  # @return [Integer] Hash code
424
368
  def hash
425
- [id, date, amount, memo, cleared, approved, flag_color, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted, account_name, payee_name, category_name, subtransactions].hash
369
+ [id, date, amount, memo, cleared, approved, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted, account_name, payee_name, category_name, subtransactions].hash
426
370
  end
427
371
 
428
372
  # Builds the object from hash
429
373
  # @param [Hash] attributes Model attributes in the form of hash
430
374
  # @return [Object] Returns the model itself
431
375
  def self.build_from_hash(attributes)
432
- new.build_from_hash(attributes)
433
- end
434
-
435
- # Builds the object from hash
436
- # @param [Hash] attributes Model attributes in the form of hash
437
- # @return [Object] Returns the model itself
438
- def build_from_hash(attributes)
439
376
  return nil unless attributes.is_a?(Hash)
440
377
  attributes = attributes.transform_keys(&:to_sym)
441
- self.class.openapi_types.each_pair do |key, type|
442
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
443
- self.send("#{key}=", nil)
378
+ transformed_hash = {}
379
+ openapi_types.each_pair do |key, type|
380
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
381
+ transformed_hash["#{key}"] = nil
444
382
  elsif type =~ /\AArray<(.*)>/i
445
383
  # check to ensure the input is an array given that the attribute
446
384
  # is documented as an array but the input is not
447
- if attributes[self.class.attribute_map[key]].is_a?(Array)
448
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
385
+ if attributes[attribute_map[key]].is_a?(Array)
386
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
449
387
  end
450
- elsif !attributes[self.class.attribute_map[key]].nil?
451
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
388
+ elsif !attributes[attribute_map[key]].nil?
389
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
452
390
  end
453
391
  end
454
-
455
- self
392
+ new(transformed_hash)
456
393
  end
457
394
 
458
395
  # Deserializes the data based on type
459
396
  # @param string type Data type
460
397
  # @param string value Value to be deserialized
461
398
  # @return [Object] Deserialized data
462
- def _deserialize(type, value)
399
+ def self._deserialize(type, value)
463
400
  case type.to_sym
464
401
  when :Time
465
402
  Time.parse(value)
@@ -494,7 +431,7 @@ module YNAB
494
431
  else # model
495
432
  # models (e.g. Pet) or oneOf
496
433
  klass = YNAB.const_get(type)
497
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
434
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
498
435
  end
499
436
  end
500
437
 
@@ -96,14 +96,6 @@ module YNAB
96
96
  # @return Array for valid properties with the reasons
97
97
  def list_invalid_properties
98
98
  invalid_properties = Array.new
99
- if @account_name.nil?
100
- invalid_properties.push('invalid value for "account_name", account_name cannot be nil.')
101
- end
102
-
103
- if @subtransactions.nil?
104
- invalid_properties.push('invalid value for "subtransactions", subtransactions cannot be nil.')
105
- end
106
-
107
99
  invalid_properties
108
100
  end
109
101
 
@@ -0,0 +1,45 @@
1
+ =begin
2
+ #YNAB API Endpoints
3
+
4
+ #Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
5
+
6
+ The version of the OpenAPI document: 1.69.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module YNAB
17
+ class TransactionFlagColor
18
+ RED = "red".freeze
19
+ ORANGE = "orange".freeze
20
+ YELLOW = "yellow".freeze
21
+ GREEN = "green".freeze
22
+ BLUE = "blue".freeze
23
+ PURPLE = "purple".freeze
24
+ NULL = "null".freeze
25
+
26
+ def self.all_vars
27
+ @all_vars ||= [RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE, NULL].freeze
28
+ end
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def self.build_from_hash(value)
34
+ new.build_from_hash(value)
35
+ end
36
+
37
+ # Builds the enum from string
38
+ # @param [String] The enum value in the form of the string
39
+ # @return [String] The enum value
40
+ def build_from_hash(value)
41
+ return value if TransactionFlagColor.all_vars.include?(value)
42
+ raise "Invalid ENUM value #{value} for class #TransactionFlagColor"
43
+ end
44
+ end
45
+ end
@@ -3,10 +3,10 @@
3
3
 
4
4
  #Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
5
5
 
6
- The version of the OpenAPI document: 1.0.0
6
+ The version of the OpenAPI document: 1.69.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -66,10 +66,6 @@ module YNAB
66
66
  # @return Array for valid properties with the reasons
67
67
  def list_invalid_properties
68
68
  invalid_properties = Array.new
69
- if @data.nil?
70
- invalid_properties.push('invalid value for "data", data cannot be nil.')
71
- end
72
-
73
69
  invalid_properties
74
70
  end
75
71
 
@@ -104,37 +100,30 @@ module YNAB
104
100
  # @param [Hash] attributes Model attributes in the form of hash
105
101
  # @return [Object] Returns the model itself
106
102
  def self.build_from_hash(attributes)
107
- new.build_from_hash(attributes)
108
- end
109
-
110
- # Builds the object from hash
111
- # @param [Hash] attributes Model attributes in the form of hash
112
- # @return [Object] Returns the model itself
113
- def build_from_hash(attributes)
114
103
  return nil unless attributes.is_a?(Hash)
115
104
  attributes = attributes.transform_keys(&:to_sym)
116
- self.class.openapi_types.each_pair do |key, type|
117
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
118
- self.send("#{key}=", nil)
105
+ transformed_hash = {}
106
+ openapi_types.each_pair do |key, type|
107
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
108
+ transformed_hash["#{key}"] = nil
119
109
  elsif type =~ /\AArray<(.*)>/i
120
110
  # check to ensure the input is an array given that the attribute
121
111
  # is documented as an array but the input is not
122
- if attributes[self.class.attribute_map[key]].is_a?(Array)
123
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
+ if attributes[attribute_map[key]].is_a?(Array)
113
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
114
  end
125
- elsif !attributes[self.class.attribute_map[key]].nil?
126
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ elsif !attributes[attribute_map[key]].nil?
116
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
117
  end
128
118
  end
129
-
130
- self
119
+ new(transformed_hash)
131
120
  end
132
121
 
133
122
  # Deserializes the data based on type
134
123
  # @param string type Data type
135
124
  # @param string value Value to be deserialized
136
125
  # @return [Object] Deserialized data
137
- def _deserialize(type, value)
126
+ def self._deserialize(type, value)
138
127
  case type.to_sym
139
128
  when :Time
140
129
  Time.parse(value)
@@ -169,7 +158,7 @@ module YNAB
169
158
  else # model
170
159
  # models (e.g. Pet) or oneOf
171
160
  klass = YNAB.const_get(type)
172
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
161
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
173
162
  end
174
163
  end
175
164
 
@@ -3,10 +3,10 @@
3
3
 
4
4
  #Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
5
5
 
6
- The version of the OpenAPI document: 1.0.0
6
+ The version of the OpenAPI document: 1.69.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -66,10 +66,6 @@ module YNAB
66
66
  # @return Array for valid properties with the reasons
67
67
  def list_invalid_properties
68
68
  invalid_properties = Array.new
69
- if @transaction.nil?
70
- invalid_properties.push('invalid value for "transaction", transaction cannot be nil.')
71
- end
72
-
73
69
  invalid_properties
74
70
  end
75
71
 
@@ -104,37 +100,30 @@ module YNAB
104
100
  # @param [Hash] attributes Model attributes in the form of hash
105
101
  # @return [Object] Returns the model itself
106
102
  def self.build_from_hash(attributes)
107
- new.build_from_hash(attributes)
108
- end
109
-
110
- # Builds the object from hash
111
- # @param [Hash] attributes Model attributes in the form of hash
112
- # @return [Object] Returns the model itself
113
- def build_from_hash(attributes)
114
103
  return nil unless attributes.is_a?(Hash)
115
104
  attributes = attributes.transform_keys(&:to_sym)
116
- self.class.openapi_types.each_pair do |key, type|
117
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
118
- self.send("#{key}=", nil)
105
+ transformed_hash = {}
106
+ openapi_types.each_pair do |key, type|
107
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
108
+ transformed_hash["#{key}"] = nil
119
109
  elsif type =~ /\AArray<(.*)>/i
120
110
  # check to ensure the input is an array given that the attribute
121
111
  # is documented as an array but the input is not
122
- if attributes[self.class.attribute_map[key]].is_a?(Array)
123
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
+ if attributes[attribute_map[key]].is_a?(Array)
113
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
114
  end
125
- elsif !attributes[self.class.attribute_map[key]].nil?
126
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ elsif !attributes[attribute_map[key]].nil?
116
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
117
  end
128
118
  end
129
-
130
- self
119
+ new(transformed_hash)
131
120
  end
132
121
 
133
122
  # Deserializes the data based on type
134
123
  # @param string type Data type
135
124
  # @param string value Value to be deserialized
136
125
  # @return [Object] Deserialized data
137
- def _deserialize(type, value)
126
+ def self._deserialize(type, value)
138
127
  case type.to_sym
139
128
  when :Time
140
129
  Time.parse(value)
@@ -169,7 +158,7 @@ module YNAB
169
158
  else # model
170
159
  # models (e.g. Pet) or oneOf
171
160
  klass = YNAB.const_get(type)
172
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
161
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
173
162
  end
174
163
  end
175
164