ynab 1.31.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/DEVELOPMENT.md +11 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +42 -0
- data/README.md +3 -3
- data/Rakefile +58 -0
- data/config.json +9 -0
- data/docs/Account.md +25 -0
- data/docs/AccountResponse.md +8 -0
- data/docs/AccountResponseData.md +8 -0
- data/docs/AccountType.md +7 -0
- data/docs/AccountWrapper.md +8 -0
- data/docs/AccountsApi.md +70 -0
- data/docs/AccountsResponse.md +8 -0
- data/docs/AccountsResponseData.md +9 -0
- data/docs/AccountsWrapper.md +9 -0
- data/docs/BudgetDetail.md +24 -0
- data/docs/BudgetDetailAllOf.md +17 -0
- data/docs/BudgetDetailResponse.md +8 -0
- data/docs/BudgetDetailResponseData.md +9 -0
- data/docs/BudgetDetailWrapper.md +9 -0
- data/docs/BudgetSettings.md +9 -0
- data/docs/BudgetSettingsResponse.md +8 -0
- data/docs/BudgetSettingsResponseData.md +8 -0
- data/docs/BudgetSettingsWrapper.md +8 -0
- data/docs/BudgetSummary.md +15 -0
- data/docs/BudgetSummaryResponse.md +8 -0
- data/docs/BudgetSummaryResponseData.md +9 -0
- data/docs/BudgetSummaryWrapper.md +9 -0
- data/docs/BudgetsApi.md +68 -0
- data/docs/BulkIdWrapper.md +8 -0
- data/docs/BulkIds.md +9 -0
- data/docs/BulkResponse.md +8 -0
- data/docs/BulkResponseData.md +8 -0
- data/docs/BulkResponseDataBulk.md +9 -0
- data/docs/BulkTransactionCreateResponse.md +8 -0
- data/docs/BulkTransactionIds.md +8 -0
- data/docs/BulkTransactions.md +8 -0
- data/docs/CategoriesApi.md +94 -0
- data/docs/CategoriesResponse.md +8 -0
- data/docs/CategoriesResponseData.md +9 -0
- data/docs/Category.md +30 -0
- data/docs/CategoryGroup.md +11 -0
- data/docs/CategoryGroupWithCategories.md +12 -0
- data/docs/CategoryGroupWithCategoriesAllOf.md +8 -0
- data/docs/CategoryGroupsWrapper.md +9 -0
- data/docs/CategoryResponse.md +8 -0
- data/docs/CategoryResponseData.md +8 -0
- data/docs/CategoryWrapper.md +9 -0
- data/docs/CurrencyFormat.md +15 -0
- data/docs/DateFormat.md +8 -0
- data/docs/DeprecatedApi.md +28 -0
- data/docs/ErrorDetail.md +10 -0
- data/docs/ErrorResponse.md +8 -0
- data/docs/HybridTransaction.md +30 -0
- data/docs/HybridTransactionAllOf.md +12 -0
- data/docs/HybridTransactionsResponse.md +8 -0
- data/docs/HybridTransactionsResponseData.md +9 -0
- data/docs/HybridTransactionsWrapper.md +8 -0
- data/docs/LoanAccountPeriodicValue.md +7 -0
- data/docs/MonthDetail.md +16 -0
- data/docs/MonthDetailAllOf.md +8 -0
- data/docs/MonthDetailResponse.md +8 -0
- data/docs/MonthDetailResponseData.md +8 -0
- data/docs/MonthDetailWrapper.md +8 -0
- data/docs/MonthSummariesResponse.md +8 -0
- data/docs/MonthSummariesResponseData.md +9 -0
- data/docs/MonthSummariesWrapper.md +9 -0
- data/docs/MonthSummary.md +15 -0
- data/docs/MonthsApi.md +49 -0
- data/docs/PatchMonthCategoryWrapper.md +8 -0
- data/docs/PatchTransactionsWrapper.md +8 -0
- data/docs/Payee.md +11 -0
- data/docs/PayeeLocation.md +12 -0
- data/docs/PayeeLocationResponse.md +8 -0
- data/docs/PayeeLocationResponseData.md +8 -0
- data/docs/PayeeLocationWrapper.md +8 -0
- data/docs/PayeeLocationsApi.md +69 -0
- data/docs/PayeeLocationsResponse.md +8 -0
- data/docs/PayeeLocationsResponseData.md +8 -0
- data/docs/PayeeLocationsWrapper.md +8 -0
- data/docs/PayeeResponse.md +8 -0
- data/docs/PayeeResponseData.md +8 -0
- data/docs/PayeeWrapper.md +8 -0
- data/docs/PayeesApi.md +49 -0
- data/docs/PayeesResponse.md +8 -0
- data/docs/PayeesResponseData.md +9 -0
- data/docs/PayeesWrapper.md +9 -0
- data/docs/PostAccountWrapper.md +8 -0
- data/docs/PostTransactionsWrapper.md +9 -0
- data/docs/PutTransactionWrapper.md +8 -0
- data/docs/SaveAccount.md +10 -0
- data/docs/SaveAccountWrapper.md +8 -0
- data/docs/SaveCategoryResponse.md +8 -0
- data/docs/SaveCategoryResponseData.md +9 -0
- data/docs/SaveMonthCategory.md +8 -0
- data/docs/SaveMonthCategoryWrapper.md +8 -0
- data/docs/SaveSubTransaction.md +12 -0
- data/docs/SaveTransaction.md +19 -0
- data/docs/SaveTransactionWithId.md +20 -0
- data/docs/SaveTransactionWithIdAllOf.md +8 -0
- data/docs/SaveTransactionWithOptionalFields.md +19 -0
- data/docs/SaveTransactionWrapper.md +8 -0
- data/docs/SaveTransactionsResponse.md +8 -0
- data/docs/SaveTransactionsResponseData.md +12 -0
- data/docs/SaveTransactionsWrapper.md +9 -0
- data/docs/ScheduledSubTransaction.md +15 -0
- data/docs/ScheduledTransactionDetail.md +23 -0
- data/docs/ScheduledTransactionDetailAllOf.md +11 -0
- data/docs/ScheduledTransactionResponse.md +8 -0
- data/docs/ScheduledTransactionResponseData.md +8 -0
- data/docs/ScheduledTransactionSummary.md +19 -0
- data/docs/ScheduledTransactionWrapper.md +8 -0
- data/docs/ScheduledTransactionsApi.md +49 -0
- data/docs/ScheduledTransactionsResponse.md +8 -0
- data/docs/ScheduledTransactionsResponseData.md +9 -0
- data/docs/ScheduledTransactionsWrapper.md +8 -0
- data/docs/SubTransaction.md +18 -0
- data/docs/TransactionDetail.md +29 -0
- data/docs/TransactionDetailAllOf.md +11 -0
- data/docs/TransactionResponse.md +8 -0
- data/docs/TransactionResponseData.md +8 -0
- data/docs/TransactionSummary.md +25 -0
- data/docs/TransactionWrapper.md +8 -0
- data/docs/TransactionsApi.md +228 -0
- data/docs/TransactionsImportResponse.md +8 -0
- data/docs/TransactionsImportResponseData.md +8 -0
- data/docs/TransactionsResponse.md +8 -0
- data/docs/TransactionsResponseData.md +9 -0
- data/docs/TransactionsWrapper.md +9 -0
- data/docs/UpdateTransaction.md +20 -0
- data/docs/UpdateTransactionsWrapper.md +8 -0
- data/docs/User.md +8 -0
- data/docs/UserApi.md +25 -0
- data/docs/UserResponse.md +8 -0
- data/docs/UserResponseData.md +8 -0
- data/docs/UserWrapper.md +8 -0
- data/examples/budget-list.rb +21 -0
- data/examples/budget-month.rb +33 -0
- data/examples/category-balance.rb +23 -0
- data/examples/create-multiple-transactions.rb +42 -0
- data/examples/create-transaction.rb +30 -0
- data/examples/update-category-budgeted.rb +25 -0
- data/examples/update-multiple-transactions.rb +20 -0
- data/lib/ynab/api/accounts_api.rb +78 -41
- data/lib/ynab/api/budgets_api.rb +68 -36
- data/lib/ynab/api/categories_api.rb +108 -60
- data/lib/ynab/api/deprecated_api.rb +32 -17
- data/lib/ynab/api/months_api.rb +49 -28
- data/lib/ynab/api/payee_locations_api.rb +73 -41
- data/lib/ynab/api/payees_api.rb +49 -28
- data/lib/ynab/api/scheduled_transactions_api.rb +49 -28
- data/lib/ynab/api/transactions_api.rb +268 -140
- data/lib/ynab/api/user_api.rb +22 -12
- data/lib/ynab/api_client.rb +97 -95
- data/lib/ynab/configuration.rb +101 -14
- data/lib/ynab/models/account.rb +117 -55
- data/lib/ynab/models/account_response.rb +53 -18
- data/lib/ynab/models/account_response_data.rb +53 -18
- data/lib/ynab/models/account_type.rb +30 -20
- data/lib/ynab/models/accounts_response.rb +53 -18
- data/lib/ynab/models/accounts_response_data.rb +54 -19
- data/lib/ynab/models/budget_detail.rb +80 -35
- data/lib/ynab/models/budget_detail_all_of.rb +320 -0
- data/lib/ynab/models/budget_detail_response.rb +53 -18
- data/lib/ynab/models/budget_detail_response_data.rb +54 -19
- data/lib/ynab/models/budget_settings.rb +56 -29
- data/lib/ynab/models/budget_settings_response.rb +53 -18
- data/lib/ynab/models/budget_settings_response_data.rb +53 -18
- data/lib/ynab/models/budget_summary.rb +63 -26
- data/lib/ynab/models/budget_summary_response.rb +53 -18
- data/lib/ynab/models/budget_summary_response_data.rb +54 -20
- data/lib/ynab/models/bulk_response.rb +53 -18
- data/lib/ynab/models/bulk_response_data.rb +53 -18
- data/lib/ynab/models/bulk_response_data_bulk.rb +54 -19
- data/lib/ynab/models/bulk_transactions.rb +53 -18
- data/lib/ynab/models/categories_response.rb +53 -18
- data/lib/ynab/models/categories_response_data.rb +54 -19
- data/lib/ynab/models/category.rb +110 -48
- data/lib/ynab/models/category_group.rb +58 -23
- data/lib/ynab/models/category_group_with_categories.rb +67 -24
- data/lib/ynab/models/{save_month_category_wrapper.rb → category_group_with_categories_all_of.rb} +67 -29
- data/lib/ynab/models/category_response.rb +53 -18
- data/lib/ynab/models/category_response_data.rb +53 -18
- data/lib/ynab/models/currency_format.rb +62 -27
- data/lib/ynab/models/date_format.rb +53 -18
- data/lib/ynab/models/error_detail.rb +55 -20
- data/lib/ynab/models/error_response.rb +53 -18
- data/lib/ynab/models/hybrid_transaction.rb +118 -46
- data/lib/ynab/models/hybrid_transaction_all_of.rb +304 -0
- data/lib/ynab/models/hybrid_transactions_response.rb +53 -18
- data/lib/ynab/models/hybrid_transactions_response_data.rb +54 -19
- data/lib/ynab/models/month_detail.rb +72 -27
- data/lib/ynab/models/{update_transactions_wrapper.rb → month_detail_all_of.rb} +66 -30
- data/lib/ynab/models/month_detail_response.rb +53 -18
- data/lib/ynab/models/month_detail_response_data.rb +53 -18
- data/lib/ynab/models/month_summaries_response.rb +53 -18
- data/lib/ynab/models/month_summaries_response_data.rb +54 -19
- data/lib/ynab/models/month_summary.rb +63 -26
- data/lib/ynab/models/patch_month_category_wrapper.rb +53 -18
- data/lib/ynab/models/patch_transactions_wrapper.rb +53 -18
- data/lib/ynab/models/payee.rb +58 -22
- data/lib/ynab/models/payee_location.rb +58 -23
- data/lib/ynab/models/payee_location_response.rb +53 -18
- data/lib/ynab/models/payee_location_response_data.rb +53 -18
- data/lib/ynab/models/payee_locations_response.rb +53 -18
- data/lib/ynab/models/payee_locations_response_data.rb +53 -18
- data/lib/ynab/models/payee_response.rb +53 -18
- data/lib/ynab/models/payee_response_data.rb +53 -18
- data/lib/ynab/models/payees_response.rb +53 -18
- data/lib/ynab/models/payees_response_data.rb +54 -19
- data/lib/ynab/models/post_account_wrapper.rb +53 -18
- data/lib/ynab/models/post_transactions_wrapper.rb +54 -19
- data/lib/ynab/models/put_transaction_wrapper.rb +53 -18
- data/lib/ynab/models/save_account.rb +77 -20
- data/lib/ynab/models/save_category_response.rb +53 -18
- data/lib/ynab/models/save_category_response_data.rb +54 -19
- data/lib/ynab/models/save_month_category.rb +53 -18
- data/lib/ynab/models/save_sub_transaction.rb +61 -22
- data/lib/ynab/models/save_transaction.rb +88 -33
- data/lib/ynab/models/save_transaction_with_id.rb +102 -46
- data/lib/ynab/models/{save_transactions_wrapper.rb → save_transaction_with_id_all_of.rb} +60 -36
- data/lib/ynab/models/save_transaction_with_optional_fields.rb +81 -33
- data/lib/ynab/models/save_transactions_response.rb +53 -18
- data/lib/ynab/models/save_transactions_response_data.rb +57 -23
- data/lib/ynab/models/scheduled_sub_transaction.rb +66 -27
- data/lib/ynab/models/scheduled_transaction_detail.rb +94 -36
- data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +262 -0
- data/lib/ynab/models/scheduled_transaction_response.rb +53 -18
- data/lib/ynab/models/scheduled_transaction_response_data.rb +53 -18
- data/lib/ynab/models/scheduled_transaction_summary.rb +80 -32
- data/lib/ynab/models/scheduled_transactions_response.rb +53 -18
- data/lib/ynab/models/scheduled_transactions_response_data.rb +54 -19
- data/lib/ynab/models/sub_transaction.rb +71 -29
- data/lib/ynab/models/transaction_detail.rb +112 -44
- data/lib/ynab/models/{save_transaction_wrapper.rb → transaction_detail_all_of.rb} +102 -29
- data/lib/ynab/models/transaction_response.rb +53 -18
- data/lib/ynab/models/transaction_response_data.rb +53 -18
- data/lib/ynab/models/transaction_summary.rb +98 -40
- data/lib/ynab/models/transactions_import_response.rb +53 -18
- data/lib/ynab/models/transactions_import_response_data.rb +53 -18
- data/lib/ynab/models/transactions_response.rb +53 -18
- data/lib/ynab/models/transactions_response_data.rb +54 -19
- data/lib/ynab/models/user.rb +53 -18
- data/lib/ynab/models/user_response.rb +53 -18
- data/lib/ynab/models/user_response_data.rb +53 -18
- data/lib/ynab/version.rb +1 -1
- data/lib/ynab.rb +19 -14
- data/open_api_spec.yaml +3012 -0
- data/templates/api_client.mustache +274 -0
- data/templates/api_client_typhoeus_partial.mustache +156 -0
- data/templates/api_doc.mustache +44 -0
- data/templates/gem.mustache +84 -0
- data/templates/partial_model_generic_doc.mustache +9 -0
- data/ynab.gemspec +38 -0
- metadata +192 -85
- data/lib/ynab/models/loan_account_periodic_value.rb +0 -175
- data/lib/ynab/models/save_account_wrapper.rb +0 -189
- data/lib/ynab/models/update_transaction.rb +0 -407
- data/spec/models/transaction_detail_spec.rb +0 -11
@@ -3,14 +3,15 @@
|
|
3
3
|
|
4
4
|
#Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
7
|
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
|
15
16
|
module YNAB
|
16
17
|
class HybridTransaction
|
@@ -127,15 +128,20 @@ module YNAB
|
|
127
128
|
}
|
128
129
|
end
|
129
130
|
|
131
|
+
# Returns all the JSON keys this model knows about
|
132
|
+
def self.acceptable_attributes
|
133
|
+
attribute_map.values
|
134
|
+
end
|
135
|
+
|
130
136
|
# Attribute type mapping.
|
131
|
-
def self.
|
137
|
+
def self.openapi_types
|
132
138
|
{
|
133
139
|
:'id' => :'String',
|
134
140
|
:'date' => :'Date',
|
135
141
|
:'amount' => :'Integer',
|
136
142
|
:'memo' => :'String',
|
137
143
|
:'cleared' => :'String',
|
138
|
-
:'approved' => :'
|
144
|
+
:'approved' => :'Boolean',
|
139
145
|
:'flag_color' => :'String',
|
140
146
|
:'account_id' => :'String',
|
141
147
|
:'payee_id' => :'String',
|
@@ -147,7 +153,7 @@ module YNAB
|
|
147
153
|
:'import_payee_name' => :'String',
|
148
154
|
:'import_payee_name_original' => :'String',
|
149
155
|
:'debt_transaction_type' => :'String',
|
150
|
-
:'deleted' => :'
|
156
|
+
:'deleted' => :'Boolean',
|
151
157
|
:'type' => :'String',
|
152
158
|
:'parent_transaction_id' => :'String',
|
153
159
|
:'account_name' => :'String',
|
@@ -156,103 +162,137 @@ module YNAB
|
|
156
162
|
}
|
157
163
|
end
|
158
164
|
|
165
|
+
# List of attributes with nullable: true
|
166
|
+
def self.openapi_nullable
|
167
|
+
Set.new([
|
168
|
+
:'memo',
|
169
|
+
:'flag_color',
|
170
|
+
:'payee_id',
|
171
|
+
:'category_id',
|
172
|
+
:'transfer_account_id',
|
173
|
+
:'transfer_transaction_id',
|
174
|
+
:'matched_transaction_id',
|
175
|
+
:'import_id',
|
176
|
+
:'import_payee_name',
|
177
|
+
:'import_payee_name_original',
|
178
|
+
:'debt_transaction_type',
|
179
|
+
:'parent_transaction_id',
|
180
|
+
:'payee_name',
|
181
|
+
])
|
182
|
+
end
|
183
|
+
|
184
|
+
# List of class defined in allOf (OpenAPI v3)
|
185
|
+
def self.openapi_all_of
|
186
|
+
[
|
187
|
+
:'HybridTransactionAllOf',
|
188
|
+
:'TransactionSummary'
|
189
|
+
]
|
190
|
+
end
|
191
|
+
|
159
192
|
# Initializes the object
|
160
193
|
# @param [Hash] attributes Model attributes in the form of hash
|
161
194
|
def initialize(attributes = {})
|
162
|
-
|
195
|
+
if (!attributes.is_a?(Hash))
|
196
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::HybridTransaction` initialize method"
|
197
|
+
end
|
163
198
|
|
164
|
-
# convert string to symbol for hash key
|
165
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
199
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
200
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
201
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
202
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::HybridTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
203
|
+
end
|
204
|
+
h[k.to_sym] = v
|
205
|
+
}
|
166
206
|
|
167
|
-
if attributes.
|
207
|
+
if attributes.key?(:'id')
|
168
208
|
self.id = attributes[:'id']
|
169
209
|
end
|
170
210
|
|
171
|
-
if attributes.
|
211
|
+
if attributes.key?(:'date')
|
172
212
|
self.date = attributes[:'date']
|
173
213
|
end
|
174
214
|
|
175
|
-
if attributes.
|
215
|
+
if attributes.key?(:'amount')
|
176
216
|
self.amount = attributes[:'amount']
|
177
217
|
end
|
178
218
|
|
179
|
-
if attributes.
|
219
|
+
if attributes.key?(:'memo')
|
180
220
|
self.memo = attributes[:'memo']
|
181
221
|
end
|
182
222
|
|
183
|
-
if attributes.
|
223
|
+
if attributes.key?(:'cleared')
|
184
224
|
self.cleared = attributes[:'cleared']
|
185
225
|
end
|
186
226
|
|
187
|
-
if attributes.
|
227
|
+
if attributes.key?(:'approved')
|
188
228
|
self.approved = attributes[:'approved']
|
189
229
|
end
|
190
230
|
|
191
|
-
if attributes.
|
231
|
+
if attributes.key?(:'flag_color')
|
192
232
|
self.flag_color = attributes[:'flag_color']
|
193
233
|
end
|
194
234
|
|
195
|
-
if attributes.
|
235
|
+
if attributes.key?(:'account_id')
|
196
236
|
self.account_id = attributes[:'account_id']
|
197
237
|
end
|
198
238
|
|
199
|
-
if attributes.
|
239
|
+
if attributes.key?(:'payee_id')
|
200
240
|
self.payee_id = attributes[:'payee_id']
|
201
241
|
end
|
202
242
|
|
203
|
-
if attributes.
|
243
|
+
if attributes.key?(:'category_id')
|
204
244
|
self.category_id = attributes[:'category_id']
|
205
245
|
end
|
206
246
|
|
207
|
-
if attributes.
|
247
|
+
if attributes.key?(:'transfer_account_id')
|
208
248
|
self.transfer_account_id = attributes[:'transfer_account_id']
|
209
249
|
end
|
210
250
|
|
211
|
-
if attributes.
|
251
|
+
if attributes.key?(:'transfer_transaction_id')
|
212
252
|
self.transfer_transaction_id = attributes[:'transfer_transaction_id']
|
213
253
|
end
|
214
254
|
|
215
|
-
if attributes.
|
255
|
+
if attributes.key?(:'matched_transaction_id')
|
216
256
|
self.matched_transaction_id = attributes[:'matched_transaction_id']
|
217
257
|
end
|
218
258
|
|
219
|
-
if attributes.
|
259
|
+
if attributes.key?(:'import_id')
|
220
260
|
self.import_id = attributes[:'import_id']
|
221
261
|
end
|
222
262
|
|
223
|
-
if attributes.
|
263
|
+
if attributes.key?(:'import_payee_name')
|
224
264
|
self.import_payee_name = attributes[:'import_payee_name']
|
225
265
|
end
|
226
266
|
|
227
|
-
if attributes.
|
267
|
+
if attributes.key?(:'import_payee_name_original')
|
228
268
|
self.import_payee_name_original = attributes[:'import_payee_name_original']
|
229
269
|
end
|
230
270
|
|
231
|
-
if attributes.
|
271
|
+
if attributes.key?(:'debt_transaction_type')
|
232
272
|
self.debt_transaction_type = attributes[:'debt_transaction_type']
|
233
273
|
end
|
234
274
|
|
235
|
-
if attributes.
|
275
|
+
if attributes.key?(:'deleted')
|
236
276
|
self.deleted = attributes[:'deleted']
|
237
277
|
end
|
238
278
|
|
239
|
-
if attributes.
|
279
|
+
if attributes.key?(:'type')
|
240
280
|
self.type = attributes[:'type']
|
241
281
|
end
|
242
282
|
|
243
|
-
if attributes.
|
283
|
+
if attributes.key?(:'parent_transaction_id')
|
244
284
|
self.parent_transaction_id = attributes[:'parent_transaction_id']
|
245
285
|
end
|
246
286
|
|
247
|
-
if attributes.
|
287
|
+
if attributes.key?(:'account_name')
|
248
288
|
self.account_name = attributes[:'account_name']
|
249
289
|
end
|
250
290
|
|
251
|
-
if attributes.
|
291
|
+
if attributes.key?(:'payee_name')
|
252
292
|
self.payee_name = attributes[:'payee_name']
|
253
293
|
end
|
254
294
|
|
255
|
-
if attributes.
|
295
|
+
if attributes.key?(:'category_name')
|
256
296
|
self.category_name = attributes[:'category_name']
|
257
297
|
end
|
258
298
|
end
|
@@ -307,17 +347,17 @@ module YNAB
|
|
307
347
|
return false if @date.nil?
|
308
348
|
return false if @amount.nil?
|
309
349
|
return false if @cleared.nil?
|
310
|
-
cleared_validator = EnumAttributeValidator.new('String', [
|
350
|
+
cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
311
351
|
return false unless cleared_validator.valid?(@cleared)
|
312
352
|
return false if @approved.nil?
|
313
|
-
flag_color_validator = EnumAttributeValidator.new('String', [
|
353
|
+
flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
314
354
|
return false unless flag_color_validator.valid?(@flag_color)
|
315
355
|
return false if @account_id.nil?
|
316
|
-
debt_transaction_type_validator = EnumAttributeValidator.new('String', [
|
356
|
+
debt_transaction_type_validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balancedAdjustment", "credit", "charge", "null"])
|
317
357
|
return false unless debt_transaction_type_validator.valid?(@debt_transaction_type)
|
318
358
|
return false if @deleted.nil?
|
319
359
|
return false if @type.nil?
|
320
|
-
type_validator = EnumAttributeValidator.new('String', [
|
360
|
+
type_validator = EnumAttributeValidator.new('String', ["transaction", "subtransaction"])
|
321
361
|
return false unless type_validator.valid?(@type)
|
322
362
|
return false if @account_name.nil?
|
323
363
|
true
|
@@ -326,24 +366,40 @@ module YNAB
|
|
326
366
|
# Custom attribute writer method checking allowed values (enum).
|
327
367
|
# @param [Object] cleared Object to be assigned
|
328
368
|
def cleared=(cleared)
|
369
|
+
validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
370
|
+
unless validator.valid?(cleared)
|
371
|
+
fail ArgumentError, "invalid value for \"cleared\", must be one of #{validator.allowable_values}."
|
372
|
+
end
|
329
373
|
@cleared = cleared
|
330
374
|
end
|
331
375
|
|
332
376
|
# Custom attribute writer method checking allowed values (enum).
|
333
377
|
# @param [Object] flag_color Object to be assigned
|
334
378
|
def flag_color=(flag_color)
|
379
|
+
validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
380
|
+
unless validator.valid?(flag_color)
|
381
|
+
fail ArgumentError, "invalid value for \"flag_color\", must be one of #{validator.allowable_values}."
|
382
|
+
end
|
335
383
|
@flag_color = flag_color
|
336
384
|
end
|
337
385
|
|
338
386
|
# Custom attribute writer method checking allowed values (enum).
|
339
387
|
# @param [Object] debt_transaction_type Object to be assigned
|
340
388
|
def debt_transaction_type=(debt_transaction_type)
|
389
|
+
validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balancedAdjustment", "credit", "charge", "null"])
|
390
|
+
unless validator.valid?(debt_transaction_type)
|
391
|
+
fail ArgumentError, "invalid value for \"debt_transaction_type\", must be one of #{validator.allowable_values}."
|
392
|
+
end
|
341
393
|
@debt_transaction_type = debt_transaction_type
|
342
394
|
end
|
343
395
|
|
344
396
|
# Custom attribute writer method checking allowed values (enum).
|
345
397
|
# @param [Object] type Object to be assigned
|
346
398
|
def type=(type)
|
399
|
+
validator = EnumAttributeValidator.new('String', ["transaction", "subtransaction"])
|
400
|
+
unless validator.valid?(type)
|
401
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
402
|
+
end
|
347
403
|
@type = type
|
348
404
|
end
|
349
405
|
|
@@ -384,17 +440,28 @@ module YNAB
|
|
384
440
|
end
|
385
441
|
|
386
442
|
# Calculates hash code according to all attributes.
|
387
|
-
# @return [
|
443
|
+
# @return [Integer] Hash code
|
388
444
|
def hash
|
389
445
|
[id, date, amount, memo, cleared, approved, flag_color, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted, type, parent_transaction_id, account_name, payee_name, category_name].hash
|
390
446
|
end
|
447
|
+
|
448
|
+
# Builds the object from hash
|
449
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
450
|
+
# @return [Object] Returns the model itself
|
451
|
+
def self.build_from_hash(attributes)
|
452
|
+
new.build_from_hash(attributes)
|
453
|
+
end
|
454
|
+
|
391
455
|
# Builds the object from hash
|
392
456
|
# @param [Hash] attributes Model attributes in the form of hash
|
393
457
|
# @return [Object] Returns the model itself
|
394
458
|
def build_from_hash(attributes)
|
395
459
|
return nil unless attributes.is_a?(Hash)
|
396
|
-
|
397
|
-
|
460
|
+
attributes = attributes.transform_keys(&:to_sym)
|
461
|
+
self.class.openapi_types.each_pair do |key, type|
|
462
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
463
|
+
self.send("#{key}=", nil)
|
464
|
+
elsif type =~ /\AArray<(.*)>/i
|
398
465
|
# check to ensure the input is an array given that the attribute
|
399
466
|
# is documented as an array but the input is not
|
400
467
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -402,7 +469,7 @@ module YNAB
|
|
402
469
|
end
|
403
470
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
404
471
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
405
|
-
end
|
472
|
+
end
|
406
473
|
end
|
407
474
|
|
408
475
|
self
|
@@ -414,8 +481,8 @@ module YNAB
|
|
414
481
|
# @return [Object] Deserialized data
|
415
482
|
def _deserialize(type, value)
|
416
483
|
case type.to_sym
|
417
|
-
when :
|
418
|
-
|
484
|
+
when :Time
|
485
|
+
Time.parse(value)
|
419
486
|
when :Date
|
420
487
|
Date.parse(value)
|
421
488
|
when :String
|
@@ -424,7 +491,7 @@ module YNAB
|
|
424
491
|
value.to_i
|
425
492
|
when :Float
|
426
493
|
value.to_f
|
427
|
-
when :
|
494
|
+
when :Boolean
|
428
495
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
429
496
|
true
|
430
497
|
else
|
@@ -445,8 +512,9 @@ module YNAB
|
|
445
512
|
end
|
446
513
|
end
|
447
514
|
else # model
|
448
|
-
|
449
|
-
|
515
|
+
# models (e.g. Pet) or oneOf
|
516
|
+
klass = YNAB.const_get(type)
|
517
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
450
518
|
end
|
451
519
|
end
|
452
520
|
|
@@ -468,7 +536,11 @@ module YNAB
|
|
468
536
|
hash = {}
|
469
537
|
self.class.attribute_map.each_pair do |attr, param|
|
470
538
|
value = self.send(attr)
|
471
|
-
|
539
|
+
if value.nil?
|
540
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
541
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
542
|
+
end
|
543
|
+
|
472
544
|
hash[param] = _to_hash(value)
|
473
545
|
end
|
474
546
|
hash
|
@@ -0,0 +1,304 @@
|
|
1
|
+
=begin
|
2
|
+
#YNAB API Endpoints
|
3
|
+
|
4
|
+
#Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module YNAB
|
17
|
+
class HybridTransactionAllOf
|
18
|
+
# Whether the hybrid transaction represents a regular transaction or a subtransaction
|
19
|
+
attr_accessor :type
|
20
|
+
|
21
|
+
# For subtransaction types, this is the id of the parent transaction. For transaction types, this id will be always be null.
|
22
|
+
attr_accessor :parent_transaction_id
|
23
|
+
|
24
|
+
attr_accessor :account_name
|
25
|
+
|
26
|
+
attr_accessor :payee_name
|
27
|
+
|
28
|
+
# The name of the category. If a split transaction, this will be 'Split'.
|
29
|
+
attr_accessor :category_name
|
30
|
+
|
31
|
+
class EnumAttributeValidator
|
32
|
+
attr_reader :datatype
|
33
|
+
attr_reader :allowable_values
|
34
|
+
|
35
|
+
def initialize(datatype, allowable_values)
|
36
|
+
@allowable_values = allowable_values.map do |value|
|
37
|
+
case datatype.to_s
|
38
|
+
when /Integer/i
|
39
|
+
value.to_i
|
40
|
+
when /Float/i
|
41
|
+
value.to_f
|
42
|
+
else
|
43
|
+
value
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def valid?(value)
|
49
|
+
!value || allowable_values.include?(value)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
54
|
+
def self.attribute_map
|
55
|
+
{
|
56
|
+
:'type' => :'type',
|
57
|
+
:'parent_transaction_id' => :'parent_transaction_id',
|
58
|
+
:'account_name' => :'account_name',
|
59
|
+
:'payee_name' => :'payee_name',
|
60
|
+
:'category_name' => :'category_name'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Returns all the JSON keys this model knows about
|
65
|
+
def self.acceptable_attributes
|
66
|
+
attribute_map.values
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute type mapping.
|
70
|
+
def self.openapi_types
|
71
|
+
{
|
72
|
+
:'type' => :'String',
|
73
|
+
:'parent_transaction_id' => :'String',
|
74
|
+
:'account_name' => :'String',
|
75
|
+
:'payee_name' => :'String',
|
76
|
+
:'category_name' => :'String'
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# List of attributes with nullable: true
|
81
|
+
def self.openapi_nullable
|
82
|
+
Set.new([
|
83
|
+
:'parent_transaction_id',
|
84
|
+
:'payee_name',
|
85
|
+
])
|
86
|
+
end
|
87
|
+
|
88
|
+
# Initializes the object
|
89
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
90
|
+
def initialize(attributes = {})
|
91
|
+
if (!attributes.is_a?(Hash))
|
92
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::HybridTransactionAllOf` initialize method"
|
93
|
+
end
|
94
|
+
|
95
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
96
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
97
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
98
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::HybridTransactionAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
99
|
+
end
|
100
|
+
h[k.to_sym] = v
|
101
|
+
}
|
102
|
+
|
103
|
+
if attributes.key?(:'type')
|
104
|
+
self.type = attributes[:'type']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'parent_transaction_id')
|
108
|
+
self.parent_transaction_id = attributes[:'parent_transaction_id']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'account_name')
|
112
|
+
self.account_name = attributes[:'account_name']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'payee_name')
|
116
|
+
self.payee_name = attributes[:'payee_name']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'category_name')
|
120
|
+
self.category_name = attributes[:'category_name']
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
125
|
+
# @return Array for valid properties with the reasons
|
126
|
+
def list_invalid_properties
|
127
|
+
invalid_properties = Array.new
|
128
|
+
if @type.nil?
|
129
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
130
|
+
end
|
131
|
+
|
132
|
+
if @account_name.nil?
|
133
|
+
invalid_properties.push('invalid value for "account_name", account_name cannot be nil.')
|
134
|
+
end
|
135
|
+
|
136
|
+
invalid_properties
|
137
|
+
end
|
138
|
+
|
139
|
+
# Check to see if the all the properties in the model are valid
|
140
|
+
# @return true if the model is valid
|
141
|
+
def valid?
|
142
|
+
return false if @type.nil?
|
143
|
+
type_validator = EnumAttributeValidator.new('String', ["transaction", "subtransaction"])
|
144
|
+
return false unless type_validator.valid?(@type)
|
145
|
+
return false if @account_name.nil?
|
146
|
+
true
|
147
|
+
end
|
148
|
+
|
149
|
+
# Custom attribute writer method checking allowed values (enum).
|
150
|
+
# @param [Object] type Object to be assigned
|
151
|
+
def type=(type)
|
152
|
+
validator = EnumAttributeValidator.new('String', ["transaction", "subtransaction"])
|
153
|
+
unless validator.valid?(type)
|
154
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
155
|
+
end
|
156
|
+
@type = type
|
157
|
+
end
|
158
|
+
|
159
|
+
# Checks equality by comparing each attribute.
|
160
|
+
# @param [Object] Object to be compared
|
161
|
+
def ==(o)
|
162
|
+
return true if self.equal?(o)
|
163
|
+
self.class == o.class &&
|
164
|
+
type == o.type &&
|
165
|
+
parent_transaction_id == o.parent_transaction_id &&
|
166
|
+
account_name == o.account_name &&
|
167
|
+
payee_name == o.payee_name &&
|
168
|
+
category_name == o.category_name
|
169
|
+
end
|
170
|
+
|
171
|
+
# @see the `==` method
|
172
|
+
# @param [Object] Object to be compared
|
173
|
+
def eql?(o)
|
174
|
+
self == o
|
175
|
+
end
|
176
|
+
|
177
|
+
# Calculates hash code according to all attributes.
|
178
|
+
# @return [Integer] Hash code
|
179
|
+
def hash
|
180
|
+
[type, parent_transaction_id, account_name, payee_name, category_name].hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Builds the object from hash
|
184
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
185
|
+
# @return [Object] Returns the model itself
|
186
|
+
def self.build_from_hash(attributes)
|
187
|
+
new.build_from_hash(attributes)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Builds the object from hash
|
191
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
192
|
+
# @return [Object] Returns the model itself
|
193
|
+
def build_from_hash(attributes)
|
194
|
+
return nil unless attributes.is_a?(Hash)
|
195
|
+
attributes = attributes.transform_keys(&:to_sym)
|
196
|
+
self.class.openapi_types.each_pair do |key, type|
|
197
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
198
|
+
self.send("#{key}=", nil)
|
199
|
+
elsif type =~ /\AArray<(.*)>/i
|
200
|
+
# check to ensure the input is an array given that the attribute
|
201
|
+
# is documented as an array but the input is not
|
202
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
203
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
204
|
+
end
|
205
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
206
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
self
|
211
|
+
end
|
212
|
+
|
213
|
+
# Deserializes the data based on type
|
214
|
+
# @param string type Data type
|
215
|
+
# @param string value Value to be deserialized
|
216
|
+
# @return [Object] Deserialized data
|
217
|
+
def _deserialize(type, value)
|
218
|
+
case type.to_sym
|
219
|
+
when :Time
|
220
|
+
Time.parse(value)
|
221
|
+
when :Date
|
222
|
+
Date.parse(value)
|
223
|
+
when :String
|
224
|
+
value.to_s
|
225
|
+
when :Integer
|
226
|
+
value.to_i
|
227
|
+
when :Float
|
228
|
+
value.to_f
|
229
|
+
when :Boolean
|
230
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
231
|
+
true
|
232
|
+
else
|
233
|
+
false
|
234
|
+
end
|
235
|
+
when :Object
|
236
|
+
# generic object (usually a Hash), return directly
|
237
|
+
value
|
238
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
239
|
+
inner_type = Regexp.last_match[:inner_type]
|
240
|
+
value.map { |v| _deserialize(inner_type, v) }
|
241
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
242
|
+
k_type = Regexp.last_match[:k_type]
|
243
|
+
v_type = Regexp.last_match[:v_type]
|
244
|
+
{}.tap do |hash|
|
245
|
+
value.each do |k, v|
|
246
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
else # model
|
250
|
+
# models (e.g. Pet) or oneOf
|
251
|
+
klass = YNAB.const_get(type)
|
252
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
# Returns the string representation of the object
|
257
|
+
# @return [String] String presentation of the object
|
258
|
+
def to_s
|
259
|
+
to_hash.to_s
|
260
|
+
end
|
261
|
+
|
262
|
+
# to_body is an alias to to_hash (backward compatibility)
|
263
|
+
# @return [Hash] Returns the object in the form of hash
|
264
|
+
def to_body
|
265
|
+
to_hash
|
266
|
+
end
|
267
|
+
|
268
|
+
# Returns the object in the form of hash
|
269
|
+
# @return [Hash] Returns the object in the form of hash
|
270
|
+
def to_hash
|
271
|
+
hash = {}
|
272
|
+
self.class.attribute_map.each_pair do |attr, param|
|
273
|
+
value = self.send(attr)
|
274
|
+
if value.nil?
|
275
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
276
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
277
|
+
end
|
278
|
+
|
279
|
+
hash[param] = _to_hash(value)
|
280
|
+
end
|
281
|
+
hash
|
282
|
+
end
|
283
|
+
|
284
|
+
# Outputs non-array value in the form of hash
|
285
|
+
# For object, use to_hash. Otherwise, just return the value
|
286
|
+
# @param [Object] value Any valid value
|
287
|
+
# @return [Hash] Returns the value in the form of hash
|
288
|
+
def _to_hash(value)
|
289
|
+
if value.is_a?(Array)
|
290
|
+
value.compact.map { |v| _to_hash(v) }
|
291
|
+
elsif value.is_a?(Hash)
|
292
|
+
{}.tap do |hash|
|
293
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
294
|
+
end
|
295
|
+
elsif value.respond_to? :to_hash
|
296
|
+
value.to_hash
|
297
|
+
else
|
298
|
+
value
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
end
|
303
|
+
|
304
|
+
end
|