ynab 1.13.0 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6da546079c4883af6fa184f17467ae41764277c936c9788457514c325558d15
4
- data.tar.gz: 8a68512c9bb8bca7616ad7900cfbce34d52b8e3daa942c6f233e5261c21d34a5
3
+ metadata.gz: dc50ba196fdd409a7569cd1fe7b2200d97f2dedc297b6205736c39c03ea7bed8
4
+ data.tar.gz: 9c37e8bbdd4f441081fa0deb5cd52c5c8ace84174137d03ab5453585dd90acb1
5
5
  SHA512:
6
- metadata.gz: b070d8f263a20e3c344266cc8a1881adabe9c0e800b8d879c29e359716d8456f5a51a37164dff748a12b87e8f394fbcad1cc1fd73d40f3bb0c37f014754c2a9f
7
- data.tar.gz: 261141d695e12bafab8523a928616153303bb32b5a65c506daa25e3876156ed2223c1c3a447121b26770b045b201ef37860b524cd727e684aa667ba6dfdc651e
6
+ metadata.gz: 6eb7e523ffd9daf2e2804064c58a2e15bae7eee3892a64b0cf0a36ab685524d9cd81bcb941d52641a0b0089b6192f49d62d01ab5514e6b26612b7ea335082a09
7
+ data.tar.gz: b867e688d20cab6bea63f792257244afb94bcce89455d620164d0dbde74076992a1a2479c66dde71ef161e081e9d6eb8350244ace5ff37cdb69ac6f171f01e22
@@ -82,6 +82,7 @@ require 'ynab/models/transaction_response_data'
82
82
  require 'ynab/models/transaction_summary'
83
83
  require 'ynab/models/transactions_response'
84
84
  require 'ynab/models/transactions_response_data'
85
+ require 'ynab/models/update_transactions_wrapper'
85
86
  require 'ynab/models/user'
86
87
  require 'ynab/models/user_response'
87
88
  require 'ynab/models/user_response_data'
@@ -91,6 +92,7 @@ require 'ynab/models/hybrid_transaction'
91
92
  require 'ynab/models/month_detail'
92
93
  require 'ynab/models/scheduled_transaction_detail'
93
94
  require 'ynab/models/transaction_detail'
95
+ require 'ynab/models/update_transaction'
94
96
 
95
97
  # APIs
96
98
  require 'ynab/api/accounts_api'
@@ -476,7 +476,7 @@ module YNAB
476
476
  # Update multiple transactions
477
477
  # Updates multiple transactions, by 'id' or 'import_id'.
478
478
  # @param budget_id The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget)
479
- # @param data The transactions to update. Optionally, transaction 'id' value(s) can be specified as null and an 'import_id' value can be provided which will allow transaction(s) to updated by their import_id.
479
+ # @param data The transactions to update. Each transaction must have either an 'id' or 'import_id' specified. If 'id' is specified as null an 'import_id' value can be provided which will allow transaction(s) to be updated by their import_id. If an id is specified, it will always be used for lookup.
480
480
  # @param [Hash] opts the optional parameters
481
481
  # @return [SaveTransactionsResponse]
482
482
  def update_transactions(budget_id, data, opts = {})
@@ -487,7 +487,7 @@ module YNAB
487
487
  # Update multiple transactions
488
488
  # Updates multiple transactions, by 'id' or 'import_id'.
489
489
  # @param budget_id The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget)
490
- # @param data The transactions to update. Optionally, transaction 'id' value(s) can be specified as null and an 'import_id' value can be provided which will allow transaction(s) to updated by their import_id.
490
+ # @param data The transactions to update. Each transaction must have either an 'id' or 'import_id' specified. If 'id' is specified as null an 'import_id' value can be provided which will allow transaction(s) to be updated by their import_id. If an id is specified, it will always be used for lookup.
491
491
  # @param [Hash] opts the optional parameters
492
492
  # @return [Array<(SaveTransactionsResponse, Fixnum, Hash)>] SaveTransactionsResponse data, response status code and response headers
493
493
  def update_transactions_with_http_info(budget_id, data, opts = {})
@@ -62,10 +62,6 @@ module YNAB
62
62
  invalid_properties.push('invalid value for "budgets", budgets cannot be nil.')
63
63
  end
64
64
 
65
- if @default_budget.nil?
66
- invalid_properties.push('invalid value for "default_budget", default_budget cannot be nil.')
67
- end
68
-
69
65
  invalid_properties
70
66
  end
71
67
 
@@ -73,7 +69,6 @@ module YNAB
73
69
  # @return true if the model is valid
74
70
  def valid?
75
71
  return false if @budgets.nil?
76
- return false if @default_budget.nil?
77
72
  true
78
73
  end
79
74
 
@@ -37,7 +37,7 @@ module YNAB
37
37
  # Balance in milliunits format
38
38
  attr_accessor :balance
39
39
 
40
- # The type of goal, if the cagegory has a goal (TB=Target Category Balance, TBD=Target Category Balance by Date, MF=Monthly Funding)
40
+ # The type of goal, if the category has a goal (TB=Target Category Balance, TBD=Target Category Balance by Date, MF=Monthly Funding)
41
41
  attr_accessor :goal_type
42
42
 
43
43
  # The month a goal was created
@@ -263,7 +263,7 @@ module YNAB
263
263
  return false if @activity.nil?
264
264
  return false if @balance.nil?
265
265
  return false if @goal_type.nil?
266
- goal_type_validator = EnumAttributeValidator.new('String', ['TB', 'TBD', 'MF'])
266
+ goal_type_validator = EnumAttributeValidator.new('String', ['TB', 'TBD', 'MF', 'NEED'])
267
267
  return false unless goal_type_validator.valid?(@goal_type)
268
268
  return false if @goal_creation_month.nil?
269
269
  return false if @goal_target.nil?
@@ -276,7 +276,7 @@ module YNAB
276
276
  # Custom attribute writer method checking allowed values (enum).
277
277
  # @param [Object] goal_type Object to be assigned
278
278
  def goal_type=(goal_type)
279
- validator = EnumAttributeValidator.new('String', ['TB', 'TBD', 'MF'])
279
+ validator = EnumAttributeValidator.new('String', ['TB', 'TBD', 'MF', 'NEED'])
280
280
  unless validator.valid?(goal_type)
281
281
  fail ArgumentError, 'invalid value for "goal_type", must be one of #{validator.allowable_values}.'
282
282
  end
@@ -57,7 +57,7 @@ module YNAB
57
57
  # Whether the hybrid transaction represents a regular transaction or a subtransaction
58
58
  attr_accessor :type
59
59
 
60
- # For subtransaction types, this is the id of the pararent transaction. For transaction types, this id will be always be null.
60
+ # For subtransaction types, this is the id of the parent transaction. For transaction types, this id will be always be null.
61
61
  attr_accessor :parent_transaction_id
62
62
 
63
63
  attr_accessor :account_name
@@ -245,10 +245,6 @@ module YNAB
245
245
  invalid_properties.push('invalid value for "amount", amount cannot be nil.')
246
246
  end
247
247
 
248
- if @memo.nil?
249
- invalid_properties.push('invalid value for "memo", memo cannot be nil.')
250
- end
251
-
252
248
  if @cleared.nil?
253
249
  invalid_properties.push('invalid value for "cleared", cleared cannot be nil.')
254
250
  end
@@ -257,38 +253,10 @@ module YNAB
257
253
  invalid_properties.push('invalid value for "approved", approved cannot be nil.')
258
254
  end
259
255
 
260
- if @flag_color.nil?
261
- invalid_properties.push('invalid value for "flag_color", flag_color cannot be nil.')
262
- end
263
-
264
256
  if @account_id.nil?
265
257
  invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
266
258
  end
267
259
 
268
- if @payee_id.nil?
269
- invalid_properties.push('invalid value for "payee_id", payee_id cannot be nil.')
270
- end
271
-
272
- if @category_id.nil?
273
- invalid_properties.push('invalid value for "category_id", category_id cannot be nil.')
274
- end
275
-
276
- if @transfer_account_id.nil?
277
- invalid_properties.push('invalid value for "transfer_account_id", transfer_account_id cannot be nil.')
278
- end
279
-
280
- if @transfer_transaction_id.nil?
281
- invalid_properties.push('invalid value for "transfer_transaction_id", transfer_transaction_id cannot be nil.')
282
- end
283
-
284
- if @matched_transaction_id.nil?
285
- invalid_properties.push('invalid value for "matched_transaction_id", matched_transaction_id cannot be nil.')
286
- end
287
-
288
- if @import_id.nil?
289
- invalid_properties.push('invalid value for "import_id", import_id cannot be nil.')
290
- end
291
-
292
260
  if @deleted.nil?
293
261
  invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
294
262
  end
@@ -297,22 +265,10 @@ module YNAB
297
265
  invalid_properties.push('invalid value for "type", type cannot be nil.')
298
266
  end
299
267
 
300
- if @parent_transaction_id.nil?
301
- invalid_properties.push('invalid value for "parent_transaction_id", parent_transaction_id cannot be nil.')
302
- end
303
-
304
268
  if @account_name.nil?
305
269
  invalid_properties.push('invalid value for "account_name", account_name cannot be nil.')
306
270
  end
307
271
 
308
- if @payee_name.nil?
309
- invalid_properties.push('invalid value for "payee_name", payee_name cannot be nil.')
310
- end
311
-
312
- if @category_name.nil?
313
- invalid_properties.push('invalid value for "category_name", category_name cannot be nil.')
314
- end
315
-
316
272
  invalid_properties
317
273
  end
318
274
 
@@ -322,29 +278,18 @@ module YNAB
322
278
  return false if @id.nil?
323
279
  return false if @date.nil?
324
280
  return false if @amount.nil?
325
- return false if @memo.nil?
326
281
  return false if @cleared.nil?
327
282
  cleared_validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
328
283
  return false unless cleared_validator.valid?(@cleared)
329
284
  return false if @approved.nil?
330
- return false if @flag_color.nil?
331
285
  flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
332
286
  return false unless flag_color_validator.valid?(@flag_color)
333
287
  return false if @account_id.nil?
334
- return false if @payee_id.nil?
335
- return false if @category_id.nil?
336
- return false if @transfer_account_id.nil?
337
- return false if @transfer_transaction_id.nil?
338
- return false if @matched_transaction_id.nil?
339
- return false if @import_id.nil?
340
288
  return false if @deleted.nil?
341
289
  return false if @type.nil?
342
290
  type_validator = EnumAttributeValidator.new('String', ['transaction', 'subtransaction'])
343
291
  return false unless type_validator.valid?(@type)
344
- return false if @parent_transaction_id.nil?
345
292
  return false if @account_name.nil?
346
- return false if @payee_name.nil?
347
- return false if @category_name.nil?
348
293
  true
349
294
  end
350
295
 
@@ -124,10 +124,6 @@ module YNAB
124
124
  invalid_properties.push('invalid value for "month", month cannot be nil.')
125
125
  end
126
126
 
127
- if @note.nil?
128
- invalid_properties.push('invalid value for "note", note cannot be nil.')
129
- end
130
-
131
127
  if @income.nil?
132
128
  invalid_properties.push('invalid value for "income", income cannot be nil.')
133
129
  end
@@ -144,10 +140,6 @@ module YNAB
144
140
  invalid_properties.push('invalid value for "to_be_budgeted", to_be_budgeted cannot be nil.')
145
141
  end
146
142
 
147
- if @age_of_money.nil?
148
- invalid_properties.push('invalid value for "age_of_money", age_of_money cannot be nil.')
149
- end
150
-
151
143
  if @deleted.nil?
152
144
  invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
153
145
  end
@@ -163,12 +155,10 @@ module YNAB
163
155
  # @return true if the model is valid
164
156
  def valid?
165
157
  return false if @month.nil?
166
- return false if @note.nil?
167
158
  return false if @income.nil?
168
159
  return false if @budgeted.nil?
169
160
  return false if @activity.nil?
170
161
  return false if @to_be_budgeted.nil?
171
- return false if @age_of_money.nil?
172
162
  return false if @deleted.nil?
173
163
  return false if @categories.nil?
174
164
  true
@@ -113,10 +113,6 @@ module YNAB
113
113
  invalid_properties.push('invalid value for "month", month cannot be nil.')
114
114
  end
115
115
 
116
- if @note.nil?
117
- invalid_properties.push('invalid value for "note", note cannot be nil.')
118
- end
119
-
120
116
  if @income.nil?
121
117
  invalid_properties.push('invalid value for "income", income cannot be nil.')
122
118
  end
@@ -133,10 +129,6 @@ module YNAB
133
129
  invalid_properties.push('invalid value for "to_be_budgeted", to_be_budgeted cannot be nil.')
134
130
  end
135
131
 
136
- if @age_of_money.nil?
137
- invalid_properties.push('invalid value for "age_of_money", age_of_money cannot be nil.')
138
- end
139
-
140
132
  if @deleted.nil?
141
133
  invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
142
134
  end
@@ -148,12 +140,10 @@ module YNAB
148
140
  # @return true if the model is valid
149
141
  def valid?
150
142
  return false if @month.nil?
151
- return false if @note.nil?
152
143
  return false if @income.nil?
153
144
  return false if @budgeted.nil?
154
145
  return false if @activity.nil?
155
146
  return false if @to_be_budgeted.nil?
156
- return false if @age_of_money.nil?
157
147
  return false if @deleted.nil?
158
148
  true
159
149
  end
@@ -81,10 +81,6 @@ module YNAB
81
81
  invalid_properties.push('invalid value for "name", name cannot be nil.')
82
82
  end
83
83
 
84
- if @transfer_account_id.nil?
85
- invalid_properties.push('invalid value for "transfer_account_id", transfer_account_id cannot be nil.')
86
- end
87
-
88
84
  if @deleted.nil?
89
85
  invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
90
86
  end
@@ -97,7 +93,6 @@ module YNAB
97
93
  def valid?
98
94
  return false if @id.nil?
99
95
  return false if @name.nil?
100
- return false if @transfer_account_id.nil?
101
96
  return false if @deleted.nil?
102
97
  true
103
98
  end
@@ -22,7 +22,7 @@ module YNAB
22
22
  # The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored.
23
23
  attr_accessor :amount
24
24
 
25
- # The payee for the transaction
25
+ # 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.
26
26
  attr_accessor :payee_id
27
27
 
28
28
  # 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.
@@ -42,7 +42,7 @@ module YNAB
42
42
  # The transaction flag
43
43
  attr_accessor :flag_color
44
44
 
45
- # If specified, the new transaction will be assigned this import_id and considered \"imported\". *At the time of import* we will attempt to match \"imported\" transactions with non-imported (i.e. \"user-entered\") transactions.<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).
45
+ # 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).
46
46
  attr_accessor :import_id
47
47
 
48
48
  class EnumAttributeValidator
@@ -118,22 +118,6 @@ module YNAB
118
118
  invalid_properties.push('invalid value for "amount", amount cannot be nil.')
119
119
  end
120
120
 
121
- if @memo.nil?
122
- invalid_properties.push('invalid value for "memo", memo cannot be nil.')
123
- end
124
-
125
- if @payee_id.nil?
126
- invalid_properties.push('invalid value for "payee_id", payee_id cannot be nil.')
127
- end
128
-
129
- if @category_id.nil?
130
- invalid_properties.push('invalid value for "category_id", category_id cannot be nil.')
131
- end
132
-
133
- if @transfer_account_id.nil?
134
- invalid_properties.push('invalid value for "transfer_account_id", transfer_account_id cannot be nil.')
135
- end
136
-
137
121
  if @deleted.nil?
138
122
  invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
139
123
  end
@@ -147,10 +131,6 @@ module YNAB
147
131
  return false if @id.nil?
148
132
  return false if @scheduled_transaction_id.nil?
149
133
  return false if @amount.nil?
150
- return false if @memo.nil?
151
- return false if @payee_id.nil?
152
- return false if @category_id.nil?
153
- return false if @transfer_account_id.nil?
154
134
  return false if @deleted.nil?
155
135
  true
156
136
  end
@@ -218,30 +218,10 @@ module YNAB
218
218
  invalid_properties.push('invalid value for "amount", amount cannot be nil.')
219
219
  end
220
220
 
221
- if @memo.nil?
222
- invalid_properties.push('invalid value for "memo", memo cannot be nil.')
223
- end
224
-
225
- if @flag_color.nil?
226
- invalid_properties.push('invalid value for "flag_color", flag_color cannot be nil.')
227
- end
228
-
229
221
  if @account_id.nil?
230
222
  invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
231
223
  end
232
224
 
233
- if @payee_id.nil?
234
- invalid_properties.push('invalid value for "payee_id", payee_id cannot be nil.')
235
- end
236
-
237
- if @category_id.nil?
238
- invalid_properties.push('invalid value for "category_id", category_id cannot be nil.')
239
- end
240
-
241
- if @transfer_account_id.nil?
242
- invalid_properties.push('invalid value for "transfer_account_id", transfer_account_id cannot be nil.')
243
- end
244
-
245
225
  if @deleted.nil?
246
226
  invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
247
227
  end
@@ -250,14 +230,6 @@ module YNAB
250
230
  invalid_properties.push('invalid value for "account_name", account_name cannot be nil.')
251
231
  end
252
232
 
253
- if @payee_name.nil?
254
- invalid_properties.push('invalid value for "payee_name", payee_name cannot be nil.')
255
- end
256
-
257
- if @category_name.nil?
258
- invalid_properties.push('invalid value for "category_name", category_name cannot be nil.')
259
- end
260
-
261
233
  if @subtransactions.nil?
262
234
  invalid_properties.push('invalid value for "subtransactions", subtransactions cannot be nil.')
263
235
  end
@@ -275,18 +247,11 @@ module YNAB
275
247
  frequency_validator = EnumAttributeValidator.new('String', ['never', 'daily', 'weekly', 'everyOtherWeek', 'twiceAMonth', 'every4Weeks', 'monthly', 'everyOtherMonth', 'every3Months', 'every4Months', 'twiceAYear', 'yearly', 'everyOtherYear'])
276
248
  return false unless frequency_validator.valid?(@frequency)
277
249
  return false if @amount.nil?
278
- return false if @memo.nil?
279
- return false if @flag_color.nil?
280
250
  flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
281
251
  return false unless flag_color_validator.valid?(@flag_color)
282
252
  return false if @account_id.nil?
283
- return false if @payee_id.nil?
284
- return false if @category_id.nil?
285
- return false if @transfer_account_id.nil?
286
253
  return false if @deleted.nil?
287
254
  return false if @account_name.nil?
288
- return false if @payee_name.nil?
289
- return false if @category_name.nil?
290
255
  return false if @subtransactions.nil?
291
256
  true
292
257
  end
@@ -183,30 +183,10 @@ module YNAB
183
183
  invalid_properties.push('invalid value for "amount", amount cannot be nil.')
184
184
  end
185
185
 
186
- if @memo.nil?
187
- invalid_properties.push('invalid value for "memo", memo cannot be nil.')
188
- end
189
-
190
- if @flag_color.nil?
191
- invalid_properties.push('invalid value for "flag_color", flag_color cannot be nil.')
192
- end
193
-
194
186
  if @account_id.nil?
195
187
  invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
196
188
  end
197
189
 
198
- if @payee_id.nil?
199
- invalid_properties.push('invalid value for "payee_id", payee_id cannot be nil.')
200
- end
201
-
202
- if @category_id.nil?
203
- invalid_properties.push('invalid value for "category_id", category_id cannot be nil.')
204
- end
205
-
206
- if @transfer_account_id.nil?
207
- invalid_properties.push('invalid value for "transfer_account_id", transfer_account_id cannot be nil.')
208
- end
209
-
210
190
  if @deleted.nil?
211
191
  invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
212
192
  end
@@ -224,14 +204,9 @@ module YNAB
224
204
  frequency_validator = EnumAttributeValidator.new('String', ['never', 'daily', 'weekly', 'everyOtherWeek', 'twiceAMonth', 'every4Weeks', 'monthly', 'everyOtherMonth', 'every3Months', 'every4Months', 'twiceAYear', 'yearly', 'everyOtherYear'])
225
205
  return false unless frequency_validator.valid?(@frequency)
226
206
  return false if @amount.nil?
227
- return false if @memo.nil?
228
- return false if @flag_color.nil?
229
207
  flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
230
208
  return false unless flag_color_validator.valid?(@flag_color)
231
209
  return false if @account_id.nil?
232
- return false if @payee_id.nil?
233
- return false if @category_id.nil?
234
- return false if @transfer_account_id.nil?
235
210
  return false if @deleted.nil?
236
211
  true
237
212
  end
@@ -118,22 +118,6 @@ module YNAB
118
118
  invalid_properties.push('invalid value for "amount", amount cannot be nil.')
119
119
  end
120
120
 
121
- if @memo.nil?
122
- invalid_properties.push('invalid value for "memo", memo cannot be nil.')
123
- end
124
-
125
- if @payee_id.nil?
126
- invalid_properties.push('invalid value for "payee_id", payee_id cannot be nil.')
127
- end
128
-
129
- if @category_id.nil?
130
- invalid_properties.push('invalid value for "category_id", category_id cannot be nil.')
131
- end
132
-
133
- if @transfer_account_id.nil?
134
- invalid_properties.push('invalid value for "transfer_account_id", transfer_account_id cannot be nil.')
135
- end
136
-
137
121
  if @deleted.nil?
138
122
  invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
139
123
  end
@@ -147,10 +131,6 @@ module YNAB
147
131
  return false if @id.nil?
148
132
  return false if @transaction_id.nil?
149
133
  return false if @amount.nil?
150
- return false if @memo.nil?
151
- return false if @payee_id.nil?
152
- return false if @category_id.nil?
153
- return false if @transfer_account_id.nil?
154
134
  return false if @deleted.nil?
155
135
  true
156
136
  end
@@ -238,10 +238,6 @@ module YNAB
238
238
  invalid_properties.push('invalid value for "amount", amount cannot be nil.')
239
239
  end
240
240
 
241
- if @memo.nil?
242
- invalid_properties.push('invalid value for "memo", memo cannot be nil.')
243
- end
244
-
245
241
  if @cleared.nil?
246
242
  invalid_properties.push('invalid value for "cleared", cleared cannot be nil.')
247
243
  end
@@ -250,38 +246,10 @@ module YNAB
250
246
  invalid_properties.push('invalid value for "approved", approved cannot be nil.')
251
247
  end
252
248
 
253
- if @flag_color.nil?
254
- invalid_properties.push('invalid value for "flag_color", flag_color cannot be nil.')
255
- end
256
-
257
249
  if @account_id.nil?
258
250
  invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
259
251
  end
260
252
 
261
- if @payee_id.nil?
262
- invalid_properties.push('invalid value for "payee_id", payee_id cannot be nil.')
263
- end
264
-
265
- if @category_id.nil?
266
- invalid_properties.push('invalid value for "category_id", category_id cannot be nil.')
267
- end
268
-
269
- if @transfer_account_id.nil?
270
- invalid_properties.push('invalid value for "transfer_account_id", transfer_account_id cannot be nil.')
271
- end
272
-
273
- if @transfer_transaction_id.nil?
274
- invalid_properties.push('invalid value for "transfer_transaction_id", transfer_transaction_id cannot be nil.')
275
- end
276
-
277
- if @matched_transaction_id.nil?
278
- invalid_properties.push('invalid value for "matched_transaction_id", matched_transaction_id cannot be nil.')
279
- end
280
-
281
- if @import_id.nil?
282
- invalid_properties.push('invalid value for "import_id", import_id cannot be nil.')
283
- end
284
-
285
253
  if @deleted.nil?
286
254
  invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
287
255
  end
@@ -290,14 +258,6 @@ module YNAB
290
258
  invalid_properties.push('invalid value for "account_name", account_name cannot be nil.')
291
259
  end
292
260
 
293
- if @payee_name.nil?
294
- invalid_properties.push('invalid value for "payee_name", payee_name cannot be nil.')
295
- end
296
-
297
- if @category_name.nil?
298
- invalid_properties.push('invalid value for "category_name", category_name cannot be nil.')
299
- end
300
-
301
261
  if @subtransactions.nil?
302
262
  invalid_properties.push('invalid value for "subtransactions", subtransactions cannot be nil.')
303
263
  end
@@ -311,25 +271,15 @@ module YNAB
311
271
  return false if @id.nil?
312
272
  return false if @date.nil?
313
273
  return false if @amount.nil?
314
- return false if @memo.nil?
315
274
  return false if @cleared.nil?
316
275
  cleared_validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
317
276
  return false unless cleared_validator.valid?(@cleared)
318
277
  return false if @approved.nil?
319
- return false if @flag_color.nil?
320
278
  flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
321
279
  return false unless flag_color_validator.valid?(@flag_color)
322
280
  return false if @account_id.nil?
323
- return false if @payee_id.nil?
324
- return false if @category_id.nil?
325
- return false if @transfer_account_id.nil?
326
- return false if @transfer_transaction_id.nil?
327
- return false if @matched_transaction_id.nil?
328
- return false if @import_id.nil?
329
281
  return false if @deleted.nil?
330
282
  return false if @account_name.nil?
331
- return false if @payee_name.nil?
332
- return false if @category_name.nil?
333
283
  return false if @subtransactions.nil?
334
284
  true
335
285
  end
@@ -203,10 +203,6 @@ module YNAB
203
203
  invalid_properties.push('invalid value for "amount", amount cannot be nil.')
204
204
  end
205
205
 
206
- if @memo.nil?
207
- invalid_properties.push('invalid value for "memo", memo cannot be nil.')
208
- end
209
-
210
206
  if @cleared.nil?
211
207
  invalid_properties.push('invalid value for "cleared", cleared cannot be nil.')
212
208
  end
@@ -215,38 +211,10 @@ module YNAB
215
211
  invalid_properties.push('invalid value for "approved", approved cannot be nil.')
216
212
  end
217
213
 
218
- if @flag_color.nil?
219
- invalid_properties.push('invalid value for "flag_color", flag_color cannot be nil.')
220
- end
221
-
222
214
  if @account_id.nil?
223
215
  invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
224
216
  end
225
217
 
226
- if @payee_id.nil?
227
- invalid_properties.push('invalid value for "payee_id", payee_id cannot be nil.')
228
- end
229
-
230
- if @category_id.nil?
231
- invalid_properties.push('invalid value for "category_id", category_id cannot be nil.')
232
- end
233
-
234
- if @transfer_account_id.nil?
235
- invalid_properties.push('invalid value for "transfer_account_id", transfer_account_id cannot be nil.')
236
- end
237
-
238
- if @transfer_transaction_id.nil?
239
- invalid_properties.push('invalid value for "transfer_transaction_id", transfer_transaction_id cannot be nil.')
240
- end
241
-
242
- if @matched_transaction_id.nil?
243
- invalid_properties.push('invalid value for "matched_transaction_id", matched_transaction_id cannot be nil.')
244
- end
245
-
246
- if @import_id.nil?
247
- invalid_properties.push('invalid value for "import_id", import_id cannot be nil.')
248
- end
249
-
250
218
  if @deleted.nil?
251
219
  invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
252
220
  end
@@ -260,21 +228,13 @@ module YNAB
260
228
  return false if @id.nil?
261
229
  return false if @date.nil?
262
230
  return false if @amount.nil?
263
- return false if @memo.nil?
264
231
  return false if @cleared.nil?
265
232
  cleared_validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
266
233
  return false unless cleared_validator.valid?(@cleared)
267
234
  return false if @approved.nil?
268
- return false if @flag_color.nil?
269
235
  flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
270
236
  return false unless flag_color_validator.valid?(@flag_color)
271
237
  return false if @account_id.nil?
272
- return false if @payee_id.nil?
273
- return false if @category_id.nil?
274
- return false if @transfer_account_id.nil?
275
- return false if @transfer_transaction_id.nil?
276
- return false if @matched_transaction_id.nil?
277
- return false if @import_id.nil?
278
238
  return false if @deleted.nil?
279
239
  true
280
240
  end
@@ -0,0 +1,402 @@
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.youneedabudget.com
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module YNAB
16
+ class UpdateTransaction
17
+ attr_accessor :account_id
18
+
19
+ # 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.
20
+ attr_accessor :date
21
+
22
+ # The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored.
23
+ attr_accessor :amount
24
+
25
+ # 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.
26
+ attr_accessor :payee_id
27
+
28
+ # 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.
29
+ attr_accessor :payee_name
30
+
31
+ # The category for the transaction. Split and Credit Card Payment categories are not permitted and will be ignored if supplied. If an existing transaction has a Split category it cannot be changed.
32
+ attr_accessor :category_id
33
+
34
+ attr_accessor :memo
35
+
36
+ # The cleared status of the transaction
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
+ # The transaction flag
43
+ attr_accessor :flag_color
44
+
45
+ # 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).
46
+ attr_accessor :import_id
47
+
48
+ attr_accessor :id
49
+
50
+ class EnumAttributeValidator
51
+ attr_reader :datatype
52
+ attr_reader :allowable_values
53
+
54
+ def initialize(datatype, allowable_values)
55
+ @allowable_values = allowable_values.map do |value|
56
+ case datatype.to_s
57
+ when /Integer/i
58
+ value.to_i
59
+ when /Float/i
60
+ value.to_f
61
+ else
62
+ value
63
+ end
64
+ end
65
+ end
66
+
67
+ def valid?(value)
68
+ !value || allowable_values.include?(value)
69
+ end
70
+ end
71
+
72
+ # Attribute mapping from ruby-style variable name to JSON key.
73
+ def self.attribute_map
74
+ {
75
+ :'account_id' => :'account_id',
76
+ :'date' => :'date',
77
+ :'amount' => :'amount',
78
+ :'payee_id' => :'payee_id',
79
+ :'payee_name' => :'payee_name',
80
+ :'category_id' => :'category_id',
81
+ :'memo' => :'memo',
82
+ :'cleared' => :'cleared',
83
+ :'approved' => :'approved',
84
+ :'flag_color' => :'flag_color',
85
+ :'import_id' => :'import_id',
86
+ :'id' => :'id'
87
+ }
88
+ end
89
+
90
+ # Attribute type mapping.
91
+ def self.swagger_types
92
+ {
93
+ :'account_id' => :'String',
94
+ :'date' => :'Date',
95
+ :'amount' => :'Integer',
96
+ :'payee_id' => :'String',
97
+ :'payee_name' => :'String',
98
+ :'category_id' => :'String',
99
+ :'memo' => :'String',
100
+ :'cleared' => :'String',
101
+ :'approved' => :'BOOLEAN',
102
+ :'flag_color' => :'String',
103
+ :'import_id' => :'String',
104
+ :'id' => :'String'
105
+ }
106
+ end
107
+
108
+ # Initializes the object
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ def initialize(attributes = {})
111
+ return unless attributes.is_a?(Hash)
112
+
113
+ # convert string to symbol for hash key
114
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
115
+
116
+ if attributes.has_key?(:'account_id')
117
+ self.account_id = attributes[:'account_id']
118
+ end
119
+
120
+ if attributes.has_key?(:'date')
121
+ self.date = attributes[:'date']
122
+ end
123
+
124
+ if attributes.has_key?(:'amount')
125
+ self.amount = attributes[:'amount']
126
+ end
127
+
128
+ if attributes.has_key?(:'payee_id')
129
+ self.payee_id = attributes[:'payee_id']
130
+ end
131
+
132
+ if attributes.has_key?(:'payee_name')
133
+ self.payee_name = attributes[:'payee_name']
134
+ end
135
+
136
+ if attributes.has_key?(:'category_id')
137
+ self.category_id = attributes[:'category_id']
138
+ end
139
+
140
+ if attributes.has_key?(:'memo')
141
+ self.memo = attributes[:'memo']
142
+ end
143
+
144
+ if attributes.has_key?(:'cleared')
145
+ self.cleared = attributes[:'cleared']
146
+ end
147
+
148
+ if attributes.has_key?(:'approved')
149
+ self.approved = attributes[:'approved']
150
+ end
151
+
152
+ if attributes.has_key?(:'flag_color')
153
+ self.flag_color = attributes[:'flag_color']
154
+ end
155
+
156
+ if attributes.has_key?(:'import_id')
157
+ self.import_id = attributes[:'import_id']
158
+ end
159
+
160
+ if attributes.has_key?(:'id')
161
+ self.id = attributes[:'id']
162
+ end
163
+ end
164
+
165
+ # Show invalid properties with the reasons. Usually used together with valid?
166
+ # @return Array for valid properties with the reasons
167
+ def list_invalid_properties
168
+ invalid_properties = Array.new
169
+ if @account_id.nil?
170
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
171
+ end
172
+
173
+ if @date.nil?
174
+ invalid_properties.push('invalid value for "date", date cannot be nil.')
175
+ end
176
+
177
+ if @amount.nil?
178
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
179
+ end
180
+
181
+ if !@payee_name.nil? && @payee_name.to_s.length > 50
182
+ invalid_properties.push('invalid value for "payee_name", the character length must be smaller than or equal to 50.')
183
+ end
184
+
185
+ if !@memo.nil? && @memo.to_s.length > 200
186
+ invalid_properties.push('invalid value for "memo", the character length must be smaller than or equal to 200.')
187
+ end
188
+
189
+ if !@import_id.nil? && @import_id.to_s.length > 36
190
+ invalid_properties.push('invalid value for "import_id", the character length must be smaller than or equal to 36.')
191
+ end
192
+
193
+ if @id.nil?
194
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
195
+ end
196
+
197
+ invalid_properties
198
+ end
199
+
200
+ # Check to see if the all the properties in the model are valid
201
+ # @return true if the model is valid
202
+ def valid?
203
+ return false if @account_id.nil?
204
+ return false if @date.nil?
205
+ return false if @amount.nil?
206
+ return false if !@payee_name.nil? && @payee_name.to_s.length > 50
207
+ return false if !@memo.nil? && @memo.to_s.length > 200
208
+ cleared_validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
209
+ return false unless cleared_validator.valid?(@cleared)
210
+ flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
211
+ return false unless flag_color_validator.valid?(@flag_color)
212
+ return false if !@import_id.nil? && @import_id.to_s.length > 36
213
+ return false if @id.nil?
214
+ true
215
+ end
216
+
217
+ # Custom attribute writer method with validation
218
+ # @param [Object] payee_name Value to be assigned
219
+ def payee_name=(payee_name)
220
+ if !payee_name.nil? && payee_name.to_s.length > 50
221
+ fail ArgumentError, 'invalid value for "payee_name", the character length must be smaller than or equal to 50.'
222
+ end
223
+
224
+ @payee_name = payee_name
225
+ end
226
+
227
+ # Custom attribute writer method with validation
228
+ # @param [Object] memo Value to be assigned
229
+ def memo=(memo)
230
+ if !memo.nil? && memo.to_s.length > 200
231
+ fail ArgumentError, 'invalid value for "memo", the character length must be smaller than or equal to 200.'
232
+ end
233
+
234
+ @memo = memo
235
+ end
236
+
237
+ # Custom attribute writer method checking allowed values (enum).
238
+ # @param [Object] cleared Object to be assigned
239
+ def cleared=(cleared)
240
+ validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
241
+ unless validator.valid?(cleared)
242
+ fail ArgumentError, 'invalid value for "cleared", must be one of #{validator.allowable_values}.'
243
+ end
244
+ @cleared = cleared
245
+ end
246
+
247
+ # Custom attribute writer method checking allowed values (enum).
248
+ # @param [Object] flag_color Object to be assigned
249
+ def flag_color=(flag_color)
250
+ validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
251
+ unless validator.valid?(flag_color)
252
+ fail ArgumentError, 'invalid value for "flag_color", must be one of #{validator.allowable_values}.'
253
+ end
254
+ @flag_color = flag_color
255
+ end
256
+
257
+ # Custom attribute writer method with validation
258
+ # @param [Object] import_id Value to be assigned
259
+ def import_id=(import_id)
260
+ if !import_id.nil? && import_id.to_s.length > 36
261
+ fail ArgumentError, 'invalid value for "import_id", the character length must be smaller than or equal to 36.'
262
+ end
263
+
264
+ @import_id = import_id
265
+ end
266
+
267
+ # Checks equality by comparing each attribute.
268
+ # @param [Object] Object to be compared
269
+ def ==(o)
270
+ return true if self.equal?(o)
271
+ self.class == o.class &&
272
+ account_id == o.account_id &&
273
+ date == o.date &&
274
+ amount == o.amount &&
275
+ payee_id == o.payee_id &&
276
+ payee_name == o.payee_name &&
277
+ category_id == o.category_id &&
278
+ memo == o.memo &&
279
+ cleared == o.cleared &&
280
+ approved == o.approved &&
281
+ flag_color == o.flag_color &&
282
+ import_id == o.import_id &&
283
+ id == o.id
284
+ end
285
+
286
+ # @see the `==` method
287
+ # @param [Object] Object to be compared
288
+ def eql?(o)
289
+ self == o
290
+ end
291
+
292
+ # Calculates hash code according to all attributes.
293
+ # @return [Fixnum] Hash code
294
+ def hash
295
+ [account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, id].hash
296
+ end
297
+
298
+ # Builds the object from hash
299
+ # @param [Hash] attributes Model attributes in the form of hash
300
+ # @return [Object] Returns the model itself
301
+ def build_from_hash(attributes)
302
+ return nil unless attributes.is_a?(Hash)
303
+ self.class.swagger_types.each_pair do |key, type|
304
+ if type =~ /\AArray<(.*)>/i
305
+ # check to ensure the input is an array given that the the attribute
306
+ # is documented as an array but the input is not
307
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
308
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
309
+ end
310
+ elsif !attributes[self.class.attribute_map[key]].nil?
311
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
312
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
313
+ end
314
+
315
+ self
316
+ end
317
+
318
+ # Deserializes the data based on type
319
+ # @param string type Data type
320
+ # @param string value Value to be deserialized
321
+ # @return [Object] Deserialized data
322
+ def _deserialize(type, value)
323
+ case type.to_sym
324
+ when :DateTime
325
+ DateTime.parse(value)
326
+ when :Date
327
+ Date.parse(value)
328
+ when :String
329
+ value.to_s
330
+ when :Integer
331
+ value.to_i
332
+ when :Float
333
+ value.to_f
334
+ when :BOOLEAN
335
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
336
+ true
337
+ else
338
+ false
339
+ end
340
+ when :Object
341
+ # generic object (usually a Hash), return directly
342
+ value
343
+ when /\AArray<(?<inner_type>.+)>\z/
344
+ inner_type = Regexp.last_match[:inner_type]
345
+ value.map { |v| _deserialize(inner_type, v) }
346
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
347
+ k_type = Regexp.last_match[:k_type]
348
+ v_type = Regexp.last_match[:v_type]
349
+ {}.tap do |hash|
350
+ value.each do |k, v|
351
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
352
+ end
353
+ end
354
+ else # model
355
+ temp_model = YNAB.const_get(type).new
356
+ temp_model.build_from_hash(value)
357
+ end
358
+ end
359
+
360
+ # Returns the string representation of the object
361
+ # @return [String] String presentation of the object
362
+ def to_s
363
+ to_hash.to_s
364
+ end
365
+
366
+ # to_body is an alias to to_hash (backward compatibility)
367
+ # @return [Hash] Returns the object in the form of hash
368
+ def to_body
369
+ to_hash
370
+ end
371
+
372
+ # Returns the object in the form of hash
373
+ # @return [Hash] Returns the object in the form of hash
374
+ def to_hash
375
+ hash = {}
376
+ self.class.attribute_map.each_pair do |attr, param|
377
+ value = self.send(attr)
378
+ next if value.nil?
379
+ hash[param] = _to_hash(value)
380
+ end
381
+ hash
382
+ end
383
+
384
+ # Outputs non-array value in the form of hash
385
+ # For object, use to_hash. Otherwise, just return the value
386
+ # @param [Object] value Any valid value
387
+ # @return [Hash] Returns the value in the form of hash
388
+ def _to_hash(value)
389
+ if value.is_a?(Array)
390
+ value.compact.map { |v| _to_hash(v) }
391
+ elsif value.is_a?(Hash)
392
+ {}.tap do |hash|
393
+ value.each { |k, v| hash[k] = _to_hash(v) }
394
+ end
395
+ elsif value.respond_to? :to_hash
396
+ value.to_hash
397
+ else
398
+ value
399
+ end
400
+ end
401
+ end
402
+ end
@@ -0,0 +1,190 @@
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.youneedabudget.com
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module YNAB
16
+ class UpdateTransactionsWrapper
17
+ attr_accessor :transactions
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'transactions' => :'transactions'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.swagger_types
28
+ {
29
+ :'transactions' => :'Array<UpdateTransaction>'
30
+ }
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ return unless attributes.is_a?(Hash)
37
+
38
+ # convert string to symbol for hash key
39
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
40
+
41
+ if attributes.has_key?(:'transactions')
42
+ if (value = attributes[:'transactions']).is_a?(Array)
43
+ self.transactions = value
44
+ end
45
+ end
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ if @transactions.nil?
53
+ invalid_properties.push('invalid value for "transactions", transactions cannot be nil.')
54
+ end
55
+
56
+ invalid_properties
57
+ end
58
+
59
+ # Check to see if the all the properties in the model are valid
60
+ # @return true if the model is valid
61
+ def valid?
62
+ return false if @transactions.nil?
63
+ true
64
+ end
65
+
66
+ # Checks equality by comparing each attribute.
67
+ # @param [Object] Object to be compared
68
+ def ==(o)
69
+ return true if self.equal?(o)
70
+ self.class == o.class &&
71
+ transactions == o.transactions
72
+ end
73
+
74
+ # @see the `==` method
75
+ # @param [Object] Object to be compared
76
+ def eql?(o)
77
+ self == o
78
+ end
79
+
80
+ # Calculates hash code according to all attributes.
81
+ # @return [Fixnum] Hash code
82
+ def hash
83
+ [transactions].hash
84
+ end
85
+
86
+ # Builds the object from hash
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ # @return [Object] Returns the model itself
89
+ def build_from_hash(attributes)
90
+ return nil unless attributes.is_a?(Hash)
91
+ self.class.swagger_types.each_pair do |key, type|
92
+ if type =~ /\AArray<(.*)>/i
93
+ # check to ensure the input is an array given that the the attribute
94
+ # is documented as an array but the input is not
95
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
96
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
97
+ end
98
+ elsif !attributes[self.class.attribute_map[key]].nil?
99
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
100
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
101
+ end
102
+
103
+ self
104
+ end
105
+
106
+ # Deserializes the data based on type
107
+ # @param string type Data type
108
+ # @param string value Value to be deserialized
109
+ # @return [Object] Deserialized data
110
+ def _deserialize(type, value)
111
+ case type.to_sym
112
+ when :DateTime
113
+ DateTime.parse(value)
114
+ when :Date
115
+ Date.parse(value)
116
+ when :String
117
+ value.to_s
118
+ when :Integer
119
+ value.to_i
120
+ when :Float
121
+ value.to_f
122
+ when :BOOLEAN
123
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
124
+ true
125
+ else
126
+ false
127
+ end
128
+ when :Object
129
+ # generic object (usually a Hash), return directly
130
+ value
131
+ when /\AArray<(?<inner_type>.+)>\z/
132
+ inner_type = Regexp.last_match[:inner_type]
133
+ value.map { |v| _deserialize(inner_type, v) }
134
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
135
+ k_type = Regexp.last_match[:k_type]
136
+ v_type = Regexp.last_match[:v_type]
137
+ {}.tap do |hash|
138
+ value.each do |k, v|
139
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
140
+ end
141
+ end
142
+ else # model
143
+ temp_model = YNAB.const_get(type).new
144
+ temp_model.build_from_hash(value)
145
+ end
146
+ end
147
+
148
+ # Returns the string representation of the object
149
+ # @return [String] String presentation of the object
150
+ def to_s
151
+ to_hash.to_s
152
+ end
153
+
154
+ # to_body is an alias to to_hash (backward compatibility)
155
+ # @return [Hash] Returns the object in the form of hash
156
+ def to_body
157
+ to_hash
158
+ end
159
+
160
+ # Returns the object in the form of hash
161
+ # @return [Hash] Returns the object in the form of hash
162
+ def to_hash
163
+ hash = {}
164
+ self.class.attribute_map.each_pair do |attr, param|
165
+ value = self.send(attr)
166
+ next if value.nil?
167
+ hash[param] = _to_hash(value)
168
+ end
169
+ hash
170
+ end
171
+
172
+ # Outputs non-array value in the form of hash
173
+ # For object, use to_hash. Otherwise, just return the value
174
+ # @param [Object] value Any valid value
175
+ # @return [Hash] Returns the value in the form of hash
176
+ def _to_hash(value)
177
+ if value.is_a?(Array)
178
+ value.compact.map { |v| _to_hash(v) }
179
+ elsif value.is_a?(Hash)
180
+ {}.tap do |hash|
181
+ value.each { |k, v| hash[k] = _to_hash(v) }
182
+ end
183
+ elsif value.respond_to? :to_hash
184
+ value.to_hash
185
+ else
186
+ value
187
+ end
188
+ end
189
+ end
190
+ end
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.4.0-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module YNAB
14
- VERSION = '1.13.0'
14
+ VERSION = '1.14.0'
15
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ynab
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - You Need A Budget, LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-06 00:00:00.000000000 Z
11
+ date: 2019-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -184,6 +184,8 @@ files:
184
184
  - lib/ynab/models/transaction_summary.rb
185
185
  - lib/ynab/models/transactions_response.rb
186
186
  - lib/ynab/models/transactions_response_data.rb
187
+ - lib/ynab/models/update_transaction.rb
188
+ - lib/ynab/models/update_transactions_wrapper.rb
187
189
  - lib/ynab/models/user.rb
188
190
  - lib/ynab/models/user_response.rb
189
191
  - lib/ynab/models/user_response_data.rb