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
@@ -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
@@ -193,18 +182,6 @@ module YNAB
193
182
  # @return Array for valid properties with the reasons
194
183
  def list_invalid_properties
195
184
  invalid_properties = Array.new
196
- if !@payee_name.nil? && @payee_name.to_s.length > 50
197
- invalid_properties.push('invalid value for "payee_name", the character length must be smaller than or equal to 50.')
198
- end
199
-
200
- if !@memo.nil? && @memo.to_s.length > 200
201
- invalid_properties.push('invalid value for "memo", the character length must be smaller than or equal to 200.')
202
- end
203
-
204
- if !@import_id.nil? && @import_id.to_s.length > 36
205
- invalid_properties.push('invalid value for "import_id", the character length must be smaller than or equal to 36.')
206
- end
207
-
208
185
  invalid_properties
209
186
  end
210
187
 
@@ -213,64 +190,21 @@ module YNAB
213
190
  def valid?
214
191
  return false if !@payee_name.nil? && @payee_name.to_s.length > 50
215
192
  return false if !@memo.nil? && @memo.to_s.length > 200
216
- cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
217
- return false unless cleared_validator.valid?(@cleared)
218
- flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
219
- return false unless flag_color_validator.valid?(@flag_color)
220
- return false if !@import_id.nil? && @import_id.to_s.length > 36
221
193
  true
222
194
  end
223
195
 
224
196
  # Custom attribute writer method with validation
225
197
  # @param [Object] payee_name Value to be assigned
226
198
  def payee_name=(payee_name)
227
- if !payee_name.nil? && payee_name.to_s.length > 50
228
- fail ArgumentError, 'invalid value for "payee_name", the character length must be smaller than or equal to 50.'
229
- end
230
-
231
199
  @payee_name = payee_name
232
200
  end
233
201
 
234
202
  # Custom attribute writer method with validation
235
203
  # @param [Object] memo Value to be assigned
236
204
  def memo=(memo)
237
- if !memo.nil? && memo.to_s.length > 200
238
- fail ArgumentError, 'invalid value for "memo", the character length must be smaller than or equal to 200.'
239
- end
240
-
241
205
  @memo = memo
242
206
  end
243
207
 
244
- # Custom attribute writer method checking allowed values (enum).
245
- # @param [Object] cleared Object to be assigned
246
- def cleared=(cleared)
247
- validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
248
- unless validator.valid?(cleared)
249
- fail ArgumentError, "invalid value for \"cleared\", must be one of #{validator.allowable_values}."
250
- end
251
- @cleared = cleared
252
- end
253
-
254
- # Custom attribute writer method checking allowed values (enum).
255
- # @param [Object] flag_color Object to be assigned
256
- def flag_color=(flag_color)
257
- validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
258
- unless validator.valid?(flag_color)
259
- fail ArgumentError, "invalid value for \"flag_color\", must be one of #{validator.allowable_values}."
260
- end
261
- @flag_color = flag_color
262
- end
263
-
264
- # Custom attribute writer method with validation
265
- # @param [Object] import_id Value to be assigned
266
- def import_id=(import_id)
267
- if !import_id.nil? && import_id.to_s.length > 36
268
- fail ArgumentError, 'invalid value for "import_id", the character length must be smaller than or equal to 36.'
269
- end
270
-
271
- @import_id = import_id
272
- end
273
-
274
208
  # Checks equality by comparing each attribute.
275
209
  # @param [Object] Object to be compared
276
210
  def ==(o)
@@ -286,7 +220,6 @@ module YNAB
286
220
  cleared == o.cleared &&
287
221
  approved == o.approved &&
288
222
  flag_color == o.flag_color &&
289
- import_id == o.import_id &&
290
223
  subtransactions == o.subtransactions
291
224
  end
292
225
 
@@ -299,44 +232,37 @@ module YNAB
299
232
  # Calculates hash code according to all attributes.
300
233
  # @return [Integer] Hash code
301
234
  def hash
302
- [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
303
236
  end
304
237
 
305
238
  # Builds the object from hash
306
239
  # @param [Hash] attributes Model attributes in the form of hash
307
240
  # @return [Object] Returns the model itself
308
241
  def self.build_from_hash(attributes)
309
- new.build_from_hash(attributes)
310
- end
311
-
312
- # Builds the object from hash
313
- # @param [Hash] attributes Model attributes in the form of hash
314
- # @return [Object] Returns the model itself
315
- def build_from_hash(attributes)
316
242
  return nil unless attributes.is_a?(Hash)
317
243
  attributes = attributes.transform_keys(&:to_sym)
318
- self.class.openapi_types.each_pair do |key, type|
319
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
320
- 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
321
248
  elsif type =~ /\AArray<(.*)>/i
322
249
  # check to ensure the input is an array given that the attribute
323
250
  # is documented as an array but the input is not
324
- if attributes[self.class.attribute_map[key]].is_a?(Array)
325
- 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) }
326
253
  end
327
- elsif !attributes[self.class.attribute_map[key]].nil?
328
- 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]])
329
256
  end
330
257
  end
331
-
332
- self
258
+ new(transformed_hash)
333
259
  end
334
260
 
335
261
  # Deserializes the data based on type
336
262
  # @param string type Data type
337
263
  # @param string value Value to be deserialized
338
264
  # @return [Object] Deserialized data
339
- def _deserialize(type, value)
265
+ def self._deserialize(type, value)
340
266
  case type.to_sym
341
267
  when :Time
342
268
  Time.parse(value)
@@ -371,7 +297,7 @@ module YNAB
371
297
  else # model
372
298
  # models (e.g. Pet) or oneOf
373
299
  klass = YNAB.const_get(type)
374
- 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)
375
301
  end
376
302
  end
377
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
 
@@ -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