ynab 1.31.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/DEVELOPMENT.md +11 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +42 -0
- data/README.md +3 -3
- data/Rakefile +58 -0
- data/config.json +9 -0
- data/docs/Account.md +25 -0
- data/docs/AccountResponse.md +8 -0
- data/docs/AccountResponseData.md +8 -0
- data/docs/AccountType.md +7 -0
- data/docs/AccountWrapper.md +8 -0
- data/docs/AccountsApi.md +70 -0
- data/docs/AccountsResponse.md +8 -0
- data/docs/AccountsResponseData.md +9 -0
- data/docs/AccountsWrapper.md +9 -0
- data/docs/BudgetDetail.md +24 -0
- data/docs/BudgetDetailAllOf.md +17 -0
- data/docs/BudgetDetailResponse.md +8 -0
- data/docs/BudgetDetailResponseData.md +9 -0
- data/docs/BudgetDetailWrapper.md +9 -0
- data/docs/BudgetSettings.md +9 -0
- data/docs/BudgetSettingsResponse.md +8 -0
- data/docs/BudgetSettingsResponseData.md +8 -0
- data/docs/BudgetSettingsWrapper.md +8 -0
- data/docs/BudgetSummary.md +15 -0
- data/docs/BudgetSummaryResponse.md +8 -0
- data/docs/BudgetSummaryResponseData.md +9 -0
- data/docs/BudgetSummaryWrapper.md +9 -0
- data/docs/BudgetsApi.md +68 -0
- data/docs/BulkIdWrapper.md +8 -0
- data/docs/BulkIds.md +9 -0
- data/docs/BulkResponse.md +8 -0
- data/docs/BulkResponseData.md +8 -0
- data/docs/BulkResponseDataBulk.md +9 -0
- data/docs/BulkTransactionCreateResponse.md +8 -0
- data/docs/BulkTransactionIds.md +8 -0
- data/docs/BulkTransactions.md +8 -0
- data/docs/CategoriesApi.md +94 -0
- data/docs/CategoriesResponse.md +8 -0
- data/docs/CategoriesResponseData.md +9 -0
- data/docs/Category.md +30 -0
- data/docs/CategoryGroup.md +11 -0
- data/docs/CategoryGroupWithCategories.md +12 -0
- data/docs/CategoryGroupWithCategoriesAllOf.md +8 -0
- data/docs/CategoryGroupsWrapper.md +9 -0
- data/docs/CategoryResponse.md +8 -0
- data/docs/CategoryResponseData.md +8 -0
- data/docs/CategoryWrapper.md +9 -0
- data/docs/CurrencyFormat.md +15 -0
- data/docs/DateFormat.md +8 -0
- data/docs/DeprecatedApi.md +28 -0
- data/docs/ErrorDetail.md +10 -0
- data/docs/ErrorResponse.md +8 -0
- data/docs/HybridTransaction.md +30 -0
- data/docs/HybridTransactionAllOf.md +12 -0
- data/docs/HybridTransactionsResponse.md +8 -0
- data/docs/HybridTransactionsResponseData.md +9 -0
- data/docs/HybridTransactionsWrapper.md +8 -0
- data/docs/LoanAccountPeriodicValue.md +7 -0
- data/docs/MonthDetail.md +16 -0
- data/docs/MonthDetailAllOf.md +8 -0
- data/docs/MonthDetailResponse.md +8 -0
- data/docs/MonthDetailResponseData.md +8 -0
- data/docs/MonthDetailWrapper.md +8 -0
- data/docs/MonthSummariesResponse.md +8 -0
- data/docs/MonthSummariesResponseData.md +9 -0
- data/docs/MonthSummariesWrapper.md +9 -0
- data/docs/MonthSummary.md +15 -0
- data/docs/MonthsApi.md +49 -0
- data/docs/PatchMonthCategoryWrapper.md +8 -0
- data/docs/PatchTransactionsWrapper.md +8 -0
- data/docs/Payee.md +11 -0
- data/docs/PayeeLocation.md +12 -0
- data/docs/PayeeLocationResponse.md +8 -0
- data/docs/PayeeLocationResponseData.md +8 -0
- data/docs/PayeeLocationWrapper.md +8 -0
- data/docs/PayeeLocationsApi.md +69 -0
- data/docs/PayeeLocationsResponse.md +8 -0
- data/docs/PayeeLocationsResponseData.md +8 -0
- data/docs/PayeeLocationsWrapper.md +8 -0
- data/docs/PayeeResponse.md +8 -0
- data/docs/PayeeResponseData.md +8 -0
- data/docs/PayeeWrapper.md +8 -0
- data/docs/PayeesApi.md +49 -0
- data/docs/PayeesResponse.md +8 -0
- data/docs/PayeesResponseData.md +9 -0
- data/docs/PayeesWrapper.md +9 -0
- data/docs/PostAccountWrapper.md +8 -0
- data/docs/PostTransactionsWrapper.md +9 -0
- data/docs/PutTransactionWrapper.md +8 -0
- data/docs/SaveAccount.md +10 -0
- data/docs/SaveAccountWrapper.md +8 -0
- data/docs/SaveCategoryResponse.md +8 -0
- data/docs/SaveCategoryResponseData.md +9 -0
- data/docs/SaveMonthCategory.md +8 -0
- data/docs/SaveMonthCategoryWrapper.md +8 -0
- data/docs/SaveSubTransaction.md +12 -0
- data/docs/SaveTransaction.md +19 -0
- data/docs/SaveTransactionWithId.md +20 -0
- data/docs/SaveTransactionWithIdAllOf.md +8 -0
- data/docs/SaveTransactionWithOptionalFields.md +19 -0
- data/docs/SaveTransactionWrapper.md +8 -0
- data/docs/SaveTransactionsResponse.md +8 -0
- data/docs/SaveTransactionsResponseData.md +12 -0
- data/docs/SaveTransactionsWrapper.md +9 -0
- data/docs/ScheduledSubTransaction.md +15 -0
- data/docs/ScheduledTransactionDetail.md +23 -0
- data/docs/ScheduledTransactionDetailAllOf.md +11 -0
- data/docs/ScheduledTransactionResponse.md +8 -0
- data/docs/ScheduledTransactionResponseData.md +8 -0
- data/docs/ScheduledTransactionSummary.md +19 -0
- data/docs/ScheduledTransactionWrapper.md +8 -0
- data/docs/ScheduledTransactionsApi.md +49 -0
- data/docs/ScheduledTransactionsResponse.md +8 -0
- data/docs/ScheduledTransactionsResponseData.md +9 -0
- data/docs/ScheduledTransactionsWrapper.md +8 -0
- data/docs/SubTransaction.md +18 -0
- data/docs/TransactionDetail.md +29 -0
- data/docs/TransactionDetailAllOf.md +11 -0
- data/docs/TransactionResponse.md +8 -0
- data/docs/TransactionResponseData.md +8 -0
- data/docs/TransactionSummary.md +25 -0
- data/docs/TransactionWrapper.md +8 -0
- data/docs/TransactionsApi.md +228 -0
- data/docs/TransactionsImportResponse.md +8 -0
- data/docs/TransactionsImportResponseData.md +8 -0
- data/docs/TransactionsResponse.md +8 -0
- data/docs/TransactionsResponseData.md +9 -0
- data/docs/TransactionsWrapper.md +9 -0
- data/docs/UpdateTransaction.md +20 -0
- data/docs/UpdateTransactionsWrapper.md +8 -0
- data/docs/User.md +8 -0
- data/docs/UserApi.md +25 -0
- data/docs/UserResponse.md +8 -0
- data/docs/UserResponseData.md +8 -0
- data/docs/UserWrapper.md +8 -0
- data/examples/budget-list.rb +21 -0
- data/examples/budget-month.rb +33 -0
- data/examples/category-balance.rb +23 -0
- data/examples/create-multiple-transactions.rb +42 -0
- data/examples/create-transaction.rb +30 -0
- data/examples/update-category-budgeted.rb +25 -0
- data/examples/update-multiple-transactions.rb +20 -0
- data/lib/ynab/api/accounts_api.rb +78 -41
- data/lib/ynab/api/budgets_api.rb +68 -36
- data/lib/ynab/api/categories_api.rb +108 -60
- data/lib/ynab/api/deprecated_api.rb +32 -17
- data/lib/ynab/api/months_api.rb +49 -28
- data/lib/ynab/api/payee_locations_api.rb +73 -41
- data/lib/ynab/api/payees_api.rb +49 -28
- data/lib/ynab/api/scheduled_transactions_api.rb +49 -28
- data/lib/ynab/api/transactions_api.rb +268 -140
- data/lib/ynab/api/user_api.rb +22 -12
- data/lib/ynab/api_client.rb +97 -95
- data/lib/ynab/configuration.rb +101 -14
- data/lib/ynab/models/account.rb +117 -55
- data/lib/ynab/models/account_response.rb +53 -18
- data/lib/ynab/models/account_response_data.rb +53 -18
- data/lib/ynab/models/account_type.rb +30 -20
- data/lib/ynab/models/accounts_response.rb +53 -18
- data/lib/ynab/models/accounts_response_data.rb +54 -19
- data/lib/ynab/models/budget_detail.rb +80 -35
- data/lib/ynab/models/budget_detail_all_of.rb +320 -0
- data/lib/ynab/models/budget_detail_response.rb +53 -18
- data/lib/ynab/models/budget_detail_response_data.rb +54 -19
- data/lib/ynab/models/budget_settings.rb +56 -29
- data/lib/ynab/models/budget_settings_response.rb +53 -18
- data/lib/ynab/models/budget_settings_response_data.rb +53 -18
- data/lib/ynab/models/budget_summary.rb +63 -26
- data/lib/ynab/models/budget_summary_response.rb +53 -18
- data/lib/ynab/models/budget_summary_response_data.rb +54 -20
- data/lib/ynab/models/bulk_response.rb +53 -18
- data/lib/ynab/models/bulk_response_data.rb +53 -18
- data/lib/ynab/models/bulk_response_data_bulk.rb +54 -19
- data/lib/ynab/models/bulk_transactions.rb +53 -18
- data/lib/ynab/models/categories_response.rb +53 -18
- data/lib/ynab/models/categories_response_data.rb +54 -19
- data/lib/ynab/models/category.rb +110 -48
- data/lib/ynab/models/category_group.rb +58 -23
- data/lib/ynab/models/category_group_with_categories.rb +67 -24
- data/lib/ynab/models/{save_month_category_wrapper.rb → category_group_with_categories_all_of.rb} +67 -29
- data/lib/ynab/models/category_response.rb +53 -18
- data/lib/ynab/models/category_response_data.rb +53 -18
- data/lib/ynab/models/currency_format.rb +62 -27
- data/lib/ynab/models/date_format.rb +53 -18
- data/lib/ynab/models/error_detail.rb +55 -20
- data/lib/ynab/models/error_response.rb +53 -18
- data/lib/ynab/models/hybrid_transaction.rb +118 -46
- data/lib/ynab/models/hybrid_transaction_all_of.rb +304 -0
- data/lib/ynab/models/hybrid_transactions_response.rb +53 -18
- data/lib/ynab/models/hybrid_transactions_response_data.rb +54 -19
- data/lib/ynab/models/month_detail.rb +72 -27
- data/lib/ynab/models/{update_transactions_wrapper.rb → month_detail_all_of.rb} +66 -30
- data/lib/ynab/models/month_detail_response.rb +53 -18
- data/lib/ynab/models/month_detail_response_data.rb +53 -18
- data/lib/ynab/models/month_summaries_response.rb +53 -18
- data/lib/ynab/models/month_summaries_response_data.rb +54 -19
- data/lib/ynab/models/month_summary.rb +63 -26
- data/lib/ynab/models/patch_month_category_wrapper.rb +53 -18
- data/lib/ynab/models/patch_transactions_wrapper.rb +53 -18
- data/lib/ynab/models/payee.rb +58 -22
- data/lib/ynab/models/payee_location.rb +58 -23
- data/lib/ynab/models/payee_location_response.rb +53 -18
- data/lib/ynab/models/payee_location_response_data.rb +53 -18
- data/lib/ynab/models/payee_locations_response.rb +53 -18
- data/lib/ynab/models/payee_locations_response_data.rb +53 -18
- data/lib/ynab/models/payee_response.rb +53 -18
- data/lib/ynab/models/payee_response_data.rb +53 -18
- data/lib/ynab/models/payees_response.rb +53 -18
- data/lib/ynab/models/payees_response_data.rb +54 -19
- data/lib/ynab/models/post_account_wrapper.rb +53 -18
- data/lib/ynab/models/post_transactions_wrapper.rb +54 -19
- data/lib/ynab/models/put_transaction_wrapper.rb +53 -18
- data/lib/ynab/models/save_account.rb +77 -20
- data/lib/ynab/models/save_category_response.rb +53 -18
- data/lib/ynab/models/save_category_response_data.rb +54 -19
- data/lib/ynab/models/save_month_category.rb +53 -18
- data/lib/ynab/models/save_sub_transaction.rb +61 -22
- data/lib/ynab/models/save_transaction.rb +88 -33
- data/lib/ynab/models/save_transaction_with_id.rb +102 -46
- data/lib/ynab/models/{save_transactions_wrapper.rb → save_transaction_with_id_all_of.rb} +60 -36
- data/lib/ynab/models/save_transaction_with_optional_fields.rb +81 -33
- data/lib/ynab/models/save_transactions_response.rb +53 -18
- data/lib/ynab/models/save_transactions_response_data.rb +57 -23
- data/lib/ynab/models/scheduled_sub_transaction.rb +66 -27
- data/lib/ynab/models/scheduled_transaction_detail.rb +94 -36
- data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +262 -0
- data/lib/ynab/models/scheduled_transaction_response.rb +53 -18
- data/lib/ynab/models/scheduled_transaction_response_data.rb +53 -18
- data/lib/ynab/models/scheduled_transaction_summary.rb +80 -32
- data/lib/ynab/models/scheduled_transactions_response.rb +53 -18
- data/lib/ynab/models/scheduled_transactions_response_data.rb +54 -19
- data/lib/ynab/models/sub_transaction.rb +71 -29
- data/lib/ynab/models/transaction_detail.rb +112 -44
- data/lib/ynab/models/{save_transaction_wrapper.rb → transaction_detail_all_of.rb} +102 -29
- data/lib/ynab/models/transaction_response.rb +53 -18
- data/lib/ynab/models/transaction_response_data.rb +53 -18
- data/lib/ynab/models/transaction_summary.rb +98 -40
- data/lib/ynab/models/transactions_import_response.rb +53 -18
- data/lib/ynab/models/transactions_import_response_data.rb +53 -18
- data/lib/ynab/models/transactions_response.rb +53 -18
- data/lib/ynab/models/transactions_response_data.rb +54 -19
- data/lib/ynab/models/user.rb +53 -18
- data/lib/ynab/models/user_response.rb +53 -18
- data/lib/ynab/models/user_response_data.rb +53 -18
- data/lib/ynab/version.rb +1 -1
- data/lib/ynab.rb +19 -14
- data/open_api_spec.yaml +3012 -0
- data/templates/api_client.mustache +274 -0
- data/templates/api_client_typhoeus_partial.mustache +156 -0
- data/templates/api_doc.mustache +44 -0
- data/templates/gem.mustache +84 -0
- data/templates/partial_model_generic_doc.mustache +9 -0
- data/ynab.gemspec +38 -0
- metadata +192 -85
- data/lib/ynab/models/loan_account_periodic_value.rb +0 -175
- data/lib/ynab/models/save_account_wrapper.rb +0 -189
- data/lib/ynab/models/update_transaction.rb +0 -407
- data/spec/models/transaction_detail_spec.rb +0 -11
@@ -3,14 +3,15 @@
|
|
3
3
|
|
4
4
|
#Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
7
|
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
|
15
16
|
module YNAB
|
16
17
|
class ScheduledSubTransaction
|
@@ -30,7 +31,7 @@ module YNAB
|
|
30
31
|
# If a transfer, the account_id which the scheduled subtransaction transfers to
|
31
32
|
attr_accessor :transfer_account_id
|
32
33
|
|
33
|
-
# Whether or not the scheduled subtransaction has been deleted.
|
34
|
+
# Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests.
|
34
35
|
attr_accessor :deleted
|
35
36
|
|
36
37
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -47,8 +48,13 @@ module YNAB
|
|
47
48
|
}
|
48
49
|
end
|
49
50
|
|
51
|
+
# Returns all the JSON keys this model knows about
|
52
|
+
def self.acceptable_attributes
|
53
|
+
attribute_map.values
|
54
|
+
end
|
55
|
+
|
50
56
|
# Attribute type mapping.
|
51
|
-
def self.
|
57
|
+
def self.openapi_types
|
52
58
|
{
|
53
59
|
:'id' => :'String',
|
54
60
|
:'scheduled_transaction_id' => :'String',
|
@@ -57,47 +63,64 @@ module YNAB
|
|
57
63
|
:'payee_id' => :'String',
|
58
64
|
:'category_id' => :'String',
|
59
65
|
:'transfer_account_id' => :'String',
|
60
|
-
:'deleted' => :'
|
66
|
+
:'deleted' => :'Boolean'
|
61
67
|
}
|
62
68
|
end
|
63
69
|
|
70
|
+
# List of attributes with nullable: true
|
71
|
+
def self.openapi_nullable
|
72
|
+
Set.new([
|
73
|
+
:'memo',
|
74
|
+
:'payee_id',
|
75
|
+
:'category_id',
|
76
|
+
:'transfer_account_id',
|
77
|
+
])
|
78
|
+
end
|
79
|
+
|
64
80
|
# Initializes the object
|
65
81
|
# @param [Hash] attributes Model attributes in the form of hash
|
66
82
|
def initialize(attributes = {})
|
67
|
-
|
83
|
+
if (!attributes.is_a?(Hash))
|
84
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::ScheduledSubTransaction` initialize method"
|
85
|
+
end
|
68
86
|
|
69
|
-
# convert string to symbol for hash key
|
70
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
87
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
89
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ScheduledSubTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
91
|
+
end
|
92
|
+
h[k.to_sym] = v
|
93
|
+
}
|
71
94
|
|
72
|
-
if attributes.
|
95
|
+
if attributes.key?(:'id')
|
73
96
|
self.id = attributes[:'id']
|
74
97
|
end
|
75
98
|
|
76
|
-
if attributes.
|
99
|
+
if attributes.key?(:'scheduled_transaction_id')
|
77
100
|
self.scheduled_transaction_id = attributes[:'scheduled_transaction_id']
|
78
101
|
end
|
79
102
|
|
80
|
-
if attributes.
|
103
|
+
if attributes.key?(:'amount')
|
81
104
|
self.amount = attributes[:'amount']
|
82
105
|
end
|
83
106
|
|
84
|
-
if attributes.
|
107
|
+
if attributes.key?(:'memo')
|
85
108
|
self.memo = attributes[:'memo']
|
86
109
|
end
|
87
110
|
|
88
|
-
if attributes.
|
111
|
+
if attributes.key?(:'payee_id')
|
89
112
|
self.payee_id = attributes[:'payee_id']
|
90
113
|
end
|
91
114
|
|
92
|
-
if attributes.
|
115
|
+
if attributes.key?(:'category_id')
|
93
116
|
self.category_id = attributes[:'category_id']
|
94
117
|
end
|
95
118
|
|
96
|
-
if attributes.
|
119
|
+
if attributes.key?(:'transfer_account_id')
|
97
120
|
self.transfer_account_id = attributes[:'transfer_account_id']
|
98
121
|
end
|
99
122
|
|
100
|
-
if attributes.
|
123
|
+
if attributes.key?(:'deleted')
|
101
124
|
self.deleted = attributes[:'deleted']
|
102
125
|
end
|
103
126
|
end
|
@@ -157,17 +180,28 @@ module YNAB
|
|
157
180
|
end
|
158
181
|
|
159
182
|
# Calculates hash code according to all attributes.
|
160
|
-
# @return [
|
183
|
+
# @return [Integer] Hash code
|
161
184
|
def hash
|
162
185
|
[id, scheduled_transaction_id, amount, memo, payee_id, category_id, transfer_account_id, deleted].hash
|
163
186
|
end
|
187
|
+
|
188
|
+
# Builds the object from hash
|
189
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
190
|
+
# @return [Object] Returns the model itself
|
191
|
+
def self.build_from_hash(attributes)
|
192
|
+
new.build_from_hash(attributes)
|
193
|
+
end
|
194
|
+
|
164
195
|
# Builds the object from hash
|
165
196
|
# @param [Hash] attributes Model attributes in the form of hash
|
166
197
|
# @return [Object] Returns the model itself
|
167
198
|
def build_from_hash(attributes)
|
168
199
|
return nil unless attributes.is_a?(Hash)
|
169
|
-
|
170
|
-
|
200
|
+
attributes = attributes.transform_keys(&:to_sym)
|
201
|
+
self.class.openapi_types.each_pair do |key, type|
|
202
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
203
|
+
self.send("#{key}=", nil)
|
204
|
+
elsif type =~ /\AArray<(.*)>/i
|
171
205
|
# check to ensure the input is an array given that the attribute
|
172
206
|
# is documented as an array but the input is not
|
173
207
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -175,7 +209,7 @@ module YNAB
|
|
175
209
|
end
|
176
210
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
177
211
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
178
|
-
end
|
212
|
+
end
|
179
213
|
end
|
180
214
|
|
181
215
|
self
|
@@ -187,8 +221,8 @@ module YNAB
|
|
187
221
|
# @return [Object] Deserialized data
|
188
222
|
def _deserialize(type, value)
|
189
223
|
case type.to_sym
|
190
|
-
when :
|
191
|
-
|
224
|
+
when :Time
|
225
|
+
Time.parse(value)
|
192
226
|
when :Date
|
193
227
|
Date.parse(value)
|
194
228
|
when :String
|
@@ -197,7 +231,7 @@ module YNAB
|
|
197
231
|
value.to_i
|
198
232
|
when :Float
|
199
233
|
value.to_f
|
200
|
-
when :
|
234
|
+
when :Boolean
|
201
235
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
202
236
|
true
|
203
237
|
else
|
@@ -218,8 +252,9 @@ module YNAB
|
|
218
252
|
end
|
219
253
|
end
|
220
254
|
else # model
|
221
|
-
|
222
|
-
|
255
|
+
# models (e.g. Pet) or oneOf
|
256
|
+
klass = YNAB.const_get(type)
|
257
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
223
258
|
end
|
224
259
|
end
|
225
260
|
|
@@ -241,7 +276,11 @@ module YNAB
|
|
241
276
|
hash = {}
|
242
277
|
self.class.attribute_map.each_pair do |attr, param|
|
243
278
|
value = self.send(attr)
|
244
|
-
|
279
|
+
if value.nil?
|
280
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
281
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
282
|
+
end
|
283
|
+
|
245
284
|
hash[param] = _to_hash(value)
|
246
285
|
end
|
247
286
|
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 ScheduledTransactionDetail
|
@@ -98,8 +99,13 @@ module YNAB
|
|
98
99
|
}
|
99
100
|
end
|
100
101
|
|
102
|
+
# Returns all the JSON keys this model knows about
|
103
|
+
def self.acceptable_attributes
|
104
|
+
attribute_map.values
|
105
|
+
end
|
106
|
+
|
101
107
|
# Attribute type mapping.
|
102
|
-
def self.
|
108
|
+
def self.openapi_types
|
103
109
|
{
|
104
110
|
:'id' => :'String',
|
105
111
|
:'date_first' => :'Date',
|
@@ -112,7 +118,7 @@ module YNAB
|
|
112
118
|
:'payee_id' => :'String',
|
113
119
|
:'category_id' => :'String',
|
114
120
|
:'transfer_account_id' => :'String',
|
115
|
-
:'deleted' => :'
|
121
|
+
:'deleted' => :'Boolean',
|
116
122
|
:'account_name' => :'String',
|
117
123
|
:'payee_name' => :'String',
|
118
124
|
:'category_name' => :'String',
|
@@ -120,75 +126,103 @@ module YNAB
|
|
120
126
|
}
|
121
127
|
end
|
122
128
|
|
129
|
+
# List of attributes with nullable: true
|
130
|
+
def self.openapi_nullable
|
131
|
+
Set.new([
|
132
|
+
:'memo',
|
133
|
+
:'flag_color',
|
134
|
+
:'payee_id',
|
135
|
+
:'category_id',
|
136
|
+
:'transfer_account_id',
|
137
|
+
:'payee_name',
|
138
|
+
:'category_name',
|
139
|
+
])
|
140
|
+
end
|
141
|
+
|
142
|
+
# List of class defined in allOf (OpenAPI v3)
|
143
|
+
def self.openapi_all_of
|
144
|
+
[
|
145
|
+
:'ScheduledTransactionDetailAllOf',
|
146
|
+
:'ScheduledTransactionSummary'
|
147
|
+
]
|
148
|
+
end
|
149
|
+
|
123
150
|
# Initializes the object
|
124
151
|
# @param [Hash] attributes Model attributes in the form of hash
|
125
152
|
def initialize(attributes = {})
|
126
|
-
|
153
|
+
if (!attributes.is_a?(Hash))
|
154
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::ScheduledTransactionDetail` initialize method"
|
155
|
+
end
|
127
156
|
|
128
|
-
# convert string to symbol for hash key
|
129
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
157
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
158
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
159
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
160
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ScheduledTransactionDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
161
|
+
end
|
162
|
+
h[k.to_sym] = v
|
163
|
+
}
|
130
164
|
|
131
|
-
if attributes.
|
165
|
+
if attributes.key?(:'id')
|
132
166
|
self.id = attributes[:'id']
|
133
167
|
end
|
134
168
|
|
135
|
-
if attributes.
|
169
|
+
if attributes.key?(:'date_first')
|
136
170
|
self.date_first = attributes[:'date_first']
|
137
171
|
end
|
138
172
|
|
139
|
-
if attributes.
|
173
|
+
if attributes.key?(:'date_next')
|
140
174
|
self.date_next = attributes[:'date_next']
|
141
175
|
end
|
142
176
|
|
143
|
-
if attributes.
|
177
|
+
if attributes.key?(:'frequency')
|
144
178
|
self.frequency = attributes[:'frequency']
|
145
179
|
end
|
146
180
|
|
147
|
-
if attributes.
|
181
|
+
if attributes.key?(:'amount')
|
148
182
|
self.amount = attributes[:'amount']
|
149
183
|
end
|
150
184
|
|
151
|
-
if attributes.
|
185
|
+
if attributes.key?(:'memo')
|
152
186
|
self.memo = attributes[:'memo']
|
153
187
|
end
|
154
188
|
|
155
|
-
if attributes.
|
189
|
+
if attributes.key?(:'flag_color')
|
156
190
|
self.flag_color = attributes[:'flag_color']
|
157
191
|
end
|
158
192
|
|
159
|
-
if attributes.
|
193
|
+
if attributes.key?(:'account_id')
|
160
194
|
self.account_id = attributes[:'account_id']
|
161
195
|
end
|
162
196
|
|
163
|
-
if attributes.
|
197
|
+
if attributes.key?(:'payee_id')
|
164
198
|
self.payee_id = attributes[:'payee_id']
|
165
199
|
end
|
166
200
|
|
167
|
-
if attributes.
|
201
|
+
if attributes.key?(:'category_id')
|
168
202
|
self.category_id = attributes[:'category_id']
|
169
203
|
end
|
170
204
|
|
171
|
-
if attributes.
|
205
|
+
if attributes.key?(:'transfer_account_id')
|
172
206
|
self.transfer_account_id = attributes[:'transfer_account_id']
|
173
207
|
end
|
174
208
|
|
175
|
-
if attributes.
|
209
|
+
if attributes.key?(:'deleted')
|
176
210
|
self.deleted = attributes[:'deleted']
|
177
211
|
end
|
178
212
|
|
179
|
-
if attributes.
|
213
|
+
if attributes.key?(:'account_name')
|
180
214
|
self.account_name = attributes[:'account_name']
|
181
215
|
end
|
182
216
|
|
183
|
-
if attributes.
|
217
|
+
if attributes.key?(:'payee_name')
|
184
218
|
self.payee_name = attributes[:'payee_name']
|
185
219
|
end
|
186
220
|
|
187
|
-
if attributes.
|
221
|
+
if attributes.key?(:'category_name')
|
188
222
|
self.category_name = attributes[:'category_name']
|
189
223
|
end
|
190
224
|
|
191
|
-
if attributes.
|
225
|
+
if attributes.key?(:'subtransactions')
|
192
226
|
if (value = attributes[:'subtransactions']).is_a?(Array)
|
193
227
|
self.subtransactions = value
|
194
228
|
end
|
@@ -245,10 +279,10 @@ module YNAB
|
|
245
279
|
return false if @date_first.nil?
|
246
280
|
return false if @date_next.nil?
|
247
281
|
return false if @frequency.nil?
|
248
|
-
frequency_validator = EnumAttributeValidator.new('String', [
|
282
|
+
frequency_validator = EnumAttributeValidator.new('String', ["never", "daily", "weekly", "everyOtherWeek", "twiceAMonth", "every4Weeks", "monthly", "everyOtherMonth", "every3Months", "every4Months", "twiceAYear", "yearly", "everyOtherYear"])
|
249
283
|
return false unless frequency_validator.valid?(@frequency)
|
250
284
|
return false if @amount.nil?
|
251
|
-
flag_color_validator = EnumAttributeValidator.new('String', [
|
285
|
+
flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
252
286
|
return false unless flag_color_validator.valid?(@flag_color)
|
253
287
|
return false if @account_id.nil?
|
254
288
|
return false if @deleted.nil?
|
@@ -260,12 +294,20 @@ module YNAB
|
|
260
294
|
# Custom attribute writer method checking allowed values (enum).
|
261
295
|
# @param [Object] frequency Object to be assigned
|
262
296
|
def frequency=(frequency)
|
297
|
+
validator = EnumAttributeValidator.new('String', ["never", "daily", "weekly", "everyOtherWeek", "twiceAMonth", "every4Weeks", "monthly", "everyOtherMonth", "every3Months", "every4Months", "twiceAYear", "yearly", "everyOtherYear"])
|
298
|
+
unless validator.valid?(frequency)
|
299
|
+
fail ArgumentError, "invalid value for \"frequency\", must be one of #{validator.allowable_values}."
|
300
|
+
end
|
263
301
|
@frequency = frequency
|
264
302
|
end
|
265
303
|
|
266
304
|
# Custom attribute writer method checking allowed values (enum).
|
267
305
|
# @param [Object] flag_color Object to be assigned
|
268
306
|
def flag_color=(flag_color)
|
307
|
+
validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
308
|
+
unless validator.valid?(flag_color)
|
309
|
+
fail ArgumentError, "invalid value for \"flag_color\", must be one of #{validator.allowable_values}."
|
310
|
+
end
|
269
311
|
@flag_color = flag_color
|
270
312
|
end
|
271
313
|
|
@@ -299,17 +341,28 @@ module YNAB
|
|
299
341
|
end
|
300
342
|
|
301
343
|
# Calculates hash code according to all attributes.
|
302
|
-
# @return [
|
344
|
+
# @return [Integer] Hash code
|
303
345
|
def hash
|
304
346
|
[id, date_first, date_next, frequency, amount, memo, flag_color, account_id, payee_id, category_id, transfer_account_id, deleted, account_name, payee_name, category_name, subtransactions].hash
|
305
347
|
end
|
348
|
+
|
349
|
+
# Builds the object from hash
|
350
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
351
|
+
# @return [Object] Returns the model itself
|
352
|
+
def self.build_from_hash(attributes)
|
353
|
+
new.build_from_hash(attributes)
|
354
|
+
end
|
355
|
+
|
306
356
|
# Builds the object from hash
|
307
357
|
# @param [Hash] attributes Model attributes in the form of hash
|
308
358
|
# @return [Object] Returns the model itself
|
309
359
|
def build_from_hash(attributes)
|
310
360
|
return nil unless attributes.is_a?(Hash)
|
311
|
-
|
312
|
-
|
361
|
+
attributes = attributes.transform_keys(&:to_sym)
|
362
|
+
self.class.openapi_types.each_pair do |key, type|
|
363
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
364
|
+
self.send("#{key}=", nil)
|
365
|
+
elsif type =~ /\AArray<(.*)>/i
|
313
366
|
# check to ensure the input is an array given that the attribute
|
314
367
|
# is documented as an array but the input is not
|
315
368
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -317,7 +370,7 @@ module YNAB
|
|
317
370
|
end
|
318
371
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
319
372
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
320
|
-
end
|
373
|
+
end
|
321
374
|
end
|
322
375
|
|
323
376
|
self
|
@@ -329,8 +382,8 @@ module YNAB
|
|
329
382
|
# @return [Object] Deserialized data
|
330
383
|
def _deserialize(type, value)
|
331
384
|
case type.to_sym
|
332
|
-
when :
|
333
|
-
|
385
|
+
when :Time
|
386
|
+
Time.parse(value)
|
334
387
|
when :Date
|
335
388
|
Date.parse(value)
|
336
389
|
when :String
|
@@ -339,7 +392,7 @@ module YNAB
|
|
339
392
|
value.to_i
|
340
393
|
when :Float
|
341
394
|
value.to_f
|
342
|
-
when :
|
395
|
+
when :Boolean
|
343
396
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
344
397
|
true
|
345
398
|
else
|
@@ -360,8 +413,9 @@ module YNAB
|
|
360
413
|
end
|
361
414
|
end
|
362
415
|
else # model
|
363
|
-
|
364
|
-
|
416
|
+
# models (e.g. Pet) or oneOf
|
417
|
+
klass = YNAB.const_get(type)
|
418
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
365
419
|
end
|
366
420
|
end
|
367
421
|
|
@@ -383,7 +437,11 @@ module YNAB
|
|
383
437
|
hash = {}
|
384
438
|
self.class.attribute_map.each_pair do |attr, param|
|
385
439
|
value = self.send(attr)
|
386
|
-
|
440
|
+
if value.nil?
|
441
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
442
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
443
|
+
end
|
444
|
+
|
387
445
|
hash[param] = _to_hash(value)
|
388
446
|
end
|
389
447
|
hash
|