ynab 2.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/DEVELOPMENT.md +6 -2
  3. data/Gemfile.lock +1 -1
  4. data/README.md +3 -1
  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 -12
  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 -20
  41. data/lib/ynab/models/account_response.rb +13 -20
  42. data/lib/ynab/models/account_response_data.rb +13 -20
  43. data/lib/ynab/models/account_type.rb +2 -2
  44. data/lib/ynab/models/accounts_response.rb +13 -20
  45. data/lib/ynab/models/accounts_response_data.rb +13 -20
  46. data/lib/ynab/models/budget_detail.rb +13 -21
  47. data/lib/ynab/models/budget_detail_response.rb +13 -20
  48. data/lib/ynab/models/budget_detail_response_data.rb +13 -20
  49. data/lib/ynab/models/budget_settings.rb +13 -20
  50. data/lib/ynab/models/budget_settings_response.rb +13 -20
  51. data/lib/ynab/models/budget_settings_response_data.rb +13 -20
  52. data/lib/ynab/models/budget_summary.rb +13 -20
  53. data/lib/ynab/models/budget_summary_response.rb +13 -20
  54. data/lib/ynab/models/budget_summary_response_data.rb +13 -20
  55. data/lib/ynab/models/bulk_response.rb +13 -20
  56. data/lib/ynab/models/bulk_response_data.rb +13 -20
  57. data/lib/ynab/models/bulk_response_data_bulk.rb +13 -20
  58. data/lib/ynab/models/bulk_transactions.rb +14 -21
  59. data/lib/ynab/models/categories_response.rb +13 -20
  60. data/lib/ynab/models/categories_response_data.rb +13 -20
  61. data/lib/ynab/models/category.rb +13 -20
  62. data/lib/ynab/models/category_group.rb +13 -20
  63. data/lib/ynab/models/category_group_with_categories.rb +14 -22
  64. data/lib/ynab/models/category_response.rb +13 -20
  65. data/lib/ynab/models/category_response_data.rb +13 -20
  66. data/lib/ynab/models/currency_format.rb +13 -20
  67. data/lib/ynab/models/date_format.rb +13 -20
  68. data/lib/ynab/models/error_detail.rb +13 -20
  69. data/lib/ynab/models/error_response.rb +13 -20
  70. data/lib/ynab/models/existing_transaction.rb +359 -0
  71. data/lib/ynab/models/hybrid_transaction.rb +28 -43
  72. data/lib/ynab/models/hybrid_transactions_response.rb +13 -20
  73. data/lib/ynab/models/hybrid_transactions_response_data.rb +13 -20
  74. data/lib/ynab/models/month_detail.rb +13 -21
  75. data/lib/ynab/models/month_detail_response.rb +13 -20
  76. data/lib/ynab/models/month_detail_response_data.rb +13 -20
  77. data/lib/ynab/models/month_summaries_response.rb +13 -20
  78. data/lib/ynab/models/month_summaries_response_data.rb +13 -20
  79. data/lib/ynab/models/month_summary.rb +13 -20
  80. data/lib/ynab/models/new_transaction.rb +377 -0
  81. data/lib/ynab/models/patch_category_wrapper.rb +213 -0
  82. data/lib/ynab/models/patch_month_category_wrapper.rb +13 -20
  83. data/lib/ynab/models/patch_payee_wrapper.rb +213 -0
  84. data/lib/ynab/models/patch_transactions_wrapper.rb +14 -21
  85. data/lib/ynab/models/payee.rb +13 -20
  86. data/lib/ynab/models/payee_location.rb +13 -20
  87. data/lib/ynab/models/payee_location_response.rb +13 -20
  88. data/lib/ynab/models/payee_location_response_data.rb +13 -20
  89. data/lib/ynab/models/payee_locations_response.rb +13 -20
  90. data/lib/ynab/models/payee_locations_response_data.rb +13 -20
  91. data/lib/ynab/models/payee_response.rb +13 -20
  92. data/lib/ynab/models/payee_response_data.rb +13 -20
  93. data/lib/ynab/models/payees_response.rb +13 -20
  94. data/lib/ynab/models/payees_response_data.rb +13 -20
  95. data/lib/ynab/models/post_account_wrapper.rb +13 -20
  96. data/lib/ynab/models/post_transactions_wrapper.rb +15 -22
  97. data/lib/ynab/models/put_transaction_wrapper.rb +14 -21
  98. data/lib/ynab/models/save_account.rb +13 -20
  99. data/lib/ynab/models/save_category.rb +232 -0
  100. data/lib/ynab/models/save_category_response.rb +13 -20
  101. data/lib/ynab/models/save_category_response_data.rb +13 -20
  102. data/lib/ynab/models/save_month_category.rb +13 -20
  103. data/lib/ynab/models/save_payee.rb +220 -0
  104. data/lib/ynab/models/save_payee_response.rb +213 -0
  105. data/lib/ynab/models/save_payee_response_data.rb +224 -0
  106. data/lib/ynab/models/save_sub_transaction.rb +13 -20
  107. data/lib/ynab/models/save_transaction_with_id_or_import_id.rb +388 -0
  108. data/lib/ynab/models/save_transaction_with_optional_fields.rb +17 -59
  109. data/lib/ynab/models/save_transactions_response.rb +13 -20
  110. data/lib/ynab/models/save_transactions_response_data.rb +13 -20
  111. data/lib/ynab/models/scheduled_sub_transaction.rb +13 -20
  112. data/lib/ynab/models/scheduled_transaction_detail.rb +26 -32
  113. data/lib/ynab/models/scheduled_transaction_response.rb +13 -20
  114. data/lib/ynab/models/scheduled_transaction_response_data.rb +13 -20
  115. data/lib/ynab/models/scheduled_transaction_summary.rb +26 -31
  116. data/lib/ynab/models/scheduled_transactions_response.rb +13 -20
  117. data/lib/ynab/models/scheduled_transactions_response_data.rb +13 -20
  118. data/lib/ynab/models/sub_transaction.rb +13 -20
  119. data/lib/ynab/models/transaction_cleared_status.rb +41 -0
  120. data/lib/ynab/models/transaction_detail.rb +28 -43
  121. data/lib/ynab/models/transaction_flag_color.rb +45 -0
  122. data/lib/ynab/models/transaction_response.rb +13 -20
  123. data/lib/ynab/models/transaction_response_data.rb +13 -20
  124. data/lib/ynab/models/transaction_summary.rb +28 -42
  125. data/lib/ynab/models/transactions_import_response.rb +13 -20
  126. data/lib/ynab/models/transactions_import_response_data.rb +13 -20
  127. data/lib/ynab/models/transactions_response.rb +13 -20
  128. data/lib/ynab/models/transactions_response_data.rb +13 -20
  129. data/lib/ynab/models/user.rb +13 -20
  130. data/lib/ynab/models/user_response.rb +13 -20
  131. data/lib/ynab/models/user_response_data.rb +13 -20
  132. data/lib/ynab/version.rb +1 -1
  133. data/lib/ynab.rb +13 -12
  134. data/open_api_spec.yaml +455 -343
  135. data/ynab.gemspec +4 -3
  136. metadata +29 -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
 
@@ -113,37 +113,30 @@ module YNAB
113
113
  # @param [Hash] attributes Model attributes in the form of hash
114
114
  # @return [Object] Returns the model itself
115
115
  def self.build_from_hash(attributes)
116
- new.build_from_hash(attributes)
117
- end
118
-
119
- # Builds the object from hash
120
- # @param [Hash] attributes Model attributes in the form of hash
121
- # @return [Object] Returns the model itself
122
- def build_from_hash(attributes)
123
116
  return nil unless attributes.is_a?(Hash)
124
117
  attributes = attributes.transform_keys(&:to_sym)
125
- self.class.openapi_types.each_pair do |key, type|
126
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
127
- 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
128
122
  elsif type =~ /\AArray<(.*)>/i
129
123
  # check to ensure the input is an array given that the attribute
130
124
  # is documented as an array but the input is not
131
- if attributes[self.class.attribute_map[key]].is_a?(Array)
132
- 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) }
133
127
  end
134
- elsif !attributes[self.class.attribute_map[key]].nil?
135
- 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]])
136
130
  end
137
131
  end
138
-
139
- self
132
+ new(transformed_hash)
140
133
  end
141
134
 
142
135
  # Deserializes the data based on type
143
136
  # @param string type Data type
144
137
  # @param string value Value to be deserialized
145
138
  # @return [Object] Deserialized data
146
- def _deserialize(type, value)
139
+ def self._deserialize(type, value)
147
140
  case type.to_sym
148
141
  when :Time
149
142
  Time.parse(value)
@@ -178,7 +171,7 @@ module YNAB
178
171
  else # model
179
172
  # models (e.g. Pet) or oneOf
180
173
  klass = YNAB.const_get(type)
181
- 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)
182
175
  end
183
176
  end
184
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
 
@@ -204,37 +204,30 @@ module YNAB
204
204
  # @param [Hash] attributes Model attributes in the form of hash
205
205
  # @return [Object] Returns the model itself
206
206
  def self.build_from_hash(attributes)
207
- new.build_from_hash(attributes)
208
- end
209
-
210
- # Builds the object from hash
211
- # @param [Hash] attributes Model attributes in the form of hash
212
- # @return [Object] Returns the model itself
213
- def build_from_hash(attributes)
214
207
  return nil unless attributes.is_a?(Hash)
215
208
  attributes = attributes.transform_keys(&:to_sym)
216
- self.class.openapi_types.each_pair do |key, type|
217
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
218
- 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
219
213
  elsif type =~ /\AArray<(.*)>/i
220
214
  # check to ensure the input is an array given that the attribute
221
215
  # is documented as an array but the input is not
222
- if attributes[self.class.attribute_map[key]].is_a?(Array)
223
- 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) }
224
218
  end
225
- elsif !attributes[self.class.attribute_map[key]].nil?
226
- 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]])
227
221
  end
228
222
  end
229
-
230
- self
223
+ new(transformed_hash)
231
224
  end
232
225
 
233
226
  # Deserializes the data based on type
234
227
  # @param string type Data type
235
228
  # @param string value Value to be deserialized
236
229
  # @return [Object] Deserialized data
237
- def _deserialize(type, value)
230
+ def self._deserialize(type, value)
238
231
  case type.to_sym
239
232
  when :Time
240
233
  Time.parse(value)
@@ -269,7 +262,7 @@ module YNAB
269
262
  else # model
270
263
  # models (e.g. Pet) or oneOf
271
264
  klass = YNAB.const_get(type)
272
- 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)
273
266
  end
274
267
  end
275
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
@@ -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
@@ -304,13 +311,9 @@ module YNAB
304
311
  return false if @date.nil?
305
312
  return false if @amount.nil?
306
313
  return false if @cleared.nil?
307
- cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
308
- return false unless cleared_validator.valid?(@cleared)
309
314
  return false if @approved.nil?
310
- flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
311
- return false unless flag_color_validator.valid?(@flag_color)
312
315
  return false if @account_id.nil?
313
- 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"])
314
317
  return false unless debt_transaction_type_validator.valid?(@debt_transaction_type)
315
318
  return false if @deleted.nil?
316
319
  return false if @account_name.nil?
@@ -318,18 +321,6 @@ module YNAB
318
321
  true
319
322
  end
320
323
 
321
- # Custom attribute writer method checking allowed values (enum).
322
- # @param [Object] cleared Object to be assigned
323
- def cleared=(cleared)
324
- @cleared = cleared
325
- end
326
-
327
- # Custom attribute writer method checking allowed values (enum).
328
- # @param [Object] flag_color Object to be assigned
329
- def flag_color=(flag_color)
330
- @flag_color = flag_color
331
- end
332
-
333
324
  # Custom attribute writer method checking allowed values (enum).
334
325
  # @param [Object] debt_transaction_type Object to be assigned
335
326
  def debt_transaction_type=(debt_transaction_type)
@@ -348,6 +339,7 @@ module YNAB
348
339
  cleared == o.cleared &&
349
340
  approved == o.approved &&
350
341
  flag_color == o.flag_color &&
342
+ flag_name == o.flag_name &&
351
343
  account_id == o.account_id &&
352
344
  payee_id == o.payee_id &&
353
345
  category_id == o.category_id &&
@@ -374,44 +366,37 @@ module YNAB
374
366
  # Calculates hash code according to all attributes.
375
367
  # @return [Integer] Hash code
376
368
  def hash
377
- [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
378
370
  end
379
371
 
380
372
  # Builds the object from hash
381
373
  # @param [Hash] attributes Model attributes in the form of hash
382
374
  # @return [Object] Returns the model itself
383
375
  def self.build_from_hash(attributes)
384
- new.build_from_hash(attributes)
385
- end
386
-
387
- # Builds the object from hash
388
- # @param [Hash] attributes Model attributes in the form of hash
389
- # @return [Object] Returns the model itself
390
- def build_from_hash(attributes)
391
376
  return nil unless attributes.is_a?(Hash)
392
377
  attributes = attributes.transform_keys(&:to_sym)
393
- self.class.openapi_types.each_pair do |key, type|
394
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
395
- 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
396
382
  elsif type =~ /\AArray<(.*)>/i
397
383
  # check to ensure the input is an array given that the attribute
398
384
  # is documented as an array but the input is not
399
- if attributes[self.class.attribute_map[key]].is_a?(Array)
400
- 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) }
401
387
  end
402
- elsif !attributes[self.class.attribute_map[key]].nil?
403
- 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]])
404
390
  end
405
391
  end
406
-
407
- self
392
+ new(transformed_hash)
408
393
  end
409
394
 
410
395
  # Deserializes the data based on type
411
396
  # @param string type Data type
412
397
  # @param string value Value to be deserialized
413
398
  # @return [Object] Deserialized data
414
- def _deserialize(type, value)
399
+ def self._deserialize(type, value)
415
400
  case type.to_sym
416
401
  when :Time
417
402
  Time.parse(value)
@@ -446,7 +431,7 @@ module YNAB
446
431
  else # model
447
432
  # models (e.g. Pet) or oneOf
448
433
  klass = YNAB.const_get(type)
449
- 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)
450
435
  end
451
436
  end
452
437
 
@@ -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
 
@@ -100,37 +100,30 @@ module YNAB
100
100
  # @param [Hash] attributes Model attributes in the form of hash
101
101
  # @return [Object] Returns the model itself
102
102
  def self.build_from_hash(attributes)
103
- new.build_from_hash(attributes)
104
- end
105
-
106
- # Builds the object from hash
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- # @return [Object] Returns the model itself
109
- def build_from_hash(attributes)
110
103
  return nil unless attributes.is_a?(Hash)
111
104
  attributes = attributes.transform_keys(&:to_sym)
112
- self.class.openapi_types.each_pair do |key, type|
113
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
- 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
115
109
  elsif type =~ /\AArray<(.*)>/i
116
110
  # check to ensure the input is an array given that the attribute
117
111
  # is documented as an array but the input is not
118
- if attributes[self.class.attribute_map[key]].is_a?(Array)
119
- 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) }
120
114
  end
121
- elsif !attributes[self.class.attribute_map[key]].nil?
122
- 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]])
123
117
  end
124
118
  end
125
-
126
- self
119
+ new(transformed_hash)
127
120
  end
128
121
 
129
122
  # Deserializes the data based on type
130
123
  # @param string type Data type
131
124
  # @param string value Value to be deserialized
132
125
  # @return [Object] Deserialized data
133
- def _deserialize(type, value)
126
+ def self._deserialize(type, value)
134
127
  case type.to_sym
135
128
  when :Time
136
129
  Time.parse(value)
@@ -165,7 +158,7 @@ module YNAB
165
158
  else # model
166
159
  # models (e.g. Pet) or oneOf
167
160
  klass = YNAB.const_get(type)
168
- 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)
169
162
  end
170
163
  end
171
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
 
@@ -100,37 +100,30 @@ module YNAB
100
100
  # @param [Hash] attributes Model attributes in the form of hash
101
101
  # @return [Object] Returns the model itself
102
102
  def self.build_from_hash(attributes)
103
- new.build_from_hash(attributes)
104
- end
105
-
106
- # Builds the object from hash
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- # @return [Object] Returns the model itself
109
- def build_from_hash(attributes)
110
103
  return nil unless attributes.is_a?(Hash)
111
104
  attributes = attributes.transform_keys(&:to_sym)
112
- self.class.openapi_types.each_pair do |key, type|
113
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
- 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
115
109
  elsif type =~ /\AArray<(.*)>/i
116
110
  # check to ensure the input is an array given that the attribute
117
111
  # is documented as an array but the input is not
118
- if attributes[self.class.attribute_map[key]].is_a?(Array)
119
- 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) }
120
114
  end
121
- elsif !attributes[self.class.attribute_map[key]].nil?
122
- 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]])
123
117
  end
124
118
  end
125
-
126
- self
119
+ new(transformed_hash)
127
120
  end
128
121
 
129
122
  # Deserializes the data based on type
130
123
  # @param string type Data type
131
124
  # @param string value Value to be deserialized
132
125
  # @return [Object] Deserialized data
133
- def _deserialize(type, value)
126
+ def self._deserialize(type, value)
134
127
  case type.to_sym
135
128
  when :Time
136
129
  Time.parse(value)
@@ -165,7 +158,7 @@ module YNAB
165
158
  else # model
166
159
  # models (e.g. Pet) or oneOf
167
160
  klass = YNAB.const_get(type)
168
- 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)
169
162
  end
170
163
  end
171
164