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,17 +3,20 @@
|
|
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 SaveTransactionWithId
|
18
|
+
attr_accessor :id
|
19
|
+
|
17
20
|
attr_accessor :account_id
|
18
21
|
|
19
22
|
# The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored.
|
@@ -45,11 +48,9 @@ module YNAB
|
|
45
48
|
# If specified, the new transaction will be assigned this `import_id` and considered \"imported\". We will also attempt to match this imported transaction to an existing \"user-entered\" transation on the same account, with the same amount, and with a date +/-10 days from the imported transaction date.<br><br>Transactions imported through File Based Import or Direct Import (not through the API) are assigned an import_id in the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. Using a consistent format will prevent duplicates through Direct Import and File Based Import.<br><br>If import_id is omitted or specified as null, the transaction will be treated as a \"user-entered\" transaction. As such, it will be eligible to be matched against transactions later being imported (via DI, FBI, or API).
|
46
49
|
attr_accessor :import_id
|
47
50
|
|
48
|
-
# An array of subtransactions to configure a transaction as a split.
|
51
|
+
# An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
|
49
52
|
attr_accessor :subtransactions
|
50
53
|
|
51
|
-
attr_accessor :id
|
52
|
-
|
53
54
|
class EnumAttributeValidator
|
54
55
|
attr_reader :datatype
|
55
56
|
attr_reader :allowable_values
|
@@ -75,6 +76,7 @@ module YNAB
|
|
75
76
|
# Attribute mapping from ruby-style variable name to JSON key.
|
76
77
|
def self.attribute_map
|
77
78
|
{
|
79
|
+
:'id' => :'id',
|
78
80
|
:'account_id' => :'account_id',
|
79
81
|
:'date' => :'date',
|
80
82
|
:'amount' => :'amount',
|
@@ -86,14 +88,19 @@ module YNAB
|
|
86
88
|
:'approved' => :'approved',
|
87
89
|
:'flag_color' => :'flag_color',
|
88
90
|
:'import_id' => :'import_id',
|
89
|
-
:'subtransactions' => :'subtransactions'
|
90
|
-
:'id' => :'id'
|
91
|
+
:'subtransactions' => :'subtransactions'
|
91
92
|
}
|
92
93
|
end
|
93
94
|
|
95
|
+
# Returns all the JSON keys this model knows about
|
96
|
+
def self.acceptable_attributes
|
97
|
+
attribute_map.values
|
98
|
+
end
|
99
|
+
|
94
100
|
# Attribute type mapping.
|
95
|
-
def self.
|
101
|
+
def self.openapi_types
|
96
102
|
{
|
103
|
+
:'id' => :'String',
|
97
104
|
:'account_id' => :'String',
|
98
105
|
:'date' => :'Date',
|
99
106
|
:'amount' => :'Integer',
|
@@ -102,75 +109,100 @@ module YNAB
|
|
102
109
|
:'category_id' => :'String',
|
103
110
|
:'memo' => :'String',
|
104
111
|
:'cleared' => :'String',
|
105
|
-
:'approved' => :'
|
112
|
+
:'approved' => :'Boolean',
|
106
113
|
:'flag_color' => :'String',
|
107
114
|
:'import_id' => :'String',
|
108
|
-
:'subtransactions' => :'Array<SaveSubTransaction>'
|
109
|
-
:'id' => :'String'
|
115
|
+
:'subtransactions' => :'Array<SaveSubTransaction>'
|
110
116
|
}
|
111
117
|
end
|
112
118
|
|
119
|
+
# List of attributes with nullable: true
|
120
|
+
def self.openapi_nullable
|
121
|
+
Set.new([
|
122
|
+
:'payee_id',
|
123
|
+
:'payee_name',
|
124
|
+
:'category_id',
|
125
|
+
:'memo',
|
126
|
+
:'import_id',
|
127
|
+
])
|
128
|
+
end
|
129
|
+
|
130
|
+
# List of class defined in allOf (OpenAPI v3)
|
131
|
+
def self.openapi_all_of
|
132
|
+
[
|
133
|
+
:'SaveTransactionWithIdAllOf',
|
134
|
+
:'SaveTransactionWithOptionalFields'
|
135
|
+
]
|
136
|
+
end
|
137
|
+
|
113
138
|
# Initializes the object
|
114
139
|
# @param [Hash] attributes Model attributes in the form of hash
|
115
140
|
def initialize(attributes = {})
|
116
|
-
|
141
|
+
if (!attributes.is_a?(Hash))
|
142
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveTransactionWithId` initialize method"
|
143
|
+
end
|
117
144
|
|
118
|
-
# convert string to symbol for hash key
|
119
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
145
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
146
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
147
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
148
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveTransactionWithId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
149
|
+
end
|
150
|
+
h[k.to_sym] = v
|
151
|
+
}
|
152
|
+
|
153
|
+
if attributes.key?(:'id')
|
154
|
+
self.id = attributes[:'id']
|
155
|
+
end
|
120
156
|
|
121
|
-
if attributes.
|
157
|
+
if attributes.key?(:'account_id')
|
122
158
|
self.account_id = attributes[:'account_id']
|
123
159
|
end
|
124
160
|
|
125
|
-
if attributes.
|
161
|
+
if attributes.key?(:'date')
|
126
162
|
self.date = attributes[:'date']
|
127
163
|
end
|
128
164
|
|
129
|
-
if attributes.
|
165
|
+
if attributes.key?(:'amount')
|
130
166
|
self.amount = attributes[:'amount']
|
131
167
|
end
|
132
168
|
|
133
|
-
if attributes.
|
169
|
+
if attributes.key?(:'payee_id')
|
134
170
|
self.payee_id = attributes[:'payee_id']
|
135
171
|
end
|
136
172
|
|
137
|
-
if attributes.
|
173
|
+
if attributes.key?(:'payee_name')
|
138
174
|
self.payee_name = attributes[:'payee_name']
|
139
175
|
end
|
140
176
|
|
141
|
-
if attributes.
|
177
|
+
if attributes.key?(:'category_id')
|
142
178
|
self.category_id = attributes[:'category_id']
|
143
179
|
end
|
144
180
|
|
145
|
-
if attributes.
|
181
|
+
if attributes.key?(:'memo')
|
146
182
|
self.memo = attributes[:'memo']
|
147
183
|
end
|
148
184
|
|
149
|
-
if attributes.
|
185
|
+
if attributes.key?(:'cleared')
|
150
186
|
self.cleared = attributes[:'cleared']
|
151
187
|
end
|
152
188
|
|
153
|
-
if attributes.
|
189
|
+
if attributes.key?(:'approved')
|
154
190
|
self.approved = attributes[:'approved']
|
155
191
|
end
|
156
192
|
|
157
|
-
if attributes.
|
193
|
+
if attributes.key?(:'flag_color')
|
158
194
|
self.flag_color = attributes[:'flag_color']
|
159
195
|
end
|
160
196
|
|
161
|
-
if attributes.
|
197
|
+
if attributes.key?(:'import_id')
|
162
198
|
self.import_id = attributes[:'import_id']
|
163
199
|
end
|
164
200
|
|
165
|
-
if attributes.
|
201
|
+
if attributes.key?(:'subtransactions')
|
166
202
|
if (value = attributes[:'subtransactions']).is_a?(Array)
|
167
203
|
self.subtransactions = value
|
168
204
|
end
|
169
205
|
end
|
170
|
-
|
171
|
-
if attributes.has_key?(:'id')
|
172
|
-
self.id = attributes[:'id']
|
173
|
-
end
|
174
206
|
end
|
175
207
|
|
176
208
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -197,9 +229,9 @@ module YNAB
|
|
197
229
|
def valid?
|
198
230
|
return false if !@payee_name.nil? && @payee_name.to_s.length > 50
|
199
231
|
return false if !@memo.nil? && @memo.to_s.length > 200
|
200
|
-
cleared_validator = EnumAttributeValidator.new('String', [
|
232
|
+
cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
201
233
|
return false unless cleared_validator.valid?(@cleared)
|
202
|
-
flag_color_validator = EnumAttributeValidator.new('String', [
|
234
|
+
flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
203
235
|
return false unless flag_color_validator.valid?(@flag_color)
|
204
236
|
return false if !@import_id.nil? && @import_id.to_s.length > 36
|
205
237
|
true
|
@@ -228,12 +260,20 @@ module YNAB
|
|
228
260
|
# Custom attribute writer method checking allowed values (enum).
|
229
261
|
# @param [Object] cleared Object to be assigned
|
230
262
|
def cleared=(cleared)
|
263
|
+
validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
264
|
+
unless validator.valid?(cleared)
|
265
|
+
fail ArgumentError, "invalid value for \"cleared\", must be one of #{validator.allowable_values}."
|
266
|
+
end
|
231
267
|
@cleared = cleared
|
232
268
|
end
|
233
269
|
|
234
270
|
# Custom attribute writer method checking allowed values (enum).
|
235
271
|
# @param [Object] flag_color Object to be assigned
|
236
272
|
def flag_color=(flag_color)
|
273
|
+
validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
274
|
+
unless validator.valid?(flag_color)
|
275
|
+
fail ArgumentError, "invalid value for \"flag_color\", must be one of #{validator.allowable_values}."
|
276
|
+
end
|
237
277
|
@flag_color = flag_color
|
238
278
|
end
|
239
279
|
|
@@ -252,6 +292,7 @@ module YNAB
|
|
252
292
|
def ==(o)
|
253
293
|
return true if self.equal?(o)
|
254
294
|
self.class == o.class &&
|
295
|
+
id == o.id &&
|
255
296
|
account_id == o.account_id &&
|
256
297
|
date == o.date &&
|
257
298
|
amount == o.amount &&
|
@@ -263,8 +304,7 @@ module YNAB
|
|
263
304
|
approved == o.approved &&
|
264
305
|
flag_color == o.flag_color &&
|
265
306
|
import_id == o.import_id &&
|
266
|
-
subtransactions == o.subtransactions
|
267
|
-
id == o.id
|
307
|
+
subtransactions == o.subtransactions
|
268
308
|
end
|
269
309
|
|
270
310
|
# @see the `==` method
|
@@ -274,17 +314,28 @@ module YNAB
|
|
274
314
|
end
|
275
315
|
|
276
316
|
# Calculates hash code according to all attributes.
|
277
|
-
# @return [
|
317
|
+
# @return [Integer] Hash code
|
278
318
|
def hash
|
279
|
-
[account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions
|
319
|
+
[id, account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions].hash
|
280
320
|
end
|
321
|
+
|
322
|
+
# Builds the object from hash
|
323
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
324
|
+
# @return [Object] Returns the model itself
|
325
|
+
def self.build_from_hash(attributes)
|
326
|
+
new.build_from_hash(attributes)
|
327
|
+
end
|
328
|
+
|
281
329
|
# Builds the object from hash
|
282
330
|
# @param [Hash] attributes Model attributes in the form of hash
|
283
331
|
# @return [Object] Returns the model itself
|
284
332
|
def build_from_hash(attributes)
|
285
333
|
return nil unless attributes.is_a?(Hash)
|
286
|
-
|
287
|
-
|
334
|
+
attributes = attributes.transform_keys(&:to_sym)
|
335
|
+
self.class.openapi_types.each_pair do |key, type|
|
336
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
337
|
+
self.send("#{key}=", nil)
|
338
|
+
elsif type =~ /\AArray<(.*)>/i
|
288
339
|
# check to ensure the input is an array given that the attribute
|
289
340
|
# is documented as an array but the input is not
|
290
341
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -292,7 +343,7 @@ module YNAB
|
|
292
343
|
end
|
293
344
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
294
345
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
295
|
-
end
|
346
|
+
end
|
296
347
|
end
|
297
348
|
|
298
349
|
self
|
@@ -304,8 +355,8 @@ module YNAB
|
|
304
355
|
# @return [Object] Deserialized data
|
305
356
|
def _deserialize(type, value)
|
306
357
|
case type.to_sym
|
307
|
-
when :
|
308
|
-
|
358
|
+
when :Time
|
359
|
+
Time.parse(value)
|
309
360
|
when :Date
|
310
361
|
Date.parse(value)
|
311
362
|
when :String
|
@@ -314,7 +365,7 @@ module YNAB
|
|
314
365
|
value.to_i
|
315
366
|
when :Float
|
316
367
|
value.to_f
|
317
|
-
when :
|
368
|
+
when :Boolean
|
318
369
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
319
370
|
true
|
320
371
|
else
|
@@ -335,8 +386,9 @@ module YNAB
|
|
335
386
|
end
|
336
387
|
end
|
337
388
|
else # model
|
338
|
-
|
339
|
-
|
389
|
+
# models (e.g. Pet) or oneOf
|
390
|
+
klass = YNAB.const_get(type)
|
391
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
340
392
|
end
|
341
393
|
end
|
342
394
|
|
@@ -358,7 +410,11 @@ module YNAB
|
|
358
410
|
hash = {}
|
359
411
|
self.class.attribute_map.each_pair do |attr, param|
|
360
412
|
value = self.send(attr)
|
361
|
-
|
413
|
+
if value.nil?
|
414
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
415
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
416
|
+
end
|
417
|
+
|
362
418
|
hash[param] = _to_hash(value)
|
363
419
|
end
|
364
420
|
hash
|
@@ -1,55 +1,64 @@
|
|
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
|
-
class
|
17
|
-
attr_accessor :
|
18
|
-
|
19
|
-
attr_accessor :transactions
|
17
|
+
class SaveTransactionWithIdAllOf
|
18
|
+
attr_accessor :id
|
20
19
|
|
21
20
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
21
|
def self.attribute_map
|
23
22
|
{
|
24
|
-
:'
|
25
|
-
:'transactions' => :'transactions'
|
23
|
+
:'id' => :'id'
|
26
24
|
}
|
27
25
|
end
|
28
26
|
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
29
32
|
# Attribute type mapping.
|
30
|
-
def self.
|
33
|
+
def self.openapi_types
|
31
34
|
{
|
32
|
-
:'
|
33
|
-
:'transactions' => :'Array<SaveTransaction>'
|
35
|
+
:'id' => :'String'
|
34
36
|
}
|
35
37
|
end
|
36
38
|
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
37
45
|
# Initializes the object
|
38
46
|
# @param [Hash] attributes Model attributes in the form of hash
|
39
47
|
def initialize(attributes = {})
|
40
|
-
|
41
|
-
|
42
|
-
# convert string to symbol for hash key
|
43
|
-
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
44
|
-
|
45
|
-
if attributes.has_key?(:'transaction')
|
46
|
-
self.transaction = attributes[:'transaction']
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveTransactionWithIdAllOf` initialize method"
|
47
50
|
end
|
48
51
|
|
49
|
-
if
|
50
|
-
|
51
|
-
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveTransactionWithIdAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
52
56
|
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'id')
|
61
|
+
self.id = attributes[:'id']
|
53
62
|
end
|
54
63
|
end
|
55
64
|
|
@@ -71,8 +80,7 @@ module YNAB
|
|
71
80
|
def ==(o)
|
72
81
|
return true if self.equal?(o)
|
73
82
|
self.class == o.class &&
|
74
|
-
|
75
|
-
transactions == o.transactions
|
83
|
+
id == o.id
|
76
84
|
end
|
77
85
|
|
78
86
|
# @see the `==` method
|
@@ -82,17 +90,28 @@ module YNAB
|
|
82
90
|
end
|
83
91
|
|
84
92
|
# Calculates hash code according to all attributes.
|
85
|
-
# @return [
|
93
|
+
# @return [Integer] Hash code
|
86
94
|
def hash
|
87
|
-
[
|
95
|
+
[id].hash
|
88
96
|
end
|
97
|
+
|
98
|
+
# Builds the object from hash
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
# @return [Object] Returns the model itself
|
101
|
+
def self.build_from_hash(attributes)
|
102
|
+
new.build_from_hash(attributes)
|
103
|
+
end
|
104
|
+
|
89
105
|
# Builds the object from hash
|
90
106
|
# @param [Hash] attributes Model attributes in the form of hash
|
91
107
|
# @return [Object] Returns the model itself
|
92
108
|
def build_from_hash(attributes)
|
93
109
|
return nil unless attributes.is_a?(Hash)
|
94
|
-
|
95
|
-
|
110
|
+
attributes = attributes.transform_keys(&:to_sym)
|
111
|
+
self.class.openapi_types.each_pair do |key, type|
|
112
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
113
|
+
self.send("#{key}=", nil)
|
114
|
+
elsif type =~ /\AArray<(.*)>/i
|
96
115
|
# check to ensure the input is an array given that the attribute
|
97
116
|
# is documented as an array but the input is not
|
98
117
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -100,7 +119,7 @@ module YNAB
|
|
100
119
|
end
|
101
120
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
102
121
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
103
|
-
end
|
122
|
+
end
|
104
123
|
end
|
105
124
|
|
106
125
|
self
|
@@ -112,8 +131,8 @@ module YNAB
|
|
112
131
|
# @return [Object] Deserialized data
|
113
132
|
def _deserialize(type, value)
|
114
133
|
case type.to_sym
|
115
|
-
when :
|
116
|
-
|
134
|
+
when :Time
|
135
|
+
Time.parse(value)
|
117
136
|
when :Date
|
118
137
|
Date.parse(value)
|
119
138
|
when :String
|
@@ -122,7 +141,7 @@ module YNAB
|
|
122
141
|
value.to_i
|
123
142
|
when :Float
|
124
143
|
value.to_f
|
125
|
-
when :
|
144
|
+
when :Boolean
|
126
145
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
127
146
|
true
|
128
147
|
else
|
@@ -143,8 +162,9 @@ module YNAB
|
|
143
162
|
end
|
144
163
|
end
|
145
164
|
else # model
|
146
|
-
|
147
|
-
|
165
|
+
# models (e.g. Pet) or oneOf
|
166
|
+
klass = YNAB.const_get(type)
|
167
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
148
168
|
end
|
149
169
|
end
|
150
170
|
|
@@ -166,7 +186,11 @@ module YNAB
|
|
166
186
|
hash = {}
|
167
187
|
self.class.attribute_map.each_pair do |attr, param|
|
168
188
|
value = self.send(attr)
|
169
|
-
|
189
|
+
if value.nil?
|
190
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
191
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
192
|
+
end
|
193
|
+
|
170
194
|
hash[param] = _to_hash(value)
|
171
195
|
end
|
172
196
|
hash
|