ynab 1.31.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 +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 +194 -87
- 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 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
|
@@ -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 TransactionDetail
|
@@ -123,15 +124,20 @@ module YNAB
|
|
123
124
|
}
|
124
125
|
end
|
125
126
|
|
127
|
+
# Returns all the JSON keys this model knows about
|
128
|
+
def self.acceptable_attributes
|
129
|
+
attribute_map.values
|
130
|
+
end
|
131
|
+
|
126
132
|
# Attribute type mapping.
|
127
|
-
def self.
|
133
|
+
def self.openapi_types
|
128
134
|
{
|
129
135
|
:'id' => :'String',
|
130
136
|
:'date' => :'Date',
|
131
137
|
:'amount' => :'Integer',
|
132
138
|
:'memo' => :'String',
|
133
139
|
:'cleared' => :'String',
|
134
|
-
:'approved' => :'
|
140
|
+
:'approved' => :'Boolean',
|
135
141
|
:'flag_color' => :'String',
|
136
142
|
:'account_id' => :'String',
|
137
143
|
:'payee_id' => :'String',
|
@@ -143,7 +149,7 @@ module YNAB
|
|
143
149
|
:'import_payee_name' => :'String',
|
144
150
|
:'import_payee_name_original' => :'String',
|
145
151
|
:'debt_transaction_type' => :'String',
|
146
|
-
:'deleted' => :'
|
152
|
+
:'deleted' => :'Boolean',
|
147
153
|
:'account_name' => :'String',
|
148
154
|
:'payee_name' => :'String',
|
149
155
|
:'category_name' => :'String',
|
@@ -151,99 +157,133 @@ module YNAB
|
|
151
157
|
}
|
152
158
|
end
|
153
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
|
+
|
154
187
|
# Initializes the object
|
155
188
|
# @param [Hash] attributes Model attributes in the form of hash
|
156
189
|
def initialize(attributes = {})
|
157
|
-
|
190
|
+
if (!attributes.is_a?(Hash))
|
191
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::TransactionDetail` initialize method"
|
192
|
+
end
|
158
193
|
|
159
|
-
# convert string to symbol for hash key
|
160
|
-
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
|
+
}
|
161
201
|
|
162
|
-
if attributes.
|
202
|
+
if attributes.key?(:'id')
|
163
203
|
self.id = attributes[:'id']
|
164
204
|
end
|
165
205
|
|
166
|
-
if attributes.
|
206
|
+
if attributes.key?(:'date')
|
167
207
|
self.date = attributes[:'date']
|
168
208
|
end
|
169
209
|
|
170
|
-
if attributes.
|
210
|
+
if attributes.key?(:'amount')
|
171
211
|
self.amount = attributes[:'amount']
|
172
212
|
end
|
173
213
|
|
174
|
-
if attributes.
|
214
|
+
if attributes.key?(:'memo')
|
175
215
|
self.memo = attributes[:'memo']
|
176
216
|
end
|
177
217
|
|
178
|
-
if attributes.
|
218
|
+
if attributes.key?(:'cleared')
|
179
219
|
self.cleared = attributes[:'cleared']
|
180
220
|
end
|
181
221
|
|
182
|
-
if attributes.
|
222
|
+
if attributes.key?(:'approved')
|
183
223
|
self.approved = attributes[:'approved']
|
184
224
|
end
|
185
225
|
|
186
|
-
if attributes.
|
226
|
+
if attributes.key?(:'flag_color')
|
187
227
|
self.flag_color = attributes[:'flag_color']
|
188
228
|
end
|
189
229
|
|
190
|
-
if attributes.
|
230
|
+
if attributes.key?(:'account_id')
|
191
231
|
self.account_id = attributes[:'account_id']
|
192
232
|
end
|
193
233
|
|
194
|
-
if attributes.
|
234
|
+
if attributes.key?(:'payee_id')
|
195
235
|
self.payee_id = attributes[:'payee_id']
|
196
236
|
end
|
197
237
|
|
198
|
-
if attributes.
|
238
|
+
if attributes.key?(:'category_id')
|
199
239
|
self.category_id = attributes[:'category_id']
|
200
240
|
end
|
201
241
|
|
202
|
-
if attributes.
|
242
|
+
if attributes.key?(:'transfer_account_id')
|
203
243
|
self.transfer_account_id = attributes[:'transfer_account_id']
|
204
244
|
end
|
205
245
|
|
206
|
-
if attributes.
|
246
|
+
if attributes.key?(:'transfer_transaction_id')
|
207
247
|
self.transfer_transaction_id = attributes[:'transfer_transaction_id']
|
208
248
|
end
|
209
249
|
|
210
|
-
if attributes.
|
250
|
+
if attributes.key?(:'matched_transaction_id')
|
211
251
|
self.matched_transaction_id = attributes[:'matched_transaction_id']
|
212
252
|
end
|
213
253
|
|
214
|
-
if attributes.
|
254
|
+
if attributes.key?(:'import_id')
|
215
255
|
self.import_id = attributes[:'import_id']
|
216
256
|
end
|
217
257
|
|
218
|
-
if attributes.
|
258
|
+
if attributes.key?(:'import_payee_name')
|
219
259
|
self.import_payee_name = attributes[:'import_payee_name']
|
220
260
|
end
|
221
261
|
|
222
|
-
if attributes.
|
262
|
+
if attributes.key?(:'import_payee_name_original')
|
223
263
|
self.import_payee_name_original = attributes[:'import_payee_name_original']
|
224
264
|
end
|
225
265
|
|
226
|
-
if attributes.
|
266
|
+
if attributes.key?(:'debt_transaction_type')
|
227
267
|
self.debt_transaction_type = attributes[:'debt_transaction_type']
|
228
268
|
end
|
229
269
|
|
230
|
-
if attributes.
|
270
|
+
if attributes.key?(:'deleted')
|
231
271
|
self.deleted = attributes[:'deleted']
|
232
272
|
end
|
233
273
|
|
234
|
-
if attributes.
|
274
|
+
if attributes.key?(:'account_name')
|
235
275
|
self.account_name = attributes[:'account_name']
|
236
276
|
end
|
237
277
|
|
238
|
-
if attributes.
|
278
|
+
if attributes.key?(:'payee_name')
|
239
279
|
self.payee_name = attributes[:'payee_name']
|
240
280
|
end
|
241
281
|
|
242
|
-
if attributes.
|
282
|
+
if attributes.key?(:'category_name')
|
243
283
|
self.category_name = attributes[:'category_name']
|
244
284
|
end
|
245
285
|
|
246
|
-
if attributes.
|
286
|
+
if attributes.key?(:'subtransactions')
|
247
287
|
if (value = attributes[:'subtransactions']).is_a?(Array)
|
248
288
|
self.subtransactions = value
|
249
289
|
end
|
@@ -300,13 +340,13 @@ module YNAB
|
|
300
340
|
return false if @date.nil?
|
301
341
|
return false if @amount.nil?
|
302
342
|
return false if @cleared.nil?
|
303
|
-
cleared_validator = EnumAttributeValidator.new('String', [
|
343
|
+
cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
304
344
|
return false unless cleared_validator.valid?(@cleared)
|
305
345
|
return false if @approved.nil?
|
306
|
-
flag_color_validator = EnumAttributeValidator.new('String', [
|
346
|
+
flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
307
347
|
return false unless flag_color_validator.valid?(@flag_color)
|
308
348
|
return false if @account_id.nil?
|
309
|
-
debt_transaction_type_validator = EnumAttributeValidator.new('String', [
|
349
|
+
debt_transaction_type_validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balancedAdjustment", "credit", "charge", "null"])
|
310
350
|
return false unless debt_transaction_type_validator.valid?(@debt_transaction_type)
|
311
351
|
return false if @deleted.nil?
|
312
352
|
return false if @account_name.nil?
|
@@ -317,18 +357,30 @@ module YNAB
|
|
317
357
|
# Custom attribute writer method checking allowed values (enum).
|
318
358
|
# @param [Object] cleared Object to be assigned
|
319
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
|
320
364
|
@cleared = cleared
|
321
365
|
end
|
322
366
|
|
323
367
|
# Custom attribute writer method checking allowed values (enum).
|
324
368
|
# @param [Object] flag_color Object to be assigned
|
325
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
|
326
374
|
@flag_color = flag_color
|
327
375
|
end
|
328
376
|
|
329
377
|
# Custom attribute writer method checking allowed values (enum).
|
330
378
|
# @param [Object] debt_transaction_type Object to be assigned
|
331
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
|
332
384
|
@debt_transaction_type = debt_transaction_type
|
333
385
|
end
|
334
386
|
|
@@ -368,17 +420,28 @@ module YNAB
|
|
368
420
|
end
|
369
421
|
|
370
422
|
# Calculates hash code according to all attributes.
|
371
|
-
# @return [
|
423
|
+
# @return [Integer] Hash code
|
372
424
|
def hash
|
373
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
|
374
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
|
+
|
375
435
|
# Builds the object from hash
|
376
436
|
# @param [Hash] attributes Model attributes in the form of hash
|
377
437
|
# @return [Object] Returns the model itself
|
378
438
|
def build_from_hash(attributes)
|
379
439
|
return nil unless attributes.is_a?(Hash)
|
380
|
-
|
381
|
-
|
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
|
382
445
|
# check to ensure the input is an array given that the attribute
|
383
446
|
# is documented as an array but the input is not
|
384
447
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -386,7 +449,7 @@ module YNAB
|
|
386
449
|
end
|
387
450
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
388
451
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
389
|
-
end
|
452
|
+
end
|
390
453
|
end
|
391
454
|
|
392
455
|
self
|
@@ -398,8 +461,8 @@ module YNAB
|
|
398
461
|
# @return [Object] Deserialized data
|
399
462
|
def _deserialize(type, value)
|
400
463
|
case type.to_sym
|
401
|
-
when :
|
402
|
-
|
464
|
+
when :Time
|
465
|
+
Time.parse(value)
|
403
466
|
when :Date
|
404
467
|
Date.parse(value)
|
405
468
|
when :String
|
@@ -408,7 +471,7 @@ module YNAB
|
|
408
471
|
value.to_i
|
409
472
|
when :Float
|
410
473
|
value.to_f
|
411
|
-
when :
|
474
|
+
when :Boolean
|
412
475
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
413
476
|
true
|
414
477
|
else
|
@@ -429,8 +492,9 @@ module YNAB
|
|
429
492
|
end
|
430
493
|
end
|
431
494
|
else # model
|
432
|
-
|
433
|
-
|
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)
|
434
498
|
end
|
435
499
|
end
|
436
500
|
|
@@ -452,7 +516,11 @@ module YNAB
|
|
452
516
|
hash = {}
|
453
517
|
self.class.attribute_map.each_pair do |attr, param|
|
454
518
|
value = self.send(attr)
|
455
|
-
|
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
|
+
|
456
524
|
hash[param] = _to_hash(value)
|
457
525
|
end
|
458
526
|
hash
|