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
 
@@ -30,9 +30,11 @@ module YNAB
30
30
 
31
31
  attr_accessor :memo
32
32
 
33
- # The scheduled transaction flag
34
33
  attr_accessor :flag_color
35
34
 
35
+ # The customized name of a transaction flag
36
+ attr_accessor :flag_name
37
+
36
38
  attr_accessor :account_id
37
39
 
38
40
  attr_accessor :payee_id
@@ -77,6 +79,7 @@ module YNAB
77
79
  :'amount' => :'amount',
78
80
  :'memo' => :'memo',
79
81
  :'flag_color' => :'flag_color',
82
+ :'flag_name' => :'flag_name',
80
83
  :'account_id' => :'account_id',
81
84
  :'payee_id' => :'payee_id',
82
85
  :'category_id' => :'category_id',
@@ -99,7 +102,8 @@ module YNAB
99
102
  :'frequency' => :'String',
100
103
  :'amount' => :'Integer',
101
104
  :'memo' => :'String',
102
- :'flag_color' => :'String',
105
+ :'flag_color' => :'TransactionFlagColor',
106
+ :'flag_name' => :'String',
103
107
  :'account_id' => :'String',
104
108
  :'payee_id' => :'String',
105
109
  :'category_id' => :'String',
@@ -113,6 +117,7 @@ module YNAB
113
117
  Set.new([
114
118
  :'memo',
115
119
  :'flag_color',
120
+ :'flag_name',
116
121
  :'payee_id',
117
122
  :'category_id',
118
123
  :'transfer_account_id',
@@ -162,6 +167,10 @@ module YNAB
162
167
  self.flag_color = attributes[:'flag_color']
163
168
  end
164
169
 
170
+ if attributes.key?(:'flag_name')
171
+ self.flag_name = attributes[:'flag_name']
172
+ end
173
+
165
174
  if attributes.key?(:'account_id')
166
175
  self.account_id = attributes[:'account_id']
167
176
  end
@@ -187,34 +196,6 @@ module YNAB
187
196
  # @return Array for valid properties with the reasons
188
197
  def list_invalid_properties
189
198
  invalid_properties = Array.new
190
- if @id.nil?
191
- invalid_properties.push('invalid value for "id", id cannot be nil.')
192
- end
193
-
194
- if @date_first.nil?
195
- invalid_properties.push('invalid value for "date_first", date_first cannot be nil.')
196
- end
197
-
198
- if @date_next.nil?
199
- invalid_properties.push('invalid value for "date_next", date_next cannot be nil.')
200
- end
201
-
202
- if @frequency.nil?
203
- invalid_properties.push('invalid value for "frequency", frequency cannot be nil.')
204
- end
205
-
206
- if @amount.nil?
207
- invalid_properties.push('invalid value for "amount", amount cannot be nil.')
208
- end
209
-
210
- if @account_id.nil?
211
- invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
212
- end
213
-
214
- if @deleted.nil?
215
- invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
216
- end
217
-
218
199
  invalid_properties
219
200
  end
220
201
 
@@ -228,8 +209,6 @@ module YNAB
228
209
  frequency_validator = EnumAttributeValidator.new('String', ["never", "daily", "weekly", "everyOtherWeek", "twiceAMonth", "every4Weeks", "monthly", "everyOtherMonth", "every3Months", "every4Months", "twiceAYear", "yearly", "everyOtherYear"])
229
210
  return false unless frequency_validator.valid?(@frequency)
230
211
  return false if @amount.nil?
231
- flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
232
- return false unless flag_color_validator.valid?(@flag_color)
233
212
  return false if @account_id.nil?
234
213
  return false if @deleted.nil?
235
214
  true
@@ -238,23 +217,9 @@ module YNAB
238
217
  # Custom attribute writer method checking allowed values (enum).
239
218
  # @param [Object] frequency Object to be assigned
240
219
  def frequency=(frequency)
241
- validator = EnumAttributeValidator.new('String', ["never", "daily", "weekly", "everyOtherWeek", "twiceAMonth", "every4Weeks", "monthly", "everyOtherMonth", "every3Months", "every4Months", "twiceAYear", "yearly", "everyOtherYear"])
242
- unless validator.valid?(frequency)
243
- fail ArgumentError, "invalid value for \"frequency\", must be one of #{validator.allowable_values}."
244
- end
245
220
  @frequency = frequency
246
221
  end
247
222
 
248
- # Custom attribute writer method checking allowed values (enum).
249
- # @param [Object] flag_color Object to be assigned
250
- def flag_color=(flag_color)
251
- validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
252
- unless validator.valid?(flag_color)
253
- fail ArgumentError, "invalid value for \"flag_color\", must be one of #{validator.allowable_values}."
254
- end
255
- @flag_color = flag_color
256
- end
257
-
258
223
  # Checks equality by comparing each attribute.
259
224
  # @param [Object] Object to be compared
260
225
  def ==(o)
@@ -267,6 +232,7 @@ module YNAB
267
232
  amount == o.amount &&
268
233
  memo == o.memo &&
269
234
  flag_color == o.flag_color &&
235
+ flag_name == o.flag_name &&
270
236
  account_id == o.account_id &&
271
237
  payee_id == o.payee_id &&
272
238
  category_id == o.category_id &&
@@ -283,44 +249,37 @@ module YNAB
283
249
  # Calculates hash code according to all attributes.
284
250
  # @return [Integer] Hash code
285
251
  def hash
286
- [id, date_first, date_next, frequency, amount, memo, flag_color, account_id, payee_id, category_id, transfer_account_id, deleted].hash
252
+ [id, date_first, date_next, frequency, amount, memo, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, deleted].hash
287
253
  end
288
254
 
289
255
  # Builds the object from hash
290
256
  # @param [Hash] attributes Model attributes in the form of hash
291
257
  # @return [Object] Returns the model itself
292
258
  def self.build_from_hash(attributes)
293
- new.build_from_hash(attributes)
294
- end
295
-
296
- # Builds the object from hash
297
- # @param [Hash] attributes Model attributes in the form of hash
298
- # @return [Object] Returns the model itself
299
- def build_from_hash(attributes)
300
259
  return nil unless attributes.is_a?(Hash)
301
260
  attributes = attributes.transform_keys(&:to_sym)
302
- self.class.openapi_types.each_pair do |key, type|
303
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
304
- self.send("#{key}=", nil)
261
+ transformed_hash = {}
262
+ openapi_types.each_pair do |key, type|
263
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
264
+ transformed_hash["#{key}"] = nil
305
265
  elsif type =~ /\AArray<(.*)>/i
306
266
  # check to ensure the input is an array given that the attribute
307
267
  # is documented as an array but the input is not
308
- if attributes[self.class.attribute_map[key]].is_a?(Array)
309
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
268
+ if attributes[attribute_map[key]].is_a?(Array)
269
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
310
270
  end
311
- elsif !attributes[self.class.attribute_map[key]].nil?
312
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
271
+ elsif !attributes[attribute_map[key]].nil?
272
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
313
273
  end
314
274
  end
315
-
316
- self
275
+ new(transformed_hash)
317
276
  end
318
277
 
319
278
  # Deserializes the data based on type
320
279
  # @param string type Data type
321
280
  # @param string value Value to be deserialized
322
281
  # @return [Object] Deserialized data
323
- def _deserialize(type, value)
282
+ def self._deserialize(type, value)
324
283
  case type.to_sym
325
284
  when :Time
326
285
  Time.parse(value)
@@ -355,7 +314,7 @@ module YNAB
355
314
  else # model
356
315
  # models (e.g. Pet) or oneOf
357
316
  klass = YNAB.const_get(type)
358
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
317
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
359
318
  end
360
319
  end
361
320
 
@@ -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
 
@@ -77,14 +77,6 @@ module YNAB
77
77
  # @return Array for valid properties with the reasons
78
78
  def list_invalid_properties
79
79
  invalid_properties = Array.new
80
- if @scheduled_transactions.nil?
81
- invalid_properties.push('invalid value for "scheduled_transactions", scheduled_transactions cannot be nil.')
82
- end
83
-
84
- if @server_knowledge.nil?
85
- invalid_properties.push('invalid value for "server_knowledge", server_knowledge cannot be nil.')
86
- end
87
-
88
80
  invalid_properties
89
81
  end
90
82
 
@@ -121,37 +113,30 @@ module YNAB
121
113
  # @param [Hash] attributes Model attributes in the form of hash
122
114
  # @return [Object] Returns the model itself
123
115
  def self.build_from_hash(attributes)
124
- new.build_from_hash(attributes)
125
- end
126
-
127
- # Builds the object from hash
128
- # @param [Hash] attributes Model attributes in the form of hash
129
- # @return [Object] Returns the model itself
130
- def build_from_hash(attributes)
131
116
  return nil unless attributes.is_a?(Hash)
132
117
  attributes = attributes.transform_keys(&:to_sym)
133
- self.class.openapi_types.each_pair do |key, type|
134
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
135
- self.send("#{key}=", nil)
118
+ transformed_hash = {}
119
+ openapi_types.each_pair do |key, type|
120
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
121
+ transformed_hash["#{key}"] = nil
136
122
  elsif type =~ /\AArray<(.*)>/i
137
123
  # check to ensure the input is an array given that the attribute
138
124
  # is documented as an array but the input is not
139
- if attributes[self.class.attribute_map[key]].is_a?(Array)
140
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ if attributes[attribute_map[key]].is_a?(Array)
126
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
141
127
  end
142
- elsif !attributes[self.class.attribute_map[key]].nil?
143
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ elsif !attributes[attribute_map[key]].nil?
129
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
144
130
  end
145
131
  end
146
-
147
- self
132
+ new(transformed_hash)
148
133
  end
149
134
 
150
135
  # Deserializes the data based on type
151
136
  # @param string type Data type
152
137
  # @param string value Value to be deserialized
153
138
  # @return [Object] Deserialized data
154
- def _deserialize(type, value)
139
+ def self._deserialize(type, value)
155
140
  case type.to_sym
156
141
  when :Time
157
142
  Time.parse(value)
@@ -186,7 +171,7 @@ module YNAB
186
171
  else # model
187
172
  # models (e.g. Pet) or oneOf
188
173
  klass = YNAB.const_get(type)
189
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
175
  end
191
176
  end
192
177
 
@@ -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
 
@@ -157,22 +157,6 @@ module YNAB
157
157
  # @return Array for valid properties with the reasons
158
158
  def list_invalid_properties
159
159
  invalid_properties = Array.new
160
- if @id.nil?
161
- invalid_properties.push('invalid value for "id", id cannot be nil.')
162
- end
163
-
164
- if @transaction_id.nil?
165
- invalid_properties.push('invalid value for "transaction_id", transaction_id cannot be nil.')
166
- end
167
-
168
- if @amount.nil?
169
- invalid_properties.push('invalid value for "amount", amount cannot be nil.')
170
- end
171
-
172
- if @deleted.nil?
173
- invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
174
- end
175
-
176
160
  invalid_properties
177
161
  end
178
162
 
@@ -220,37 +204,30 @@ module YNAB
220
204
  # @param [Hash] attributes Model attributes in the form of hash
221
205
  # @return [Object] Returns the model itself
222
206
  def self.build_from_hash(attributes)
223
- new.build_from_hash(attributes)
224
- end
225
-
226
- # Builds the object from hash
227
- # @param [Hash] attributes Model attributes in the form of hash
228
- # @return [Object] Returns the model itself
229
- def build_from_hash(attributes)
230
207
  return nil unless attributes.is_a?(Hash)
231
208
  attributes = attributes.transform_keys(&:to_sym)
232
- self.class.openapi_types.each_pair do |key, type|
233
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
234
- self.send("#{key}=", nil)
209
+ transformed_hash = {}
210
+ openapi_types.each_pair do |key, type|
211
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
212
+ transformed_hash["#{key}"] = nil
235
213
  elsif type =~ /\AArray<(.*)>/i
236
214
  # check to ensure the input is an array given that the attribute
237
215
  # is documented as an array but the input is not
238
- if attributes[self.class.attribute_map[key]].is_a?(Array)
239
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
216
+ if attributes[attribute_map[key]].is_a?(Array)
217
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
240
218
  end
241
- elsif !attributes[self.class.attribute_map[key]].nil?
242
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
219
+ elsif !attributes[attribute_map[key]].nil?
220
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
243
221
  end
244
222
  end
245
-
246
- self
223
+ new(transformed_hash)
247
224
  end
248
225
 
249
226
  # Deserializes the data based on type
250
227
  # @param string type Data type
251
228
  # @param string value Value to be deserialized
252
229
  # @return [Object] Deserialized data
253
- def _deserialize(type, value)
230
+ def self._deserialize(type, value)
254
231
  case type.to_sym
255
232
  when :Time
256
233
  Time.parse(value)
@@ -285,7 +262,7 @@ module YNAB
285
262
  else # model
286
263
  # models (e.g. Pet) or oneOf
287
264
  klass = YNAB.const_get(type)
288
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
265
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
289
266
  end
290
267
  end
291
268
 
@@ -0,0 +1,41 @@
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 TransactionClearedStatus
18
+ CLEARED = "cleared".freeze
19
+ UNCLEARED = "uncleared".freeze
20
+ RECONCILED = "reconciled".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [CLEARED, UNCLEARED, RECONCILED].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if TransactionClearedStatus.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #TransactionClearedStatus"
39
+ end
40
+ end
41
+ end