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
@@ -0,0 +1,388 @@
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 SaveTransactionWithIdOrImportId
18
+ attr_accessor :account_id
19
+
20
+ # The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored.
21
+ attr_accessor :date
22
+
23
+ # The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored.
24
+ attr_accessor :amount
25
+
26
+ # The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `tranfer_payee_id` on the account resource.
27
+ attr_accessor :payee_id
28
+
29
+ # The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if `import_id` is also specified) or (2) a payee with the same name or (3) creation of a new payee.
30
+ attr_accessor :payee_name
31
+
32
+ # The category for the transaction. To configure a split transaction, you can specify null for `category_id` and provide a `subtransactions` array as part of the transaction object. If an existing transaction is a split, the `category_id` cannot be changed. Credit Card Payment categories are not permitted and will be ignored if supplied.
33
+ attr_accessor :category_id
34
+
35
+ attr_accessor :memo
36
+
37
+ attr_accessor :cleared
38
+
39
+ # Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default.
40
+ attr_accessor :approved
41
+
42
+ attr_accessor :flag_color
43
+
44
+ # An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
45
+ attr_accessor :subtransactions
46
+
47
+ # If specified, this id will be used to lookup a transaction by its `id` for the purpose of updating the transaction itself. If not specified, an `import_id` should be supplied.
48
+ attr_accessor :id
49
+
50
+ # If specified, this id will be used to lookup a transaction by its `import_id` for the purpose of updating the transaction itself. If not specified, an `id` should be supplied. You may not provide both an `id` and an `import_id` and updating an `import_id` on an existing transaction is not allowed.
51
+ attr_accessor :import_id
52
+
53
+ class EnumAttributeValidator
54
+ attr_reader :datatype
55
+ attr_reader :allowable_values
56
+
57
+ def initialize(datatype, allowable_values)
58
+ @allowable_values = allowable_values.map do |value|
59
+ case datatype.to_s
60
+ when /Integer/i
61
+ value.to_i
62
+ when /Float/i
63
+ value.to_f
64
+ else
65
+ value
66
+ end
67
+ end
68
+ end
69
+
70
+ def valid?(value)
71
+ !value || allowable_values.include?(value)
72
+ end
73
+ end
74
+
75
+ # Attribute mapping from ruby-style variable name to JSON key.
76
+ def self.attribute_map
77
+ {
78
+ :'account_id' => :'account_id',
79
+ :'date' => :'date',
80
+ :'amount' => :'amount',
81
+ :'payee_id' => :'payee_id',
82
+ :'payee_name' => :'payee_name',
83
+ :'category_id' => :'category_id',
84
+ :'memo' => :'memo',
85
+ :'cleared' => :'cleared',
86
+ :'approved' => :'approved',
87
+ :'flag_color' => :'flag_color',
88
+ :'subtransactions' => :'subtransactions',
89
+ :'id' => :'id',
90
+ :'import_id' => :'import_id'
91
+ }
92
+ end
93
+
94
+ # Returns all the JSON keys this model knows about
95
+ def self.acceptable_attributes
96
+ attribute_map.values
97
+ end
98
+
99
+ # Attribute type mapping.
100
+ def self.openapi_types
101
+ {
102
+ :'account_id' => :'String',
103
+ :'date' => :'Date',
104
+ :'amount' => :'Integer',
105
+ :'payee_id' => :'String',
106
+ :'payee_name' => :'String',
107
+ :'category_id' => :'String',
108
+ :'memo' => :'String',
109
+ :'cleared' => :'TransactionClearedStatus',
110
+ :'approved' => :'Boolean',
111
+ :'flag_color' => :'TransactionFlagColor',
112
+ :'subtransactions' => :'Array<SaveSubTransaction>',
113
+ :'id' => :'String',
114
+ :'import_id' => :'String'
115
+ }
116
+ end
117
+
118
+ # List of attributes with nullable: true
119
+ def self.openapi_nullable
120
+ Set.new([
121
+ :'payee_id',
122
+ :'payee_name',
123
+ :'category_id',
124
+ :'memo',
125
+ :'flag_color',
126
+ :'id',
127
+ :'import_id'
128
+ ])
129
+ end
130
+
131
+ # List of class defined in allOf (OpenAPI v3)
132
+ def self.openapi_all_of
133
+ [
134
+ :'SaveTransactionWithOptionalFields'
135
+ ]
136
+ end
137
+
138
+ # Initializes the object
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ def initialize(attributes = {})
141
+ if (!attributes.is_a?(Hash))
142
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveTransactionWithIdOrImportId` initialize method"
143
+ end
144
+
145
+ # check to see if the attribute exists and convert string to symbol for hash key
146
+ attributes = attributes.each_with_object({}) { |(k, v), h|
147
+ if (!self.class.attribute_map.key?(k.to_sym))
148
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveTransactionWithIdOrImportId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
149
+ end
150
+ h[k.to_sym] = v
151
+ }
152
+
153
+ if attributes.key?(:'account_id')
154
+ self.account_id = attributes[:'account_id']
155
+ end
156
+
157
+ if attributes.key?(:'date')
158
+ self.date = attributes[:'date']
159
+ end
160
+
161
+ if attributes.key?(:'amount')
162
+ self.amount = attributes[:'amount']
163
+ end
164
+
165
+ if attributes.key?(:'payee_id')
166
+ self.payee_id = attributes[:'payee_id']
167
+ end
168
+
169
+ if attributes.key?(:'payee_name')
170
+ self.payee_name = attributes[:'payee_name']
171
+ end
172
+
173
+ if attributes.key?(:'category_id')
174
+ self.category_id = attributes[:'category_id']
175
+ end
176
+
177
+ if attributes.key?(:'memo')
178
+ self.memo = attributes[:'memo']
179
+ end
180
+
181
+ if attributes.key?(:'cleared')
182
+ self.cleared = attributes[:'cleared']
183
+ end
184
+
185
+ if attributes.key?(:'approved')
186
+ self.approved = attributes[:'approved']
187
+ end
188
+
189
+ if attributes.key?(:'flag_color')
190
+ self.flag_color = attributes[:'flag_color']
191
+ end
192
+
193
+ if attributes.key?(:'subtransactions')
194
+ if (value = attributes[:'subtransactions']).is_a?(Array)
195
+ self.subtransactions = value
196
+ end
197
+ end
198
+
199
+ if attributes.key?(:'id')
200
+ self.id = attributes[:'id']
201
+ end
202
+
203
+ if attributes.key?(:'import_id')
204
+ self.import_id = attributes[:'import_id']
205
+ end
206
+ end
207
+
208
+ # Show invalid properties with the reasons. Usually used together with valid?
209
+ # @return Array for valid properties with the reasons
210
+ def list_invalid_properties
211
+ invalid_properties = Array.new
212
+ invalid_properties
213
+ end
214
+
215
+ # Check to see if the all the properties in the model are valid
216
+ # @return true if the model is valid
217
+ def valid?
218
+ return false if !@payee_name.nil? && @payee_name.to_s.length > 50
219
+ return false if !@memo.nil? && @memo.to_s.length > 200
220
+ return false if !@import_id.nil? && @import_id.to_s.length > 36
221
+ true
222
+ end
223
+
224
+ # Custom attribute writer method with validation
225
+ # @param [Object] payee_name Value to be assigned
226
+ def payee_name=(payee_name)
227
+ @payee_name = payee_name
228
+ end
229
+
230
+ # Custom attribute writer method with validation
231
+ # @param [Object] memo Value to be assigned
232
+ def memo=(memo)
233
+ @memo = memo
234
+ end
235
+
236
+ # Custom attribute writer method with validation
237
+ # @param [Object] import_id Value to be assigned
238
+ def import_id=(import_id)
239
+ @import_id = import_id
240
+ end
241
+
242
+ # Checks equality by comparing each attribute.
243
+ # @param [Object] Object to be compared
244
+ def ==(o)
245
+ return true if self.equal?(o)
246
+ self.class == o.class &&
247
+ account_id == o.account_id &&
248
+ date == o.date &&
249
+ amount == o.amount &&
250
+ payee_id == o.payee_id &&
251
+ payee_name == o.payee_name &&
252
+ category_id == o.category_id &&
253
+ memo == o.memo &&
254
+ cleared == o.cleared &&
255
+ approved == o.approved &&
256
+ flag_color == o.flag_color &&
257
+ subtransactions == o.subtransactions &&
258
+ id == o.id &&
259
+ import_id == o.import_id
260
+ end
261
+
262
+ # @see the `==` method
263
+ # @param [Object] Object to be compared
264
+ def eql?(o)
265
+ self == o
266
+ end
267
+
268
+ # Calculates hash code according to all attributes.
269
+ # @return [Integer] Hash code
270
+ def hash
271
+ [account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, subtransactions, id, import_id].hash
272
+ end
273
+
274
+ # Builds the object from hash
275
+ # @param [Hash] attributes Model attributes in the form of hash
276
+ # @return [Object] Returns the model itself
277
+ def self.build_from_hash(attributes)
278
+ return nil unless attributes.is_a?(Hash)
279
+ attributes = attributes.transform_keys(&:to_sym)
280
+ transformed_hash = {}
281
+ openapi_types.each_pair do |key, type|
282
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
283
+ transformed_hash["#{key}"] = nil
284
+ elsif type =~ /\AArray<(.*)>/i
285
+ # check to ensure the input is an array given that the attribute
286
+ # is documented as an array but the input is not
287
+ if attributes[attribute_map[key]].is_a?(Array)
288
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
289
+ end
290
+ elsif !attributes[attribute_map[key]].nil?
291
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
292
+ end
293
+ end
294
+ new(transformed_hash)
295
+ end
296
+
297
+ # Deserializes the data based on type
298
+ # @param string type Data type
299
+ # @param string value Value to be deserialized
300
+ # @return [Object] Deserialized data
301
+ def self._deserialize(type, value)
302
+ case type.to_sym
303
+ when :Time
304
+ Time.parse(value)
305
+ when :Date
306
+ Date.parse(value)
307
+ when :String
308
+ value.to_s
309
+ when :Integer
310
+ value.to_i
311
+ when :Float
312
+ value.to_f
313
+ when :Boolean
314
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
315
+ true
316
+ else
317
+ false
318
+ end
319
+ when :Object
320
+ # generic object (usually a Hash), return directly
321
+ value
322
+ when /\AArray<(?<inner_type>.+)>\z/
323
+ inner_type = Regexp.last_match[:inner_type]
324
+ value.map { |v| _deserialize(inner_type, v) }
325
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
326
+ k_type = Regexp.last_match[:k_type]
327
+ v_type = Regexp.last_match[:v_type]
328
+ {}.tap do |hash|
329
+ value.each do |k, v|
330
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
331
+ end
332
+ end
333
+ else # model
334
+ # models (e.g. Pet) or oneOf
335
+ klass = YNAB.const_get(type)
336
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
337
+ end
338
+ end
339
+
340
+ # Returns the string representation of the object
341
+ # @return [String] String presentation of the object
342
+ def to_s
343
+ to_hash.to_s
344
+ end
345
+
346
+ # to_body is an alias to to_hash (backward compatibility)
347
+ # @return [Hash] Returns the object in the form of hash
348
+ def to_body
349
+ to_hash
350
+ end
351
+
352
+ # Returns the object in the form of hash
353
+ # @return [Hash] Returns the object in the form of hash
354
+ def to_hash
355
+ hash = {}
356
+ self.class.attribute_map.each_pair do |attr, param|
357
+ value = self.send(attr)
358
+ if value.nil?
359
+ is_nullable = self.class.openapi_nullable.include?(attr)
360
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
361
+ end
362
+
363
+ hash[param] = _to_hash(value)
364
+ end
365
+ hash
366
+ end
367
+
368
+ # Outputs non-array value in the form of hash
369
+ # For object, use to_hash. Otherwise, just return the value
370
+ # @param [Object] value Any valid value
371
+ # @return [Hash] Returns the value in the form of hash
372
+ def _to_hash(value)
373
+ if value.is_a?(Array)
374
+ value.compact.map { |v| _to_hash(v) }
375
+ elsif value.is_a?(Hash)
376
+ {}.tap do |hash|
377
+ value.each { |k, v| hash[k] = _to_hash(v) }
378
+ end
379
+ elsif value.respond_to? :to_hash
380
+ value.to_hash
381
+ else
382
+ value
383
+ end
384
+ end
385
+
386
+ end
387
+
388
+ 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
 
@@ -34,18 +34,13 @@ module YNAB
34
34
 
35
35
  attr_accessor :memo
36
36
 
37
- # The cleared status of the transaction
38
37
  attr_accessor :cleared
39
38
 
40
39
  # Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default.
41
40
  attr_accessor :approved
42
41
 
43
- # The transaction flag
44
42
  attr_accessor :flag_color
45
43
 
46
- # If specified, the new transaction will be assigned this `import_id` and considered \"imported\". We will also attempt to match this imported transaction to an existing \"user-entered\" transation on the same account, with the same amount, and with a date +/-10 days from the imported transaction date.<br><br>Transactions imported through File Based Import or Direct Import (not through the API) are assigned an import_id in the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. Using a consistent format will prevent duplicates through Direct Import and File Based Import.<br><br>If import_id is omitted or specified as null, the transaction will be treated as a \"user-entered\" transaction. As such, it will be eligible to be matched against transactions later being imported (via DI, FBI, or API).
47
- attr_accessor :import_id
48
-
49
44
  # An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
50
45
  attr_accessor :subtransactions
51
46
 
@@ -84,7 +79,6 @@ module YNAB
84
79
  :'cleared' => :'cleared',
85
80
  :'approved' => :'approved',
86
81
  :'flag_color' => :'flag_color',
87
- :'import_id' => :'import_id',
88
82
  :'subtransactions' => :'subtransactions'
89
83
  }
90
84
  end
@@ -104,10 +98,9 @@ module YNAB
104
98
  :'payee_name' => :'String',
105
99
  :'category_id' => :'String',
106
100
  :'memo' => :'String',
107
- :'cleared' => :'String',
101
+ :'cleared' => :'TransactionClearedStatus',
108
102
  :'approved' => :'Boolean',
109
- :'flag_color' => :'String',
110
- :'import_id' => :'String',
103
+ :'flag_color' => :'TransactionFlagColor',
111
104
  :'subtransactions' => :'Array<SaveSubTransaction>'
112
105
  }
113
106
  end
@@ -119,7 +112,7 @@ module YNAB
119
112
  :'payee_name',
120
113
  :'category_id',
121
114
  :'memo',
122
- :'import_id',
115
+ :'flag_color',
123
116
  ])
124
117
  end
125
118
 
@@ -178,10 +171,6 @@ module YNAB
178
171
  self.flag_color = attributes[:'flag_color']
179
172
  end
180
173
 
181
- if attributes.key?(:'import_id')
182
- self.import_id = attributes[:'import_id']
183
- end
184
-
185
174
  if attributes.key?(:'subtransactions')
186
175
  if (value = attributes[:'subtransactions']).is_a?(Array)
187
176
  self.subtransactions = value
@@ -201,11 +190,6 @@ module YNAB
201
190
  def valid?
202
191
  return false if !@payee_name.nil? && @payee_name.to_s.length > 50
203
192
  return false if !@memo.nil? && @memo.to_s.length > 200
204
- cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
205
- return false unless cleared_validator.valid?(@cleared)
206
- flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
207
- return false unless flag_color_validator.valid?(@flag_color)
208
- return false if !@import_id.nil? && @import_id.to_s.length > 36
209
193
  true
210
194
  end
211
195
 
@@ -221,24 +205,6 @@ module YNAB
221
205
  @memo = memo
222
206
  end
223
207
 
224
- # Custom attribute writer method checking allowed values (enum).
225
- # @param [Object] cleared Object to be assigned
226
- def cleared=(cleared)
227
- @cleared = cleared
228
- end
229
-
230
- # Custom attribute writer method checking allowed values (enum).
231
- # @param [Object] flag_color Object to be assigned
232
- def flag_color=(flag_color)
233
- @flag_color = flag_color
234
- end
235
-
236
- # Custom attribute writer method with validation
237
- # @param [Object] import_id Value to be assigned
238
- def import_id=(import_id)
239
- @import_id = import_id
240
- end
241
-
242
208
  # Checks equality by comparing each attribute.
243
209
  # @param [Object] Object to be compared
244
210
  def ==(o)
@@ -254,7 +220,6 @@ module YNAB
254
220
  cleared == o.cleared &&
255
221
  approved == o.approved &&
256
222
  flag_color == o.flag_color &&
257
- import_id == o.import_id &&
258
223
  subtransactions == o.subtransactions
259
224
  end
260
225
 
@@ -267,44 +232,37 @@ module YNAB
267
232
  # Calculates hash code according to all attributes.
268
233
  # @return [Integer] Hash code
269
234
  def hash
270
- [account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions].hash
235
+ [account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, subtransactions].hash
271
236
  end
272
237
 
273
238
  # Builds the object from hash
274
239
  # @param [Hash] attributes Model attributes in the form of hash
275
240
  # @return [Object] Returns the model itself
276
241
  def self.build_from_hash(attributes)
277
- new.build_from_hash(attributes)
278
- end
279
-
280
- # Builds the object from hash
281
- # @param [Hash] attributes Model attributes in the form of hash
282
- # @return [Object] Returns the model itself
283
- def build_from_hash(attributes)
284
242
  return nil unless attributes.is_a?(Hash)
285
243
  attributes = attributes.transform_keys(&:to_sym)
286
- self.class.openapi_types.each_pair do |key, type|
287
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
288
- self.send("#{key}=", nil)
244
+ transformed_hash = {}
245
+ openapi_types.each_pair do |key, type|
246
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
247
+ transformed_hash["#{key}"] = nil
289
248
  elsif type =~ /\AArray<(.*)>/i
290
249
  # check to ensure the input is an array given that the attribute
291
250
  # is documented as an array but the input is not
292
- if attributes[self.class.attribute_map[key]].is_a?(Array)
293
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
251
+ if attributes[attribute_map[key]].is_a?(Array)
252
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
294
253
  end
295
- elsif !attributes[self.class.attribute_map[key]].nil?
296
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
254
+ elsif !attributes[attribute_map[key]].nil?
255
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
297
256
  end
298
257
  end
299
-
300
- self
258
+ new(transformed_hash)
301
259
  end
302
260
 
303
261
  # Deserializes the data based on type
304
262
  # @param string type Data type
305
263
  # @param string value Value to be deserialized
306
264
  # @return [Object] Deserialized data
307
- def _deserialize(type, value)
265
+ def self._deserialize(type, value)
308
266
  case type.to_sym
309
267
  when :Time
310
268
  Time.parse(value)
@@ -339,7 +297,7 @@ module YNAB
339
297
  else # model
340
298
  # models (e.g. Pet) or oneOf
341
299
  klass = YNAB.const_get(type)
342
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
300
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
343
301
  end
344
302
  end
345
303
 
@@ -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