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
@@ -59,6 +59,24 @@ module YNAB
59
59
  # Whether or not the account has been deleted. Deleted accounts will only be included in delta requests.
60
60
  attr_accessor :deleted
61
61
 
62
+ # The current available balance of the account formatted in the plan's currency format
63
+ attr_accessor :balance_formatted
64
+
65
+ # The current available balance of the account as a decimal currency amount
66
+ attr_accessor :balance_currency
67
+
68
+ # The current cleared balance of the account formatted in the plan's currency format
69
+ attr_accessor :cleared_balance_formatted
70
+
71
+ # The current cleared balance of the account as a decimal currency amount
72
+ attr_accessor :cleared_balance_currency
73
+
74
+ # The current uncleared balance of the account formatted in the plan's currency format
75
+ attr_accessor :uncleared_balance_formatted
76
+
77
+ # The current uncleared balance of the account as a decimal currency amount
78
+ attr_accessor :uncleared_balance_currency
79
+
62
80
  class EnumAttributeValidator
63
81
  attr_reader :datatype
64
82
  attr_reader :allowable_values
@@ -101,7 +119,13 @@ module YNAB
101
119
  :'debt_interest_rates' => :'debt_interest_rates',
102
120
  :'debt_minimum_payments' => :'debt_minimum_payments',
103
121
  :'debt_escrow_amounts' => :'debt_escrow_amounts',
104
- :'deleted' => :'deleted'
122
+ :'deleted' => :'deleted',
123
+ :'balance_formatted' => :'balance_formatted',
124
+ :'balance_currency' => :'balance_currency',
125
+ :'cleared_balance_formatted' => :'cleared_balance_formatted',
126
+ :'cleared_balance_currency' => :'cleared_balance_currency',
127
+ :'uncleared_balance_formatted' => :'uncleared_balance_formatted',
128
+ :'uncleared_balance_currency' => :'uncleared_balance_currency'
105
129
  }
106
130
  end
107
131
 
@@ -130,20 +154,29 @@ module YNAB
130
154
  :'debt_interest_rates' => :'Hash<String, Integer>',
131
155
  :'debt_minimum_payments' => :'Hash<String, Integer>',
132
156
  :'debt_escrow_amounts' => :'Hash<String, Integer>',
133
- :'deleted' => :'Boolean'
157
+ :'deleted' => :'Boolean',
158
+ :'balance_formatted' => :'String',
159
+ :'balance_currency' => :'Float',
160
+ :'cleared_balance_formatted' => :'String',
161
+ :'cleared_balance_currency' => :'Float',
162
+ :'uncleared_balance_formatted' => :'String',
163
+ :'uncleared_balance_currency' => :'Float'
134
164
  }
135
165
  end
136
166
 
137
167
  # List of attributes with nullable: true
138
168
  def self.openapi_nullable
139
169
  Set.new([
140
- :'note',
141
- :'transfer_payee_id',
142
- :'last_reconciled_at',
143
- :'debt_original_balance',
144
170
  ])
145
171
  end
146
172
 
173
+ # List of class defined in allOf (OpenAPI v3)
174
+ def self.openapi_all_of
175
+ [
176
+ :'AccountBase'
177
+ ]
178
+ end
179
+
147
180
  # Initializes the object
148
181
  # @param [Hash] attributes Model attributes in the form of hash
149
182
  def initialize(attributes = {})
@@ -236,6 +269,30 @@ module YNAB
236
269
  if attributes.key?(:'deleted')
237
270
  self.deleted = attributes[:'deleted']
238
271
  end
272
+
273
+ if attributes.key?(:'balance_formatted')
274
+ self.balance_formatted = attributes[:'balance_formatted']
275
+ end
276
+
277
+ if attributes.key?(:'balance_currency')
278
+ self.balance_currency = attributes[:'balance_currency']
279
+ end
280
+
281
+ if attributes.key?(:'cleared_balance_formatted')
282
+ self.cleared_balance_formatted = attributes[:'cleared_balance_formatted']
283
+ end
284
+
285
+ if attributes.key?(:'cleared_balance_currency')
286
+ self.cleared_balance_currency = attributes[:'cleared_balance_currency']
287
+ end
288
+
289
+ if attributes.key?(:'uncleared_balance_formatted')
290
+ self.uncleared_balance_formatted = attributes[:'uncleared_balance_formatted']
291
+ end
292
+
293
+ if attributes.key?(:'uncleared_balance_currency')
294
+ self.uncleared_balance_currency = attributes[:'uncleared_balance_currency']
295
+ end
239
296
  end
240
297
 
241
298
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -256,6 +313,7 @@ module YNAB
256
313
  return false if @balance.nil?
257
314
  return false if @cleared_balance.nil?
258
315
  return false if @uncleared_balance.nil?
316
+ return false if @transfer_payee_id.nil?
259
317
  return false if @deleted.nil?
260
318
  true
261
319
  end
@@ -282,7 +340,13 @@ module YNAB
282
340
  debt_interest_rates == o.debt_interest_rates &&
283
341
  debt_minimum_payments == o.debt_minimum_payments &&
284
342
  debt_escrow_amounts == o.debt_escrow_amounts &&
285
- deleted == o.deleted
343
+ deleted == o.deleted &&
344
+ balance_formatted == o.balance_formatted &&
345
+ balance_currency == o.balance_currency &&
346
+ cleared_balance_formatted == o.cleared_balance_formatted &&
347
+ cleared_balance_currency == o.cleared_balance_currency &&
348
+ uncleared_balance_formatted == o.uncleared_balance_formatted &&
349
+ uncleared_balance_currency == o.uncleared_balance_currency
286
350
  end
287
351
 
288
352
  # @see the `==` method
@@ -294,7 +358,7 @@ module YNAB
294
358
  # Calculates hash code according to all attributes.
295
359
  # @return [Integer] Hash code
296
360
  def hash
297
- [id, name, type, on_budget, closed, note, balance, cleared_balance, uncleared_balance, transfer_payee_id, direct_import_linked, direct_import_in_error, last_reconciled_at, debt_original_balance, debt_interest_rates, debt_minimum_payments, debt_escrow_amounts, deleted].hash
361
+ [id, name, type, on_budget, closed, note, balance, cleared_balance, uncleared_balance, transfer_payee_id, direct_import_linked, direct_import_in_error, last_reconciled_at, debt_original_balance, debt_interest_rates, debt_minimum_payments, debt_escrow_amounts, deleted, balance_formatted, balance_currency, cleared_balance_formatted, cleared_balance_currency, uncleared_balance_formatted, uncleared_balance_currency].hash
298
362
  end
299
363
 
300
364
  # Builds the object from hash
@@ -0,0 +1,340 @@
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 AccountBase < ApiModelBase
15
+ attr_accessor :id
16
+
17
+ attr_accessor :name
18
+
19
+ attr_accessor :type
20
+
21
+ # Whether this account is \"on budget\" or not
22
+ attr_accessor :on_budget
23
+
24
+ # Whether this account is closed or not
25
+ attr_accessor :closed
26
+
27
+ attr_accessor :note
28
+
29
+ # The current available balance of the account in milliunits format
30
+ attr_accessor :balance
31
+
32
+ # The current cleared balance of the account in milliunits format
33
+ attr_accessor :cleared_balance
34
+
35
+ # The current uncleared balance of the account in milliunits format
36
+ attr_accessor :uncleared_balance
37
+
38
+ # The payee id which should be used when transferring to this account
39
+ attr_accessor :transfer_payee_id
40
+
41
+ # Whether or not the account is linked to a financial institution for automatic transaction import.
42
+ attr_accessor :direct_import_linked
43
+
44
+ # If an account linked to a financial institution (direct_import_linked=true) and the linked connection is not in a healthy state, this will be true.
45
+ attr_accessor :direct_import_in_error
46
+
47
+ # A date/time specifying when the account was last reconciled.
48
+ attr_accessor :last_reconciled_at
49
+
50
+ # This field is deprecated and will always be null.
51
+ attr_accessor :debt_original_balance
52
+
53
+ attr_accessor :debt_interest_rates
54
+
55
+ attr_accessor :debt_minimum_payments
56
+
57
+ attr_accessor :debt_escrow_amounts
58
+
59
+ # Whether or not the account has been deleted. Deleted accounts will only be included in delta requests.
60
+ attr_accessor :deleted
61
+
62
+ class EnumAttributeValidator
63
+ attr_reader :datatype
64
+ attr_reader :allowable_values
65
+
66
+ def initialize(datatype, allowable_values)
67
+ @allowable_values = allowable_values.map do |value|
68
+ case datatype.to_s
69
+ when /Integer/i
70
+ value.to_i
71
+ when /Float/i
72
+ value.to_f
73
+ else
74
+ value
75
+ end
76
+ end
77
+ end
78
+
79
+ def valid?(value)
80
+ !value || allowable_values.include?(value)
81
+ end
82
+ end
83
+
84
+ # Attribute mapping from ruby-style variable name to JSON key.
85
+ def self.attribute_map
86
+ {
87
+ :'id' => :'id',
88
+ :'name' => :'name',
89
+ :'type' => :'type',
90
+ :'on_budget' => :'on_budget',
91
+ :'closed' => :'closed',
92
+ :'note' => :'note',
93
+ :'balance' => :'balance',
94
+ :'cleared_balance' => :'cleared_balance',
95
+ :'uncleared_balance' => :'uncleared_balance',
96
+ :'transfer_payee_id' => :'transfer_payee_id',
97
+ :'direct_import_linked' => :'direct_import_linked',
98
+ :'direct_import_in_error' => :'direct_import_in_error',
99
+ :'last_reconciled_at' => :'last_reconciled_at',
100
+ :'debt_original_balance' => :'debt_original_balance',
101
+ :'debt_interest_rates' => :'debt_interest_rates',
102
+ :'debt_minimum_payments' => :'debt_minimum_payments',
103
+ :'debt_escrow_amounts' => :'debt_escrow_amounts',
104
+ :'deleted' => :'deleted'
105
+ }
106
+ end
107
+
108
+ # Returns all the JSON keys this model knows about
109
+ def self.acceptable_attributes
110
+ attribute_map.values
111
+ end
112
+
113
+ # Attribute type mapping.
114
+ def self.openapi_types
115
+ {
116
+ :'id' => :'String',
117
+ :'name' => :'String',
118
+ :'type' => :'AccountType',
119
+ :'on_budget' => :'Boolean',
120
+ :'closed' => :'Boolean',
121
+ :'note' => :'String',
122
+ :'balance' => :'Integer',
123
+ :'cleared_balance' => :'Integer',
124
+ :'uncleared_balance' => :'Integer',
125
+ :'transfer_payee_id' => :'String',
126
+ :'direct_import_linked' => :'Boolean',
127
+ :'direct_import_in_error' => :'Boolean',
128
+ :'last_reconciled_at' => :'Time',
129
+ :'debt_original_balance' => :'Integer',
130
+ :'debt_interest_rates' => :'Hash<String, Integer>',
131
+ :'debt_minimum_payments' => :'Hash<String, Integer>',
132
+ :'debt_escrow_amounts' => :'Hash<String, Integer>',
133
+ :'deleted' => :'Boolean'
134
+ }
135
+ end
136
+
137
+ # List of attributes with nullable: true
138
+ def self.openapi_nullable
139
+ Set.new([
140
+ :'note',
141
+ :'transfer_payee_id',
142
+ :'last_reconciled_at',
143
+ :'debt_original_balance',
144
+ ])
145
+ end
146
+
147
+ # Initializes the object
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ def initialize(attributes = {})
150
+ if (!attributes.is_a?(Hash))
151
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::AccountBase` initialize method"
152
+ end
153
+
154
+ # check to see if the attribute exists and convert string to symbol for hash key
155
+ attributes = attributes.each_with_object({}) { |(k, v), h|
156
+ if (!self.class.attribute_map.key?(k.to_sym))
157
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::AccountBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
158
+ end
159
+ h[k.to_sym] = v
160
+ }
161
+
162
+ if attributes.key?(:'id')
163
+ self.id = attributes[:'id']
164
+ end
165
+
166
+ if attributes.key?(:'name')
167
+ self.name = attributes[:'name']
168
+ end
169
+
170
+ if attributes.key?(:'type')
171
+ self.type = attributes[:'type']
172
+ end
173
+
174
+ if attributes.key?(:'on_budget')
175
+ self.on_budget = attributes[:'on_budget']
176
+ end
177
+
178
+ if attributes.key?(:'closed')
179
+ self.closed = attributes[:'closed']
180
+ end
181
+
182
+ if attributes.key?(:'note')
183
+ self.note = attributes[:'note']
184
+ end
185
+
186
+ if attributes.key?(:'balance')
187
+ self.balance = attributes[:'balance']
188
+ end
189
+
190
+ if attributes.key?(:'cleared_balance')
191
+ self.cleared_balance = attributes[:'cleared_balance']
192
+ end
193
+
194
+ if attributes.key?(:'uncleared_balance')
195
+ self.uncleared_balance = attributes[:'uncleared_balance']
196
+ end
197
+
198
+ if attributes.key?(:'transfer_payee_id')
199
+ self.transfer_payee_id = attributes[:'transfer_payee_id']
200
+ end
201
+
202
+ if attributes.key?(:'direct_import_linked')
203
+ self.direct_import_linked = attributes[:'direct_import_linked']
204
+ end
205
+
206
+ if attributes.key?(:'direct_import_in_error')
207
+ self.direct_import_in_error = attributes[:'direct_import_in_error']
208
+ end
209
+
210
+ if attributes.key?(:'last_reconciled_at')
211
+ self.last_reconciled_at = attributes[:'last_reconciled_at']
212
+ end
213
+
214
+ if attributes.key?(:'debt_original_balance')
215
+ self.debt_original_balance = attributes[:'debt_original_balance']
216
+ end
217
+
218
+ if attributes.key?(:'debt_interest_rates')
219
+ if (value = attributes[:'debt_interest_rates']).is_a?(Hash)
220
+ self.debt_interest_rates = value
221
+ end
222
+ end
223
+
224
+ if attributes.key?(:'debt_minimum_payments')
225
+ if (value = attributes[:'debt_minimum_payments']).is_a?(Hash)
226
+ self.debt_minimum_payments = value
227
+ end
228
+ end
229
+
230
+ if attributes.key?(:'debt_escrow_amounts')
231
+ if (value = attributes[:'debt_escrow_amounts']).is_a?(Hash)
232
+ self.debt_escrow_amounts = value
233
+ end
234
+ end
235
+
236
+ if attributes.key?(:'deleted')
237
+ self.deleted = attributes[:'deleted']
238
+ end
239
+ end
240
+
241
+ # Show invalid properties with the reasons. Usually used together with valid?
242
+ # @return Array for valid properties with the reasons
243
+ def list_invalid_properties
244
+ invalid_properties = Array.new
245
+ invalid_properties
246
+ end
247
+
248
+ # Check to see if the all the properties in the model are valid
249
+ # @return true if the model is valid
250
+ def valid?
251
+ return false if @id.nil?
252
+ return false if @name.nil?
253
+ return false if @type.nil?
254
+ return false if @on_budget.nil?
255
+ return false if @closed.nil?
256
+ return false if @balance.nil?
257
+ return false if @cleared_balance.nil?
258
+ return false if @uncleared_balance.nil?
259
+ return false if @deleted.nil?
260
+ true
261
+ end
262
+
263
+ # Checks equality by comparing each attribute.
264
+ # @param [Object] Object to be compared
265
+ def ==(o)
266
+ return true if self.equal?(o)
267
+ self.class == o.class &&
268
+ id == o.id &&
269
+ name == o.name &&
270
+ type == o.type &&
271
+ on_budget == o.on_budget &&
272
+ closed == o.closed &&
273
+ note == o.note &&
274
+ balance == o.balance &&
275
+ cleared_balance == o.cleared_balance &&
276
+ uncleared_balance == o.uncleared_balance &&
277
+ transfer_payee_id == o.transfer_payee_id &&
278
+ direct_import_linked == o.direct_import_linked &&
279
+ direct_import_in_error == o.direct_import_in_error &&
280
+ last_reconciled_at == o.last_reconciled_at &&
281
+ debt_original_balance == o.debt_original_balance &&
282
+ debt_interest_rates == o.debt_interest_rates &&
283
+ debt_minimum_payments == o.debt_minimum_payments &&
284
+ debt_escrow_amounts == o.debt_escrow_amounts &&
285
+ deleted == o.deleted
286
+ end
287
+
288
+ # @see the `==` method
289
+ # @param [Object] Object to be compared
290
+ def eql?(o)
291
+ self == o
292
+ end
293
+
294
+ # Calculates hash code according to all attributes.
295
+ # @return [Integer] Hash code
296
+ def hash
297
+ [id, name, type, on_budget, closed, note, balance, cleared_balance, uncleared_balance, transfer_payee_id, direct_import_linked, direct_import_in_error, last_reconciled_at, debt_original_balance, debt_interest_rates, debt_minimum_payments, debt_escrow_amounts, deleted].hash
298
+ end
299
+
300
+ # Builds the object from hash
301
+ # @param [Hash] attributes Model attributes in the form of hash
302
+ # @return [Object] Returns the model itself
303
+ def self.build_from_hash(attributes)
304
+ return nil unless attributes.is_a?(Hash)
305
+ attributes = attributes.transform_keys(&:to_sym)
306
+ transformed_hash = {}
307
+ openapi_types.each_pair do |key, type|
308
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
309
+ transformed_hash["#{key}"] = nil
310
+ elsif type =~ /\AArray<(.*)>/i
311
+ # check to ensure the input is an array given that the attribute
312
+ # is documented as an array but the input is not
313
+ if attributes[attribute_map[key]].is_a?(Array)
314
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
315
+ end
316
+ elsif !attributes[attribute_map[key]].nil?
317
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
318
+ end
319
+ end
320
+ new(transformed_hash)
321
+ end
322
+
323
+ # Returns the object in the form of hash
324
+ # @return [Hash] Returns the object in the form of hash
325
+ def to_hash
326
+ hash = {}
327
+ self.class.attribute_map.each_pair do |attr, param|
328
+ value = self.send(attr)
329
+ if value.nil?
330
+ is_nullable = self.class.openapi_nullable.include?(attr)
331
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
332
+ end
333
+
334
+ hash[param] = _to_hash(value)
335
+ end
336
+ hash
337
+ end
338
+ end
339
+
340
+ end