ynab 1.13.0 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/lib/ynab.rb +6 -1
  4. data/lib/ynab/api/accounts_api.rb +3 -3
  5. data/lib/ynab/api/budgets_api.rb +6 -3
  6. data/lib/ynab/api/categories_api.rb +7 -7
  7. data/lib/ynab/api/deprecated_api.rb +1 -1
  8. data/lib/ynab/api/months_api.rb +3 -3
  9. data/lib/ynab/api/payee_locations_api.rb +1 -1
  10. data/lib/ynab/api/payees_api.rb +3 -3
  11. data/lib/ynab/api/scheduled_transactions_api.rb +3 -3
  12. data/lib/ynab/api/transactions_api.rb +77 -25
  13. data/lib/ynab/api/user_api.rb +1 -1
  14. data/lib/ynab/api_client.rb +3 -2
  15. data/lib/ynab/configuration.rb +2 -3
  16. data/lib/ynab/models/account.rb +3 -7
  17. data/lib/ynab/models/account_response.rb +3 -2
  18. data/lib/ynab/models/account_response_data.rb +3 -2
  19. data/lib/ynab/models/accounts_response.rb +3 -2
  20. data/lib/ynab/models/accounts_response_data.rb +3 -2
  21. data/lib/ynab/models/budget_detail.rb +3 -2
  22. data/lib/ynab/models/budget_detail_response.rb +3 -2
  23. data/lib/ynab/models/budget_detail_response_data.rb +3 -2
  24. data/lib/ynab/models/budget_settings.rb +3 -2
  25. data/lib/ynab/models/budget_settings_response.rb +3 -2
  26. data/lib/ynab/models/budget_settings_response_data.rb +3 -2
  27. data/lib/ynab/models/budget_summary.rb +19 -6
  28. data/lib/ynab/models/budget_summary_response.rb +3 -2
  29. data/lib/ynab/models/budget_summary_response_data.rb +3 -7
  30. data/lib/ynab/models/bulk_response.rb +3 -2
  31. data/lib/ynab/models/bulk_response_data.rb +3 -2
  32. data/lib/ynab/models/bulk_response_data_bulk.rb +4 -3
  33. data/lib/ynab/models/bulk_transactions.rb +3 -2
  34. data/lib/ynab/models/categories_response.rb +3 -2
  35. data/lib/ynab/models/categories_response_data.rb +3 -2
  36. data/lib/ynab/models/category.rb +7 -36
  37. data/lib/ynab/models/category_group.rb +3 -2
  38. data/lib/ynab/models/category_group_with_categories.rb +3 -2
  39. data/lib/ynab/models/category_response.rb +3 -2
  40. data/lib/ynab/models/category_response_data.rb +3 -2
  41. data/lib/ynab/models/currency_format.rb +3 -2
  42. data/lib/ynab/models/date_format.rb +3 -2
  43. data/lib/ynab/models/error_detail.rb +3 -2
  44. data/lib/ynab/models/error_response.rb +3 -2
  45. data/lib/ynab/models/hybrid_transaction.rb +4 -58
  46. data/lib/ynab/models/hybrid_transactions_response.rb +3 -2
  47. data/lib/ynab/models/hybrid_transactions_response_data.rb +3 -2
  48. data/lib/ynab/models/month_detail.rb +5 -14
  49. data/lib/ynab/models/month_detail_response.rb +3 -2
  50. data/lib/ynab/models/month_detail_response_data.rb +3 -2
  51. data/lib/ynab/models/month_summaries_response.rb +3 -2
  52. data/lib/ynab/models/month_summaries_response_data.rb +3 -2
  53. data/lib/ynab/models/month_summary.rb +5 -14
  54. data/lib/ynab/models/payee.rb +4 -8
  55. data/lib/ynab/models/payee_location.rb +3 -2
  56. data/lib/ynab/models/payee_location_response.rb +3 -2
  57. data/lib/ynab/models/payee_location_response_data.rb +3 -2
  58. data/lib/ynab/models/payee_locations_response.rb +3 -2
  59. data/lib/ynab/models/payee_locations_response_data.rb +3 -2
  60. data/lib/ynab/models/payee_response.rb +3 -2
  61. data/lib/ynab/models/payee_response_data.rb +3 -2
  62. data/lib/ynab/models/payees_response.rb +3 -2
  63. data/lib/ynab/models/payees_response_data.rb +3 -2
  64. data/lib/ynab/models/save_category_response.rb +3 -2
  65. data/lib/ynab/models/save_category_response_data.rb +3 -2
  66. data/lib/ynab/models/save_month_category.rb +3 -2
  67. data/lib/ynab/models/save_month_category_wrapper.rb +3 -2
  68. data/lib/ynab/models/save_sub_transaction.rb +259 -0
  69. data/lib/ynab/models/save_transaction.rb +23 -10
  70. data/lib/ynab/models/save_transaction_wrapper.rb +3 -2
  71. data/lib/ynab/models/save_transactions_response.rb +3 -2
  72. data/lib/ynab/models/save_transactions_response_data.rb +4 -3
  73. data/lib/ynab/models/save_transactions_wrapper.rb +3 -2
  74. data/lib/ynab/models/scheduled_sub_transaction.rb +3 -22
  75. data/lib/ynab/models/scheduled_transaction_detail.rb +3 -37
  76. data/lib/ynab/models/scheduled_transaction_response.rb +3 -2
  77. data/lib/ynab/models/scheduled_transaction_response_data.rb +3 -2
  78. data/lib/ynab/models/scheduled_transaction_summary.rb +3 -27
  79. data/lib/ynab/models/scheduled_transactions_response.rb +3 -2
  80. data/lib/ynab/models/scheduled_transactions_response_data.rb +3 -2
  81. data/lib/ynab/models/sub_transaction.rb +22 -23
  82. data/lib/ynab/models/transaction_detail.rb +3 -52
  83. data/lib/ynab/models/transaction_response.rb +3 -2
  84. data/lib/ynab/models/transaction_response_data.rb +3 -2
  85. data/lib/ynab/models/transaction_summary.rb +3 -42
  86. data/lib/ynab/models/transactions_import_response.rb +189 -0
  87. data/lib/ynab/models/transactions_import_response_data.rb +192 -0
  88. data/lib/ynab/models/transactions_response.rb +3 -2
  89. data/lib/ynab/models/transactions_response_data.rb +3 -2
  90. data/lib/ynab/models/update_transaction.rb +415 -0
  91. data/lib/ynab/models/update_transactions_wrapper.rb +191 -0
  92. data/lib/ynab/models/user.rb +3 -2
  93. data/lib/ynab/models/user_response.rb +3 -2
  94. data/lib/ynab/models/user_response_data.rb +3 -2
  95. data/lib/ynab/version.rb +1 -1
  96. data/spec/api/transactions_spec.rb +11 -0
  97. data/spec/fixtures/vcr_cassettes/import_transactions.yml +50 -0
  98. metadata +10 -3
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1.0.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.0-SNAPSHOT
9
+ Swagger Codegen version: 2.4.14
10
10
 
11
11
  =end
12
12
 
@@ -88,7 +88,7 @@ module YNAB
88
88
  return nil unless attributes.is_a?(Hash)
89
89
  self.class.swagger_types.each_pair do |key, type|
90
90
  if type =~ /\AArray<(.*)>/i
91
- # check to ensure the input is an array given that the the attribute
91
+ # check to ensure the input is an array given that the attribute
92
92
  # is documented as an array but the input is not
93
93
  if attributes[self.class.attribute_map[key]].is_a?(Array)
94
94
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -184,5 +184,6 @@ module YNAB
184
184
  value
185
185
  end
186
186
  end
187
+
187
188
  end
188
189
  end
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1.0.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.0-SNAPSHOT
9
+ Swagger Codegen version: 2.4.14
10
10
 
11
11
  =end
12
12
 
@@ -105,7 +105,7 @@ module YNAB
105
105
  return nil unless attributes.is_a?(Hash)
106
106
  self.class.swagger_types.each_pair do |key, type|
107
107
  if type =~ /\AArray<(.*)>/i
108
- # check to ensure the input is an array given that the the attribute
108
+ # check to ensure the input is an array given that the attribute
109
109
  # is documented as an array but the input is not
110
110
  if attributes[self.class.attribute_map[key]].is_a?(Array)
111
111
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -201,5 +201,6 @@ module YNAB
201
201
  value
202
202
  end
203
203
  end
204
+
204
205
  end
205
206
  end
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1.0.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.0-SNAPSHOT
9
+ Swagger Codegen version: 2.4.14
10
10
 
11
11
  =end
12
12
 
@@ -25,8 +25,12 @@ module YNAB
25
25
 
26
26
  attr_accessor :payee_id
27
27
 
28
+ attr_accessor :payee_name
29
+
28
30
  attr_accessor :category_id
29
31
 
32
+ attr_accessor :category_name
33
+
30
34
  # If a transfer, the account_id which the subtransaction transfers to
31
35
  attr_accessor :transfer_account_id
32
36
 
@@ -41,7 +45,9 @@ module YNAB
41
45
  :'amount' => :'amount',
42
46
  :'memo' => :'memo',
43
47
  :'payee_id' => :'payee_id',
48
+ :'payee_name' => :'payee_name',
44
49
  :'category_id' => :'category_id',
50
+ :'category_name' => :'category_name',
45
51
  :'transfer_account_id' => :'transfer_account_id',
46
52
  :'deleted' => :'deleted'
47
53
  }
@@ -55,7 +61,9 @@ module YNAB
55
61
  :'amount' => :'Integer',
56
62
  :'memo' => :'String',
57
63
  :'payee_id' => :'String',
64
+ :'payee_name' => :'String',
58
65
  :'category_id' => :'String',
66
+ :'category_name' => :'String',
59
67
  :'transfer_account_id' => :'String',
60
68
  :'deleted' => :'BOOLEAN'
61
69
  }
@@ -89,10 +97,18 @@ module YNAB
89
97
  self.payee_id = attributes[:'payee_id']
90
98
  end
91
99
 
100
+ if attributes.has_key?(:'payee_name')
101
+ self.payee_name = attributes[:'payee_name']
102
+ end
103
+
92
104
  if attributes.has_key?(:'category_id')
93
105
  self.category_id = attributes[:'category_id']
94
106
  end
95
107
 
108
+ if attributes.has_key?(:'category_name')
109
+ self.category_name = attributes[:'category_name']
110
+ end
111
+
96
112
  if attributes.has_key?(:'transfer_account_id')
97
113
  self.transfer_account_id = attributes[:'transfer_account_id']
98
114
  end
@@ -118,22 +134,6 @@ module YNAB
118
134
  invalid_properties.push('invalid value for "amount", amount cannot be nil.')
119
135
  end
120
136
 
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
137
  if @deleted.nil?
138
138
  invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
139
139
  end
@@ -147,10 +147,6 @@ module YNAB
147
147
  return false if @id.nil?
148
148
  return false if @transaction_id.nil?
149
149
  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
150
  return false if @deleted.nil?
155
151
  true
156
152
  end
@@ -165,7 +161,9 @@ module YNAB
165
161
  amount == o.amount &&
166
162
  memo == o.memo &&
167
163
  payee_id == o.payee_id &&
164
+ payee_name == o.payee_name &&
168
165
  category_id == o.category_id &&
166
+ category_name == o.category_name &&
169
167
  transfer_account_id == o.transfer_account_id &&
170
168
  deleted == o.deleted
171
169
  end
@@ -179,7 +177,7 @@ module YNAB
179
177
  # Calculates hash code according to all attributes.
180
178
  # @return [Fixnum] Hash code
181
179
  def hash
182
- [id, transaction_id, amount, memo, payee_id, category_id, transfer_account_id, deleted].hash
180
+ [id, transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, deleted].hash
183
181
  end
184
182
 
185
183
  # Builds the object from hash
@@ -189,7 +187,7 @@ module YNAB
189
187
  return nil unless attributes.is_a?(Hash)
190
188
  self.class.swagger_types.each_pair do |key, type|
191
189
  if type =~ /\AArray<(.*)>/i
192
- # check to ensure the input is an array given that the the attribute
190
+ # check to ensure the input is an array given that the attribute
193
191
  # is documented as an array but the input is not
194
192
  if attributes[self.class.attribute_map[key]].is_a?(Array)
195
193
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -285,5 +283,6 @@ module YNAB
285
283
  value
286
284
  end
287
285
  end
286
+
288
287
  end
289
288
  end
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1.0.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.0-SNAPSHOT
9
+ Swagger Codegen version: 2.4.14
10
10
 
11
11
  =end
12
12
 
@@ -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
@@ -399,7 +349,7 @@ module YNAB
399
349
  return nil unless attributes.is_a?(Hash)
400
350
  self.class.swagger_types.each_pair do |key, type|
401
351
  if type =~ /\AArray<(.*)>/i
402
- # check to ensure the input is an array given that the the attribute
352
+ # check to ensure the input is an array given that the attribute
403
353
  # is documented as an array but the input is not
404
354
  if attributes[self.class.attribute_map[key]].is_a?(Array)
405
355
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -495,5 +445,6 @@ module YNAB
495
445
  value
496
446
  end
497
447
  end
448
+
498
449
  end
499
450
  end
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1.0.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.0-SNAPSHOT
9
+ Swagger Codegen version: 2.4.14
10
10
 
11
11
  =end
12
12
 
@@ -88,7 +88,7 @@ module YNAB
88
88
  return nil unless attributes.is_a?(Hash)
89
89
  self.class.swagger_types.each_pair do |key, type|
90
90
  if type =~ /\AArray<(.*)>/i
91
- # check to ensure the input is an array given that the the attribute
91
+ # check to ensure the input is an array given that the attribute
92
92
  # is documented as an array but the input is not
93
93
  if attributes[self.class.attribute_map[key]].is_a?(Array)
94
94
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -184,5 +184,6 @@ module YNAB
184
184
  value
185
185
  end
186
186
  end
187
+
187
188
  end
188
189
  end
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1.0.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.0-SNAPSHOT
9
+ Swagger Codegen version: 2.4.14
10
10
 
11
11
  =end
12
12
 
@@ -88,7 +88,7 @@ module YNAB
88
88
  return nil unless attributes.is_a?(Hash)
89
89
  self.class.swagger_types.each_pair do |key, type|
90
90
  if type =~ /\AArray<(.*)>/i
91
- # check to ensure the input is an array given that the the attribute
91
+ # check to ensure the input is an array given that the attribute
92
92
  # is documented as an array but the input is not
93
93
  if attributes[self.class.attribute_map[key]].is_a?(Array)
94
94
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -184,5 +184,6 @@ module YNAB
184
184
  value
185
185
  end
186
186
  end
187
+
187
188
  end
188
189
  end
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1.0.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.0-SNAPSHOT
9
+ Swagger Codegen version: 2.4.14
10
10
 
11
11
  =end
12
12
 
@@ -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
@@ -340,7 +300,7 @@ module YNAB
340
300
  return nil unless attributes.is_a?(Hash)
341
301
  self.class.swagger_types.each_pair do |key, type|
342
302
  if type =~ /\AArray<(.*)>/i
343
- # check to ensure the input is an array given that the the attribute
303
+ # check to ensure the input is an array given that the attribute
344
304
  # is documented as an array but the input is not
345
305
  if attributes[self.class.attribute_map[key]].is_a?(Array)
346
306
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -436,5 +396,6 @@ module YNAB
436
396
  value
437
397
  end
438
398
  end
399
+
439
400
  end
440
401
  end
@@ -0,0 +1,189 @@
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.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module YNAB
16
+ class TransactionsImportResponse
17
+ attr_accessor :data
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'data' => :'data'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.swagger_types
28
+ {
29
+ :'data' => :'TransactionsImportResponseData'
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?(:'data')
42
+ self.data = attributes[:'data']
43
+ end
44
+ end
45
+
46
+ # Show invalid properties with the reasons. Usually used together with valid?
47
+ # @return Array for valid properties with the reasons
48
+ def list_invalid_properties
49
+ invalid_properties = Array.new
50
+ if @data.nil?
51
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
52
+ end
53
+
54
+ invalid_properties
55
+ end
56
+
57
+ # Check to see if the all the properties in the model are valid
58
+ # @return true if the model is valid
59
+ def valid?
60
+ return false if @data.nil?
61
+ true
62
+ end
63
+
64
+ # Checks equality by comparing each attribute.
65
+ # @param [Object] Object to be compared
66
+ def ==(o)
67
+ return true if self.equal?(o)
68
+ self.class == o.class &&
69
+ data == o.data
70
+ end
71
+
72
+ # @see the `==` method
73
+ # @param [Object] Object to be compared
74
+ def eql?(o)
75
+ self == o
76
+ end
77
+
78
+ # Calculates hash code according to all attributes.
79
+ # @return [Fixnum] Hash code
80
+ def hash
81
+ [data].hash
82
+ end
83
+
84
+ # Builds the object from hash
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ # @return [Object] Returns the model itself
87
+ def build_from_hash(attributes)
88
+ return nil unless attributes.is_a?(Hash)
89
+ self.class.swagger_types.each_pair do |key, type|
90
+ if type =~ /\AArray<(.*)>/i
91
+ # check to ensure the input is an array given that the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
94
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
95
+ end
96
+ elsif !attributes[self.class.attribute_map[key]].nil?
97
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
98
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
99
+ end
100
+
101
+ self
102
+ end
103
+
104
+ # Deserializes the data based on type
105
+ # @param string type Data type
106
+ # @param string value Value to be deserialized
107
+ # @return [Object] Deserialized data
108
+ def _deserialize(type, value)
109
+ case type.to_sym
110
+ when :DateTime
111
+ DateTime.parse(value)
112
+ when :Date
113
+ Date.parse(value)
114
+ when :String
115
+ value.to_s
116
+ when :Integer
117
+ value.to_i
118
+ when :Float
119
+ value.to_f
120
+ when :BOOLEAN
121
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
122
+ true
123
+ else
124
+ false
125
+ end
126
+ when :Object
127
+ # generic object (usually a Hash), return directly
128
+ value
129
+ when /\AArray<(?<inner_type>.+)>\z/
130
+ inner_type = Regexp.last_match[:inner_type]
131
+ value.map { |v| _deserialize(inner_type, v) }
132
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
133
+ k_type = Regexp.last_match[:k_type]
134
+ v_type = Regexp.last_match[:v_type]
135
+ {}.tap do |hash|
136
+ value.each do |k, v|
137
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
138
+ end
139
+ end
140
+ else # model
141
+ temp_model = YNAB.const_get(type).new
142
+ temp_model.build_from_hash(value)
143
+ end
144
+ end
145
+
146
+ # Returns the string representation of the object
147
+ # @return [String] String presentation of the object
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # to_body is an alias to to_hash (backward compatibility)
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_body
155
+ to_hash
156
+ end
157
+
158
+ # Returns the object in the form of hash
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_hash
161
+ hash = {}
162
+ self.class.attribute_map.each_pair do |attr, param|
163
+ value = self.send(attr)
164
+ next if value.nil?
165
+ hash[param] = _to_hash(value)
166
+ end
167
+ hash
168
+ end
169
+
170
+ # Outputs non-array value in the form of hash
171
+ # For object, use to_hash. Otherwise, just return the value
172
+ # @param [Object] value Any valid value
173
+ # @return [Hash] Returns the value in the form of hash
174
+ def _to_hash(value)
175
+ if value.is_a?(Array)
176
+ value.compact.map { |v| _to_hash(v) }
177
+ elsif value.is_a?(Hash)
178
+ {}.tap do |hash|
179
+ value.each { |k, v| hash[k] = _to_hash(v) }
180
+ end
181
+ elsif value.respond_to? :to_hash
182
+ value.to_hash
183
+ else
184
+ value
185
+ end
186
+ end
187
+
188
+ end
189
+ end