ynab 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/docs/Account.md +6 -0
  4. data/docs/AccountBase.md +25 -0
  5. data/docs/Category.md +14 -0
  6. data/docs/CategoryBase.md +33 -0
  7. data/docs/ExistingCategory.md +2 -1
  8. data/docs/HybridTransaction.md +2 -0
  9. data/docs/MoneyMovement.md +2 -0
  10. data/docs/MoneyMovementBase.md +16 -0
  11. data/docs/MonthDetail.md +8 -0
  12. data/docs/MonthDetailBase.md +16 -0
  13. data/docs/MonthSummary.md +8 -0
  14. data/docs/MonthSummaryBase.md +15 -0
  15. data/docs/NewCategory.md +2 -1
  16. data/docs/PayeesApi.md +21 -0
  17. data/docs/PlanDetail.md +7 -7
  18. data/docs/PostPayee.md +8 -0
  19. data/docs/PostPayeeWrapper.md +8 -0
  20. data/docs/SaveAccount.md +1 -1
  21. data/docs/SaveAccountType.md +7 -0
  22. data/docs/SaveCategory.md +2 -1
  23. data/docs/SavePayee.md +1 -1
  24. data/docs/ScheduledSubTransaction.md +2 -0
  25. data/docs/ScheduledSubTransactionBase.md +17 -0
  26. data/docs/ScheduledTransactionDetail.md +2 -0
  27. data/docs/ScheduledTransactionSummary.md +2 -0
  28. data/docs/ScheduledTransactionSummaryBase.md +20 -0
  29. data/docs/SubTransaction.md +2 -0
  30. data/docs/SubTransactionBase.md +18 -0
  31. data/docs/TransactionDetail.md +2 -0
  32. data/docs/TransactionSummary.md +2 -0
  33. data/docs/TransactionSummaryBase.md +26 -0
  34. data/lib/ynab/api/payees_api.rb +74 -0
  35. data/lib/ynab/models/account.rb +72 -8
  36. data/lib/ynab/models/account_base.rb +340 -0
  37. data/lib/ynab/models/category.rb +159 -20
  38. data/lib/ynab/models/category_base.rb +436 -0
  39. data/lib/ynab/models/existing_category.rb +15 -5
  40. data/lib/ynab/models/hybrid_transaction.rb +21 -1
  41. data/lib/ynab/models/money_movement.rb +31 -11
  42. data/lib/ynab/models/money_movement_base.rb +223 -0
  43. data/lib/ynab/models/month_detail.rb +81 -1
  44. data/lib/ynab/models/month_detail_base.rb +230 -0
  45. data/lib/ynab/models/month_summary.rb +91 -6
  46. data/lib/ynab/models/month_summary_base.rb +212 -0
  47. data/lib/ynab/models/new_category.rb +15 -5
  48. data/lib/ynab/models/plan_detail.rb +7 -7
  49. data/lib/ynab/models/post_payee.rb +148 -0
  50. data/lib/ynab/models/post_payee_wrapper.rb +136 -0
  51. data/lib/ynab/models/save_account.rb +1 -1
  52. data/lib/ynab/models/save_account_type.rb +45 -0
  53. data/lib/ynab/models/save_category.rb +17 -6
  54. data/lib/ynab/models/save_payee.rb +1 -1
  55. data/lib/ynab/models/scheduled_sub_transaction.rb +31 -10
  56. data/lib/ynab/models/scheduled_sub_transaction_base.rb +229 -0
  57. data/lib/ynab/models/scheduled_transaction_detail.rb +21 -1
  58. data/lib/ynab/models/scheduled_transaction_summary.rb +31 -9
  59. data/lib/ynab/models/scheduled_transaction_summary_base.rb +292 -0
  60. data/lib/ynab/models/sub_transaction.rb +31 -11
  61. data/lib/ynab/models/sub_transaction_base.rb +240 -0
  62. data/lib/ynab/models/transaction_detail.rb +21 -1
  63. data/lib/ynab/models/transaction_summary.rb +31 -14
  64. data/lib/ynab/models/transaction_summary_base.rb +358 -0
  65. data/lib/ynab/version.rb +1 -1
  66. data/lib/ynab.rb +12 -0
  67. data/open_api_spec.yaml +295 -21
  68. data/ynab.gemspec +1 -1
  69. metadata +27 -3
@@ -0,0 +1,358 @@
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
+ Generated by: OpenAPI Generator (https://openapi-generator.tech)
7
+
8
+ =end
9
+
10
+ require 'date'
11
+ require 'time'
12
+
13
+ module YNAB
14
+ class TransactionSummaryBase < ApiModelBase
15
+ attr_accessor :id
16
+
17
+ # The transaction date in ISO format (e.g. 2016-12-01)
18
+ attr_accessor :date
19
+
20
+ # The transaction amount in milliunits format
21
+ attr_accessor :amount
22
+
23
+ attr_accessor :memo
24
+
25
+ attr_accessor :cleared
26
+
27
+ # Whether or not the transaction is approved
28
+ attr_accessor :approved
29
+
30
+ attr_accessor :flag_color
31
+
32
+ # The customized name of a transaction flag
33
+ attr_accessor :flag_name
34
+
35
+ attr_accessor :account_id
36
+
37
+ attr_accessor :payee_id
38
+
39
+ attr_accessor :category_id
40
+
41
+ # If a transfer transaction, the account to which it transfers
42
+ attr_accessor :transfer_account_id
43
+
44
+ # If a transfer transaction, the id of transaction on the other side of the transfer
45
+ attr_accessor :transfer_transaction_id
46
+
47
+ # If transaction is matched, the id of the matched transaction
48
+ attr_accessor :matched_transaction_id
49
+
50
+ # If the transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have 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'.
51
+ attr_accessor :import_id
52
+
53
+ # If the transaction was imported, the payee name that was used when importing and before applying any payee rename rules
54
+ attr_accessor :import_payee_name
55
+
56
+ # If the transaction was imported, the original payee name as it appeared on the statement
57
+ attr_accessor :import_payee_name_original
58
+
59
+ # If the transaction is a debt/loan account transaction, the type of transaction
60
+ attr_accessor :debt_transaction_type
61
+
62
+ # Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.
63
+ attr_accessor :deleted
64
+
65
+ class EnumAttributeValidator
66
+ attr_reader :datatype
67
+ attr_reader :allowable_values
68
+
69
+ def initialize(datatype, allowable_values)
70
+ @allowable_values = allowable_values.map do |value|
71
+ case datatype.to_s
72
+ when /Integer/i
73
+ value.to_i
74
+ when /Float/i
75
+ value.to_f
76
+ else
77
+ value
78
+ end
79
+ end
80
+ end
81
+
82
+ def valid?(value)
83
+ !value || allowable_values.include?(value)
84
+ end
85
+ end
86
+
87
+ # Attribute mapping from ruby-style variable name to JSON key.
88
+ def self.attribute_map
89
+ {
90
+ :'id' => :'id',
91
+ :'date' => :'date',
92
+ :'amount' => :'amount',
93
+ :'memo' => :'memo',
94
+ :'cleared' => :'cleared',
95
+ :'approved' => :'approved',
96
+ :'flag_color' => :'flag_color',
97
+ :'flag_name' => :'flag_name',
98
+ :'account_id' => :'account_id',
99
+ :'payee_id' => :'payee_id',
100
+ :'category_id' => :'category_id',
101
+ :'transfer_account_id' => :'transfer_account_id',
102
+ :'transfer_transaction_id' => :'transfer_transaction_id',
103
+ :'matched_transaction_id' => :'matched_transaction_id',
104
+ :'import_id' => :'import_id',
105
+ :'import_payee_name' => :'import_payee_name',
106
+ :'import_payee_name_original' => :'import_payee_name_original',
107
+ :'debt_transaction_type' => :'debt_transaction_type',
108
+ :'deleted' => :'deleted'
109
+ }
110
+ end
111
+
112
+ # Returns all the JSON keys this model knows about
113
+ def self.acceptable_attributes
114
+ attribute_map.values
115
+ end
116
+
117
+ # Attribute type mapping.
118
+ def self.openapi_types
119
+ {
120
+ :'id' => :'String',
121
+ :'date' => :'Date',
122
+ :'amount' => :'Integer',
123
+ :'memo' => :'String',
124
+ :'cleared' => :'TransactionClearedStatus',
125
+ :'approved' => :'Boolean',
126
+ :'flag_color' => :'TransactionFlagColor',
127
+ :'flag_name' => :'String',
128
+ :'account_id' => :'String',
129
+ :'payee_id' => :'String',
130
+ :'category_id' => :'String',
131
+ :'transfer_account_id' => :'String',
132
+ :'transfer_transaction_id' => :'String',
133
+ :'matched_transaction_id' => :'String',
134
+ :'import_id' => :'String',
135
+ :'import_payee_name' => :'String',
136
+ :'import_payee_name_original' => :'String',
137
+ :'debt_transaction_type' => :'String',
138
+ :'deleted' => :'Boolean'
139
+ }
140
+ end
141
+
142
+ # List of attributes with nullable: true
143
+ def self.openapi_nullable
144
+ Set.new([
145
+ :'memo',
146
+ :'flag_color',
147
+ :'flag_name',
148
+ :'payee_id',
149
+ :'category_id',
150
+ :'transfer_account_id',
151
+ :'transfer_transaction_id',
152
+ :'matched_transaction_id',
153
+ :'import_id',
154
+ :'import_payee_name',
155
+ :'import_payee_name_original',
156
+ :'debt_transaction_type',
157
+ ])
158
+ end
159
+
160
+ # Initializes the object
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ def initialize(attributes = {})
163
+ if (!attributes.is_a?(Hash))
164
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::TransactionSummaryBase` initialize method"
165
+ end
166
+
167
+ # check to see if the attribute exists and convert string to symbol for hash key
168
+ attributes = attributes.each_with_object({}) { |(k, v), h|
169
+ if (!self.class.attribute_map.key?(k.to_sym))
170
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::TransactionSummaryBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
171
+ end
172
+ h[k.to_sym] = v
173
+ }
174
+
175
+ if attributes.key?(:'id')
176
+ self.id = attributes[:'id']
177
+ end
178
+
179
+ if attributes.key?(:'date')
180
+ self.date = attributes[:'date']
181
+ end
182
+
183
+ if attributes.key?(:'amount')
184
+ self.amount = attributes[:'amount']
185
+ end
186
+
187
+ if attributes.key?(:'memo')
188
+ self.memo = attributes[:'memo']
189
+ end
190
+
191
+ if attributes.key?(:'cleared')
192
+ self.cleared = attributes[:'cleared']
193
+ end
194
+
195
+ if attributes.key?(:'approved')
196
+ self.approved = attributes[:'approved']
197
+ end
198
+
199
+ if attributes.key?(:'flag_color')
200
+ self.flag_color = attributes[:'flag_color']
201
+ end
202
+
203
+ if attributes.key?(:'flag_name')
204
+ self.flag_name = attributes[:'flag_name']
205
+ end
206
+
207
+ if attributes.key?(:'account_id')
208
+ self.account_id = attributes[:'account_id']
209
+ end
210
+
211
+ if attributes.key?(:'payee_id')
212
+ self.payee_id = attributes[:'payee_id']
213
+ end
214
+
215
+ if attributes.key?(:'category_id')
216
+ self.category_id = attributes[:'category_id']
217
+ end
218
+
219
+ if attributes.key?(:'transfer_account_id')
220
+ self.transfer_account_id = attributes[:'transfer_account_id']
221
+ end
222
+
223
+ if attributes.key?(:'transfer_transaction_id')
224
+ self.transfer_transaction_id = attributes[:'transfer_transaction_id']
225
+ end
226
+
227
+ if attributes.key?(:'matched_transaction_id')
228
+ self.matched_transaction_id = attributes[:'matched_transaction_id']
229
+ end
230
+
231
+ if attributes.key?(:'import_id')
232
+ self.import_id = attributes[:'import_id']
233
+ end
234
+
235
+ if attributes.key?(:'import_payee_name')
236
+ self.import_payee_name = attributes[:'import_payee_name']
237
+ end
238
+
239
+ if attributes.key?(:'import_payee_name_original')
240
+ self.import_payee_name_original = attributes[:'import_payee_name_original']
241
+ end
242
+
243
+ if attributes.key?(:'debt_transaction_type')
244
+ self.debt_transaction_type = attributes[:'debt_transaction_type']
245
+ end
246
+
247
+ if attributes.key?(:'deleted')
248
+ self.deleted = attributes[:'deleted']
249
+ end
250
+ end
251
+
252
+ # Show invalid properties with the reasons. Usually used together with valid?
253
+ # @return Array for valid properties with the reasons
254
+ def list_invalid_properties
255
+ invalid_properties = Array.new
256
+ invalid_properties
257
+ end
258
+
259
+ # Check to see if the all the properties in the model are valid
260
+ # @return true if the model is valid
261
+ def valid?
262
+ return false if @id.nil?
263
+ return false if @date.nil?
264
+ return false if @amount.nil?
265
+ return false if @cleared.nil?
266
+ return false if @approved.nil?
267
+ return false if @account_id.nil?
268
+ debt_transaction_type_validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balanceAdjustment", "credit", "charge"])
269
+ return false unless debt_transaction_type_validator.valid?(@debt_transaction_type)
270
+ return false if @deleted.nil?
271
+ true
272
+ end
273
+
274
+ # Custom attribute writer method checking allowed values (enum).
275
+ # @param [Object] debt_transaction_type Object to be assigned
276
+ def debt_transaction_type=(debt_transaction_type)
277
+ @debt_transaction_type = debt_transaction_type
278
+ end
279
+
280
+ # Checks equality by comparing each attribute.
281
+ # @param [Object] Object to be compared
282
+ def ==(o)
283
+ return true if self.equal?(o)
284
+ self.class == o.class &&
285
+ id == o.id &&
286
+ date == o.date &&
287
+ amount == o.amount &&
288
+ memo == o.memo &&
289
+ cleared == o.cleared &&
290
+ approved == o.approved &&
291
+ flag_color == o.flag_color &&
292
+ flag_name == o.flag_name &&
293
+ account_id == o.account_id &&
294
+ payee_id == o.payee_id &&
295
+ category_id == o.category_id &&
296
+ transfer_account_id == o.transfer_account_id &&
297
+ transfer_transaction_id == o.transfer_transaction_id &&
298
+ matched_transaction_id == o.matched_transaction_id &&
299
+ import_id == o.import_id &&
300
+ import_payee_name == o.import_payee_name &&
301
+ import_payee_name_original == o.import_payee_name_original &&
302
+ debt_transaction_type == o.debt_transaction_type &&
303
+ deleted == o.deleted
304
+ end
305
+
306
+ # @see the `==` method
307
+ # @param [Object] Object to be compared
308
+ def eql?(o)
309
+ self == o
310
+ end
311
+
312
+ # Calculates hash code according to all attributes.
313
+ # @return [Integer] Hash code
314
+ def hash
315
+ [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].hash
316
+ end
317
+
318
+ # Builds the object from hash
319
+ # @param [Hash] attributes Model attributes in the form of hash
320
+ # @return [Object] Returns the model itself
321
+ def self.build_from_hash(attributes)
322
+ return nil unless attributes.is_a?(Hash)
323
+ attributes = attributes.transform_keys(&:to_sym)
324
+ transformed_hash = {}
325
+ openapi_types.each_pair do |key, type|
326
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
327
+ transformed_hash["#{key}"] = nil
328
+ elsif type =~ /\AArray<(.*)>/i
329
+ # check to ensure the input is an array given that the attribute
330
+ # is documented as an array but the input is not
331
+ if attributes[attribute_map[key]].is_a?(Array)
332
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
333
+ end
334
+ elsif !attributes[attribute_map[key]].nil?
335
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
336
+ end
337
+ end
338
+ new(transformed_hash)
339
+ end
340
+
341
+ # Returns the object in the form of hash
342
+ # @return [Hash] Returns the object in the form of hash
343
+ def to_hash
344
+ hash = {}
345
+ self.class.attribute_map.each_pair do |attr, param|
346
+ value = self.send(attr)
347
+ if value.nil?
348
+ is_nullable = self.class.openapi_nullable.include?(attr)
349
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
350
+ end
351
+
352
+ hash[param] = _to_hash(value)
353
+ end
354
+ hash
355
+ end
356
+ end
357
+
358
+ end
data/lib/ynab/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module YNAB
2
- VERSION = '5.0.0'
2
+ VERSION = '5.1.0'
3
3
  end
data/lib/ynab.rb CHANGED
@@ -15,6 +15,7 @@ require 'ynab/configuration'
15
15
  # Models
16
16
  require 'ynab/api_model_base'
17
17
  require 'ynab/models/account'
18
+ require 'ynab/models/account_base'
18
19
  require 'ynab/models/account_response'
19
20
  require 'ynab/models/account_response_data'
20
21
  require 'ynab/models/account_type'
@@ -27,6 +28,7 @@ require 'ynab/models/bulk_transactions'
27
28
  require 'ynab/models/categories_response'
28
29
  require 'ynab/models/categories_response_data'
29
30
  require 'ynab/models/category'
31
+ require 'ynab/models/category_base'
30
32
  require 'ynab/models/category_group'
31
33
  require 'ynab/models/category_group_with_categories'
32
34
  require 'ynab/models/category_response'
@@ -41,17 +43,20 @@ require 'ynab/models/hybrid_transaction'
41
43
  require 'ynab/models/hybrid_transactions_response'
42
44
  require 'ynab/models/hybrid_transactions_response_data'
43
45
  require 'ynab/models/money_movement'
46
+ require 'ynab/models/money_movement_base'
44
47
  require 'ynab/models/money_movement_group'
45
48
  require 'ynab/models/money_movement_groups_response'
46
49
  require 'ynab/models/money_movement_groups_response_data'
47
50
  require 'ynab/models/money_movements_response'
48
51
  require 'ynab/models/money_movements_response_data'
49
52
  require 'ynab/models/month_detail'
53
+ require 'ynab/models/month_detail_base'
50
54
  require 'ynab/models/month_detail_response'
51
55
  require 'ynab/models/month_detail_response_data'
52
56
  require 'ynab/models/month_summaries_response'
53
57
  require 'ynab/models/month_summaries_response_data'
54
58
  require 'ynab/models/month_summary'
59
+ require 'ynab/models/month_summary_base'
55
60
  require 'ynab/models/new_category'
56
61
  require 'ynab/models/new_transaction'
57
62
  require 'ynab/models/patch_category_group_wrapper'
@@ -81,11 +86,14 @@ require 'ynab/models/plan_summary_response_data'
81
86
  require 'ynab/models/post_account_wrapper'
82
87
  require 'ynab/models/post_category_group_wrapper'
83
88
  require 'ynab/models/post_category_wrapper'
89
+ require 'ynab/models/post_payee'
90
+ require 'ynab/models/post_payee_wrapper'
84
91
  require 'ynab/models/post_scheduled_transaction_wrapper'
85
92
  require 'ynab/models/post_transactions_wrapper'
86
93
  require 'ynab/models/put_scheduled_transaction_wrapper'
87
94
  require 'ynab/models/put_transaction_wrapper'
88
95
  require 'ynab/models/save_account'
96
+ require 'ynab/models/save_account_type'
89
97
  require 'ynab/models/save_category'
90
98
  require 'ynab/models/save_category_group'
91
99
  require 'ynab/models/save_category_group_response'
@@ -103,20 +111,24 @@ require 'ynab/models/save_transaction_with_optional_fields'
103
111
  require 'ynab/models/save_transactions_response'
104
112
  require 'ynab/models/save_transactions_response_data'
105
113
  require 'ynab/models/scheduled_sub_transaction'
114
+ require 'ynab/models/scheduled_sub_transaction_base'
106
115
  require 'ynab/models/scheduled_transaction_detail'
107
116
  require 'ynab/models/scheduled_transaction_frequency'
108
117
  require 'ynab/models/scheduled_transaction_response'
109
118
  require 'ynab/models/scheduled_transaction_response_data'
110
119
  require 'ynab/models/scheduled_transaction_summary'
120
+ require 'ynab/models/scheduled_transaction_summary_base'
111
121
  require 'ynab/models/scheduled_transactions_response'
112
122
  require 'ynab/models/scheduled_transactions_response_data'
113
123
  require 'ynab/models/sub_transaction'
124
+ require 'ynab/models/sub_transaction_base'
114
125
  require 'ynab/models/transaction_cleared_status'
115
126
  require 'ynab/models/transaction_detail'
116
127
  require 'ynab/models/transaction_flag_color'
117
128
  require 'ynab/models/transaction_response'
118
129
  require 'ynab/models/transaction_response_data'
119
130
  require 'ynab/models/transaction_summary'
131
+ require 'ynab/models/transaction_summary_base'
120
132
  require 'ynab/models/transactions_import_response'
121
133
  require 'ynab/models/transactions_import_response_data'
122
134
  require 'ynab/models/transactions_response'