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