ynab 1.29.0 → 2.0.0.rc1
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 +6 -6
- 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 +79 -42
- data/lib/ynab/api/budgets_api.rb +69 -37
- data/lib/ynab/api/categories_api.rb +109 -61
- data/lib/ynab/api/deprecated_api.rb +33 -18
- data/lib/ynab/api/months_api.rb +50 -29
- data/lib/ynab/api/payee_locations_api.rb +74 -42
- data/lib/ynab/api/payees_api.rb +50 -29
- data/lib/ynab/api/scheduled_transactions_api.rb +50 -29
- data/lib/ynab/api/transactions_api.rb +269 -141
- data/lib/ynab/api/user_api.rb +23 -13
- data/lib/ynab/api_client.rb +98 -96
- data/lib/ynab/configuration.rb +103 -16
- data/lib/ynab/models/account.rb +118 -56
- data/lib/ynab/models/account_response.rb +54 -19
- data/lib/ynab/models/account_response_data.rb +54 -19
- data/lib/ynab/models/account_type.rb +31 -21
- data/lib/ynab/models/accounts_response.rb +54 -19
- data/lib/ynab/models/accounts_response_data.rb +55 -20
- data/lib/ynab/models/budget_detail.rb +81 -36
- data/lib/ynab/models/budget_detail_all_of.rb +320 -0
- data/lib/ynab/models/budget_detail_response.rb +54 -19
- data/lib/ynab/models/budget_detail_response_data.rb +55 -20
- data/lib/ynab/models/budget_settings.rb +57 -30
- data/lib/ynab/models/budget_settings_response.rb +54 -19
- data/lib/ynab/models/budget_settings_response_data.rb +54 -19
- data/lib/ynab/models/budget_summary.rb +64 -27
- data/lib/ynab/models/budget_summary_response.rb +54 -19
- data/lib/ynab/models/budget_summary_response_data.rb +55 -21
- data/lib/ynab/models/bulk_response.rb +54 -19
- data/lib/ynab/models/bulk_response_data.rb +54 -19
- data/lib/ynab/models/bulk_response_data_bulk.rb +55 -20
- data/lib/ynab/models/bulk_transactions.rb +54 -19
- data/lib/ynab/models/categories_response.rb +54 -19
- data/lib/ynab/models/categories_response_data.rb +55 -20
- data/lib/ynab/models/category.rb +111 -49
- data/lib/ynab/models/category_group.rb +59 -24
- data/lib/ynab/models/category_group_with_categories.rb +68 -25
- 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 +54 -19
- data/lib/ynab/models/category_response_data.rb +54 -19
- data/lib/ynab/models/currency_format.rb +63 -28
- data/lib/ynab/models/date_format.rb +54 -19
- data/lib/ynab/models/error_detail.rb +56 -21
- data/lib/ynab/models/error_response.rb +54 -19
- data/lib/ynab/models/hybrid_transaction.rb +120 -47
- data/lib/ynab/models/hybrid_transaction_all_of.rb +304 -0
- data/lib/ynab/models/hybrid_transactions_response.rb +54 -19
- data/lib/ynab/models/hybrid_transactions_response_data.rb +55 -20
- data/lib/ynab/models/month_detail.rb +73 -28
- data/lib/ynab/models/{update_transactions_wrapper.rb → month_detail_all_of.rb} +66 -30
- data/lib/ynab/models/month_detail_response.rb +54 -19
- data/lib/ynab/models/month_detail_response_data.rb +54 -19
- data/lib/ynab/models/month_summaries_response.rb +54 -19
- data/lib/ynab/models/month_summaries_response_data.rb +55 -20
- data/lib/ynab/models/month_summary.rb +64 -27
- data/lib/ynab/models/patch_month_category_wrapper.rb +54 -19
- data/lib/ynab/models/patch_transactions_wrapper.rb +54 -19
- data/lib/ynab/models/payee.rb +59 -23
- data/lib/ynab/models/payee_location.rb +59 -24
- data/lib/ynab/models/payee_location_response.rb +54 -19
- data/lib/ynab/models/payee_location_response_data.rb +54 -19
- data/lib/ynab/models/payee_locations_response.rb +54 -19
- data/lib/ynab/models/payee_locations_response_data.rb +54 -19
- data/lib/ynab/models/payee_response.rb +54 -19
- data/lib/ynab/models/payee_response_data.rb +54 -19
- data/lib/ynab/models/payees_response.rb +54 -19
- data/lib/ynab/models/payees_response_data.rb +55 -20
- data/lib/ynab/models/post_account_wrapper.rb +54 -19
- data/lib/ynab/models/post_transactions_wrapper.rb +55 -20
- data/lib/ynab/models/put_transaction_wrapper.rb +54 -19
- data/lib/ynab/models/save_account.rb +78 -21
- data/lib/ynab/models/save_category_response.rb +54 -19
- data/lib/ynab/models/save_category_response_data.rb +55 -20
- data/lib/ynab/models/save_month_category.rb +54 -19
- data/lib/ynab/models/save_sub_transaction.rb +62 -23
- data/lib/ynab/models/save_transaction.rb +89 -34
- data/lib/ynab/models/save_transaction_with_id.rb +103 -47
- 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 +82 -34
- data/lib/ynab/models/save_transactions_response.rb +54 -19
- data/lib/ynab/models/save_transactions_response_data.rb +58 -24
- data/lib/ynab/models/scheduled_sub_transaction.rb +67 -28
- data/lib/ynab/models/scheduled_transaction_detail.rb +96 -37
- data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +262 -0
- data/lib/ynab/models/scheduled_transaction_response.rb +54 -19
- data/lib/ynab/models/scheduled_transaction_response_data.rb +54 -19
- data/lib/ynab/models/scheduled_transaction_summary.rb +81 -33
- data/lib/ynab/models/scheduled_transactions_response.rb +54 -19
- data/lib/ynab/models/scheduled_transactions_response_data.rb +55 -20
- data/lib/ynab/models/sub_transaction.rb +72 -30
- data/lib/ynab/models/transaction_detail.rb +114 -45
- data/lib/ynab/models/{save_transaction_wrapper.rb → transaction_detail_all_of.rb} +102 -29
- data/lib/ynab/models/transaction_response.rb +54 -19
- data/lib/ynab/models/transaction_response_data.rb +54 -19
- data/lib/ynab/models/transaction_summary.rb +99 -41
- data/lib/ynab/models/transactions_import_response.rb +54 -19
- data/lib/ynab/models/transactions_import_response_data.rb +54 -19
- data/lib/ynab/models/transactions_response.rb +54 -19
- data/lib/ynab/models/transactions_response_data.rb +55 -20
- data/lib/ynab/models/user.rb +54 -19
- data/lib/ynab/models/user_response.rb +54 -19
- data/lib/ynab/models/user_response_data.rb +54 -19
- data/lib/ynab/version.rb +1 -1
- data/lib/ynab.rb +21 -16
- 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 +197 -90
- 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
@@ -1,16 +1,17 @@
|
|
1
1
|
=begin
|
2
2
|
#YNAB API Endpoints
|
3
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.
|
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 SubTransaction
|
@@ -57,8 +58,13 @@ module YNAB
|
|
57
58
|
}
|
58
59
|
end
|
59
60
|
|
61
|
+
# Returns all the JSON keys this model knows about
|
62
|
+
def self.acceptable_attributes
|
63
|
+
attribute_map.values
|
64
|
+
end
|
65
|
+
|
60
66
|
# Attribute type mapping.
|
61
|
-
def self.
|
67
|
+
def self.openapi_types
|
62
68
|
{
|
63
69
|
:'id' => :'String',
|
64
70
|
:'transaction_id' => :'String',
|
@@ -70,59 +76,79 @@ module YNAB
|
|
70
76
|
:'category_name' => :'String',
|
71
77
|
:'transfer_account_id' => :'String',
|
72
78
|
:'transfer_transaction_id' => :'String',
|
73
|
-
:'deleted' => :'
|
79
|
+
:'deleted' => :'Boolean'
|
74
80
|
}
|
75
81
|
end
|
76
82
|
|
83
|
+
# List of attributes with nullable: true
|
84
|
+
def self.openapi_nullable
|
85
|
+
Set.new([
|
86
|
+
:'memo',
|
87
|
+
:'payee_id',
|
88
|
+
:'payee_name',
|
89
|
+
:'category_id',
|
90
|
+
:'category_name',
|
91
|
+
:'transfer_account_id',
|
92
|
+
:'transfer_transaction_id',
|
93
|
+
])
|
94
|
+
end
|
95
|
+
|
77
96
|
# Initializes the object
|
78
97
|
# @param [Hash] attributes Model attributes in the form of hash
|
79
98
|
def initialize(attributes = {})
|
80
|
-
|
99
|
+
if (!attributes.is_a?(Hash))
|
100
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SubTransaction` initialize method"
|
101
|
+
end
|
81
102
|
|
82
|
-
# convert string to symbol for hash key
|
83
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
103
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
104
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
105
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
106
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SubTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
107
|
+
end
|
108
|
+
h[k.to_sym] = v
|
109
|
+
}
|
84
110
|
|
85
|
-
if attributes.
|
111
|
+
if attributes.key?(:'id')
|
86
112
|
self.id = attributes[:'id']
|
87
113
|
end
|
88
114
|
|
89
|
-
if attributes.
|
115
|
+
if attributes.key?(:'transaction_id')
|
90
116
|
self.transaction_id = attributes[:'transaction_id']
|
91
117
|
end
|
92
118
|
|
93
|
-
if attributes.
|
119
|
+
if attributes.key?(:'amount')
|
94
120
|
self.amount = attributes[:'amount']
|
95
121
|
end
|
96
122
|
|
97
|
-
if attributes.
|
123
|
+
if attributes.key?(:'memo')
|
98
124
|
self.memo = attributes[:'memo']
|
99
125
|
end
|
100
126
|
|
101
|
-
if attributes.
|
127
|
+
if attributes.key?(:'payee_id')
|
102
128
|
self.payee_id = attributes[:'payee_id']
|
103
129
|
end
|
104
130
|
|
105
|
-
if attributes.
|
131
|
+
if attributes.key?(:'payee_name')
|
106
132
|
self.payee_name = attributes[:'payee_name']
|
107
133
|
end
|
108
134
|
|
109
|
-
if attributes.
|
135
|
+
if attributes.key?(:'category_id')
|
110
136
|
self.category_id = attributes[:'category_id']
|
111
137
|
end
|
112
138
|
|
113
|
-
if attributes.
|
139
|
+
if attributes.key?(:'category_name')
|
114
140
|
self.category_name = attributes[:'category_name']
|
115
141
|
end
|
116
142
|
|
117
|
-
if attributes.
|
143
|
+
if attributes.key?(:'transfer_account_id')
|
118
144
|
self.transfer_account_id = attributes[:'transfer_account_id']
|
119
145
|
end
|
120
146
|
|
121
|
-
if attributes.
|
147
|
+
if attributes.key?(:'transfer_transaction_id')
|
122
148
|
self.transfer_transaction_id = attributes[:'transfer_transaction_id']
|
123
149
|
end
|
124
150
|
|
125
|
-
if attributes.
|
151
|
+
if attributes.key?(:'deleted')
|
126
152
|
self.deleted = attributes[:'deleted']
|
127
153
|
end
|
128
154
|
end
|
@@ -185,17 +211,28 @@ module YNAB
|
|
185
211
|
end
|
186
212
|
|
187
213
|
# Calculates hash code according to all attributes.
|
188
|
-
# @return [
|
214
|
+
# @return [Integer] Hash code
|
189
215
|
def hash
|
190
216
|
[id, transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, transfer_transaction_id, deleted].hash
|
191
217
|
end
|
218
|
+
|
219
|
+
# Builds the object from hash
|
220
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
221
|
+
# @return [Object] Returns the model itself
|
222
|
+
def self.build_from_hash(attributes)
|
223
|
+
new.build_from_hash(attributes)
|
224
|
+
end
|
225
|
+
|
192
226
|
# Builds the object from hash
|
193
227
|
# @param [Hash] attributes Model attributes in the form of hash
|
194
228
|
# @return [Object] Returns the model itself
|
195
229
|
def build_from_hash(attributes)
|
196
230
|
return nil unless attributes.is_a?(Hash)
|
197
|
-
|
198
|
-
|
231
|
+
attributes = attributes.transform_keys(&:to_sym)
|
232
|
+
self.class.openapi_types.each_pair do |key, type|
|
233
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
234
|
+
self.send("#{key}=", nil)
|
235
|
+
elsif type =~ /\AArray<(.*)>/i
|
199
236
|
# check to ensure the input is an array given that the attribute
|
200
237
|
# is documented as an array but the input is not
|
201
238
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -203,7 +240,7 @@ module YNAB
|
|
203
240
|
end
|
204
241
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
205
242
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
206
|
-
end
|
243
|
+
end
|
207
244
|
end
|
208
245
|
|
209
246
|
self
|
@@ -215,8 +252,8 @@ module YNAB
|
|
215
252
|
# @return [Object] Deserialized data
|
216
253
|
def _deserialize(type, value)
|
217
254
|
case type.to_sym
|
218
|
-
when :
|
219
|
-
|
255
|
+
when :Time
|
256
|
+
Time.parse(value)
|
220
257
|
when :Date
|
221
258
|
Date.parse(value)
|
222
259
|
when :String
|
@@ -225,7 +262,7 @@ module YNAB
|
|
225
262
|
value.to_i
|
226
263
|
when :Float
|
227
264
|
value.to_f
|
228
|
-
when :
|
265
|
+
when :Boolean
|
229
266
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
230
267
|
true
|
231
268
|
else
|
@@ -246,8 +283,9 @@ module YNAB
|
|
246
283
|
end
|
247
284
|
end
|
248
285
|
else # model
|
249
|
-
|
250
|
-
|
286
|
+
# models (e.g. Pet) or oneOf
|
287
|
+
klass = YNAB.const_get(type)
|
288
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
251
289
|
end
|
252
290
|
end
|
253
291
|
|
@@ -269,7 +307,11 @@ module YNAB
|
|
269
307
|
hash = {}
|
270
308
|
self.class.attribute_map.each_pair do |attr, param|
|
271
309
|
value = self.send(attr)
|
272
|
-
|
310
|
+
if value.nil?
|
311
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
312
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
313
|
+
end
|
314
|
+
|
273
315
|
hash[param] = _to_hash(value)
|
274
316
|
end
|
275
317
|
hash
|
@@ -1,16 +1,17 @@
|
|
1
1
|
=begin
|
2
2
|
#YNAB API Endpoints
|
3
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.
|
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 TransactionDetail
|
@@ -67,6 +68,7 @@ module YNAB
|
|
67
68
|
|
68
69
|
attr_accessor :payee_name
|
69
70
|
|
71
|
+
# The name of the category. If a split transaction, this will be 'Split'.
|
70
72
|
attr_accessor :category_name
|
71
73
|
|
72
74
|
# If a split transaction, the subtransactions.
|
@@ -122,15 +124,20 @@ module YNAB
|
|
122
124
|
}
|
123
125
|
end
|
124
126
|
|
127
|
+
# Returns all the JSON keys this model knows about
|
128
|
+
def self.acceptable_attributes
|
129
|
+
attribute_map.values
|
130
|
+
end
|
131
|
+
|
125
132
|
# Attribute type mapping.
|
126
|
-
def self.
|
133
|
+
def self.openapi_types
|
127
134
|
{
|
128
135
|
:'id' => :'String',
|
129
136
|
:'date' => :'Date',
|
130
137
|
:'amount' => :'Integer',
|
131
138
|
:'memo' => :'String',
|
132
139
|
:'cleared' => :'String',
|
133
|
-
:'approved' => :'
|
140
|
+
:'approved' => :'Boolean',
|
134
141
|
:'flag_color' => :'String',
|
135
142
|
:'account_id' => :'String',
|
136
143
|
:'payee_id' => :'String',
|
@@ -142,7 +149,7 @@ module YNAB
|
|
142
149
|
:'import_payee_name' => :'String',
|
143
150
|
:'import_payee_name_original' => :'String',
|
144
151
|
:'debt_transaction_type' => :'String',
|
145
|
-
:'deleted' => :'
|
152
|
+
:'deleted' => :'Boolean',
|
146
153
|
:'account_name' => :'String',
|
147
154
|
:'payee_name' => :'String',
|
148
155
|
:'category_name' => :'String',
|
@@ -150,99 +157,133 @@ module YNAB
|
|
150
157
|
}
|
151
158
|
end
|
152
159
|
|
160
|
+
# List of attributes with nullable: true
|
161
|
+
def self.openapi_nullable
|
162
|
+
Set.new([
|
163
|
+
:'memo',
|
164
|
+
:'flag_color',
|
165
|
+
:'payee_id',
|
166
|
+
:'category_id',
|
167
|
+
:'transfer_account_id',
|
168
|
+
:'transfer_transaction_id',
|
169
|
+
:'matched_transaction_id',
|
170
|
+
:'import_id',
|
171
|
+
:'import_payee_name',
|
172
|
+
:'import_payee_name_original',
|
173
|
+
:'debt_transaction_type',
|
174
|
+
:'payee_name',
|
175
|
+
:'category_name',
|
176
|
+
])
|
177
|
+
end
|
178
|
+
|
179
|
+
# List of class defined in allOf (OpenAPI v3)
|
180
|
+
def self.openapi_all_of
|
181
|
+
[
|
182
|
+
:'TransactionDetailAllOf',
|
183
|
+
:'TransactionSummary'
|
184
|
+
]
|
185
|
+
end
|
186
|
+
|
153
187
|
# Initializes the object
|
154
188
|
# @param [Hash] attributes Model attributes in the form of hash
|
155
189
|
def initialize(attributes = {})
|
156
|
-
|
190
|
+
if (!attributes.is_a?(Hash))
|
191
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::TransactionDetail` initialize method"
|
192
|
+
end
|
157
193
|
|
158
|
-
# convert string to symbol for hash key
|
159
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
194
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
195
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
196
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
197
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::TransactionDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
198
|
+
end
|
199
|
+
h[k.to_sym] = v
|
200
|
+
}
|
160
201
|
|
161
|
-
if attributes.
|
202
|
+
if attributes.key?(:'id')
|
162
203
|
self.id = attributes[:'id']
|
163
204
|
end
|
164
205
|
|
165
|
-
if attributes.
|
206
|
+
if attributes.key?(:'date')
|
166
207
|
self.date = attributes[:'date']
|
167
208
|
end
|
168
209
|
|
169
|
-
if attributes.
|
210
|
+
if attributes.key?(:'amount')
|
170
211
|
self.amount = attributes[:'amount']
|
171
212
|
end
|
172
213
|
|
173
|
-
if attributes.
|
214
|
+
if attributes.key?(:'memo')
|
174
215
|
self.memo = attributes[:'memo']
|
175
216
|
end
|
176
217
|
|
177
|
-
if attributes.
|
218
|
+
if attributes.key?(:'cleared')
|
178
219
|
self.cleared = attributes[:'cleared']
|
179
220
|
end
|
180
221
|
|
181
|
-
if attributes.
|
222
|
+
if attributes.key?(:'approved')
|
182
223
|
self.approved = attributes[:'approved']
|
183
224
|
end
|
184
225
|
|
185
|
-
if attributes.
|
226
|
+
if attributes.key?(:'flag_color')
|
186
227
|
self.flag_color = attributes[:'flag_color']
|
187
228
|
end
|
188
229
|
|
189
|
-
if attributes.
|
230
|
+
if attributes.key?(:'account_id')
|
190
231
|
self.account_id = attributes[:'account_id']
|
191
232
|
end
|
192
233
|
|
193
|
-
if attributes.
|
234
|
+
if attributes.key?(:'payee_id')
|
194
235
|
self.payee_id = attributes[:'payee_id']
|
195
236
|
end
|
196
237
|
|
197
|
-
if attributes.
|
238
|
+
if attributes.key?(:'category_id')
|
198
239
|
self.category_id = attributes[:'category_id']
|
199
240
|
end
|
200
241
|
|
201
|
-
if attributes.
|
242
|
+
if attributes.key?(:'transfer_account_id')
|
202
243
|
self.transfer_account_id = attributes[:'transfer_account_id']
|
203
244
|
end
|
204
245
|
|
205
|
-
if attributes.
|
246
|
+
if attributes.key?(:'transfer_transaction_id')
|
206
247
|
self.transfer_transaction_id = attributes[:'transfer_transaction_id']
|
207
248
|
end
|
208
249
|
|
209
|
-
if attributes.
|
250
|
+
if attributes.key?(:'matched_transaction_id')
|
210
251
|
self.matched_transaction_id = attributes[:'matched_transaction_id']
|
211
252
|
end
|
212
253
|
|
213
|
-
if attributes.
|
254
|
+
if attributes.key?(:'import_id')
|
214
255
|
self.import_id = attributes[:'import_id']
|
215
256
|
end
|
216
257
|
|
217
|
-
if attributes.
|
258
|
+
if attributes.key?(:'import_payee_name')
|
218
259
|
self.import_payee_name = attributes[:'import_payee_name']
|
219
260
|
end
|
220
261
|
|
221
|
-
if attributes.
|
262
|
+
if attributes.key?(:'import_payee_name_original')
|
222
263
|
self.import_payee_name_original = attributes[:'import_payee_name_original']
|
223
264
|
end
|
224
265
|
|
225
|
-
if attributes.
|
266
|
+
if attributes.key?(:'debt_transaction_type')
|
226
267
|
self.debt_transaction_type = attributes[:'debt_transaction_type']
|
227
268
|
end
|
228
269
|
|
229
|
-
if attributes.
|
270
|
+
if attributes.key?(:'deleted')
|
230
271
|
self.deleted = attributes[:'deleted']
|
231
272
|
end
|
232
273
|
|
233
|
-
if attributes.
|
274
|
+
if attributes.key?(:'account_name')
|
234
275
|
self.account_name = attributes[:'account_name']
|
235
276
|
end
|
236
277
|
|
237
|
-
if attributes.
|
278
|
+
if attributes.key?(:'payee_name')
|
238
279
|
self.payee_name = attributes[:'payee_name']
|
239
280
|
end
|
240
281
|
|
241
|
-
if attributes.
|
282
|
+
if attributes.key?(:'category_name')
|
242
283
|
self.category_name = attributes[:'category_name']
|
243
284
|
end
|
244
285
|
|
245
|
-
if attributes.
|
286
|
+
if attributes.key?(:'subtransactions')
|
246
287
|
if (value = attributes[:'subtransactions']).is_a?(Array)
|
247
288
|
self.subtransactions = value
|
248
289
|
end
|
@@ -299,13 +340,13 @@ module YNAB
|
|
299
340
|
return false if @date.nil?
|
300
341
|
return false if @amount.nil?
|
301
342
|
return false if @cleared.nil?
|
302
|
-
cleared_validator = EnumAttributeValidator.new('String', [
|
343
|
+
cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
303
344
|
return false unless cleared_validator.valid?(@cleared)
|
304
345
|
return false if @approved.nil?
|
305
|
-
flag_color_validator = EnumAttributeValidator.new('String', [
|
346
|
+
flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
306
347
|
return false unless flag_color_validator.valid?(@flag_color)
|
307
348
|
return false if @account_id.nil?
|
308
|
-
debt_transaction_type_validator = EnumAttributeValidator.new('String', [
|
349
|
+
debt_transaction_type_validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balancedAdjustment", "credit", "charge", "null"])
|
309
350
|
return false unless debt_transaction_type_validator.valid?(@debt_transaction_type)
|
310
351
|
return false if @deleted.nil?
|
311
352
|
return false if @account_name.nil?
|
@@ -316,18 +357,30 @@ module YNAB
|
|
316
357
|
# Custom attribute writer method checking allowed values (enum).
|
317
358
|
# @param [Object] cleared Object to be assigned
|
318
359
|
def cleared=(cleared)
|
360
|
+
validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
361
|
+
unless validator.valid?(cleared)
|
362
|
+
fail ArgumentError, "invalid value for \"cleared\", must be one of #{validator.allowable_values}."
|
363
|
+
end
|
319
364
|
@cleared = cleared
|
320
365
|
end
|
321
366
|
|
322
367
|
# Custom attribute writer method checking allowed values (enum).
|
323
368
|
# @param [Object] flag_color Object to be assigned
|
324
369
|
def flag_color=(flag_color)
|
370
|
+
validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
371
|
+
unless validator.valid?(flag_color)
|
372
|
+
fail ArgumentError, "invalid value for \"flag_color\", must be one of #{validator.allowable_values}."
|
373
|
+
end
|
325
374
|
@flag_color = flag_color
|
326
375
|
end
|
327
376
|
|
328
377
|
# Custom attribute writer method checking allowed values (enum).
|
329
378
|
# @param [Object] debt_transaction_type Object to be assigned
|
330
379
|
def debt_transaction_type=(debt_transaction_type)
|
380
|
+
validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balancedAdjustment", "credit", "charge", "null"])
|
381
|
+
unless validator.valid?(debt_transaction_type)
|
382
|
+
fail ArgumentError, "invalid value for \"debt_transaction_type\", must be one of #{validator.allowable_values}."
|
383
|
+
end
|
331
384
|
@debt_transaction_type = debt_transaction_type
|
332
385
|
end
|
333
386
|
|
@@ -367,17 +420,28 @@ module YNAB
|
|
367
420
|
end
|
368
421
|
|
369
422
|
# Calculates hash code according to all attributes.
|
370
|
-
# @return [
|
423
|
+
# @return [Integer] Hash code
|
371
424
|
def hash
|
372
425
|
[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, account_name, payee_name, category_name, subtransactions].hash
|
373
426
|
end
|
427
|
+
|
428
|
+
# Builds the object from hash
|
429
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
430
|
+
# @return [Object] Returns the model itself
|
431
|
+
def self.build_from_hash(attributes)
|
432
|
+
new.build_from_hash(attributes)
|
433
|
+
end
|
434
|
+
|
374
435
|
# Builds the object from hash
|
375
436
|
# @param [Hash] attributes Model attributes in the form of hash
|
376
437
|
# @return [Object] Returns the model itself
|
377
438
|
def build_from_hash(attributes)
|
378
439
|
return nil unless attributes.is_a?(Hash)
|
379
|
-
|
380
|
-
|
440
|
+
attributes = attributes.transform_keys(&:to_sym)
|
441
|
+
self.class.openapi_types.each_pair do |key, type|
|
442
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
443
|
+
self.send("#{key}=", nil)
|
444
|
+
elsif type =~ /\AArray<(.*)>/i
|
381
445
|
# check to ensure the input is an array given that the attribute
|
382
446
|
# is documented as an array but the input is not
|
383
447
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -385,7 +449,7 @@ module YNAB
|
|
385
449
|
end
|
386
450
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
387
451
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
388
|
-
end
|
452
|
+
end
|
389
453
|
end
|
390
454
|
|
391
455
|
self
|
@@ -397,8 +461,8 @@ module YNAB
|
|
397
461
|
# @return [Object] Deserialized data
|
398
462
|
def _deserialize(type, value)
|
399
463
|
case type.to_sym
|
400
|
-
when :
|
401
|
-
|
464
|
+
when :Time
|
465
|
+
Time.parse(value)
|
402
466
|
when :Date
|
403
467
|
Date.parse(value)
|
404
468
|
when :String
|
@@ -407,7 +471,7 @@ module YNAB
|
|
407
471
|
value.to_i
|
408
472
|
when :Float
|
409
473
|
value.to_f
|
410
|
-
when :
|
474
|
+
when :Boolean
|
411
475
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
412
476
|
true
|
413
477
|
else
|
@@ -428,8 +492,9 @@ module YNAB
|
|
428
492
|
end
|
429
493
|
end
|
430
494
|
else # model
|
431
|
-
|
432
|
-
|
495
|
+
# models (e.g. Pet) or oneOf
|
496
|
+
klass = YNAB.const_get(type)
|
497
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
433
498
|
end
|
434
499
|
end
|
435
500
|
|
@@ -451,7 +516,11 @@ module YNAB
|
|
451
516
|
hash = {}
|
452
517
|
self.class.attribute_map.each_pair do |attr, param|
|
453
518
|
value = self.send(attr)
|
454
|
-
|
519
|
+
if value.nil?
|
520
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
521
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
522
|
+
end
|
523
|
+
|
455
524
|
hash[param] = _to_hash(value)
|
456
525
|
end
|
457
526
|
hash
|