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 SaveMonthCategory
|
@@ -24,22 +25,40 @@ module YNAB
|
|
24
25
|
}
|
25
26
|
end
|
26
27
|
|
28
|
+
# Returns all the JSON keys this model knows about
|
29
|
+
def self.acceptable_attributes
|
30
|
+
attribute_map.values
|
31
|
+
end
|
32
|
+
|
27
33
|
# Attribute type mapping.
|
28
|
-
def self.
|
34
|
+
def self.openapi_types
|
29
35
|
{
|
30
36
|
:'budgeted' => :'Integer'
|
31
37
|
}
|
32
38
|
end
|
33
39
|
|
40
|
+
# List of attributes with nullable: true
|
41
|
+
def self.openapi_nullable
|
42
|
+
Set.new([
|
43
|
+
])
|
44
|
+
end
|
45
|
+
|
34
46
|
# Initializes the object
|
35
47
|
# @param [Hash] attributes Model attributes in the form of hash
|
36
48
|
def initialize(attributes = {})
|
37
|
-
|
49
|
+
if (!attributes.is_a?(Hash))
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveMonthCategory` initialize method"
|
51
|
+
end
|
38
52
|
|
39
|
-
# convert string to symbol for hash key
|
40
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveMonthCategory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
|
+
end
|
58
|
+
h[k.to_sym] = v
|
59
|
+
}
|
41
60
|
|
42
|
-
if attributes.
|
61
|
+
if attributes.key?(:'budgeted')
|
43
62
|
self.budgeted = attributes[:'budgeted']
|
44
63
|
end
|
45
64
|
end
|
@@ -77,17 +96,28 @@ module YNAB
|
|
77
96
|
end
|
78
97
|
|
79
98
|
# Calculates hash code according to all attributes.
|
80
|
-
# @return [
|
99
|
+
# @return [Integer] Hash code
|
81
100
|
def hash
|
82
101
|
[budgeted].hash
|
83
102
|
end
|
103
|
+
|
104
|
+
# Builds the object from hash
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
# @return [Object] Returns the model itself
|
107
|
+
def self.build_from_hash(attributes)
|
108
|
+
new.build_from_hash(attributes)
|
109
|
+
end
|
110
|
+
|
84
111
|
# Builds the object from hash
|
85
112
|
# @param [Hash] attributes Model attributes in the form of hash
|
86
113
|
# @return [Object] Returns the model itself
|
87
114
|
def build_from_hash(attributes)
|
88
115
|
return nil unless attributes.is_a?(Hash)
|
89
|
-
|
90
|
-
|
116
|
+
attributes = attributes.transform_keys(&:to_sym)
|
117
|
+
self.class.openapi_types.each_pair do |key, type|
|
118
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
119
|
+
self.send("#{key}=", nil)
|
120
|
+
elsif type =~ /\AArray<(.*)>/i
|
91
121
|
# check to ensure the input is an array given that the attribute
|
92
122
|
# is documented as an array but the input is not
|
93
123
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -95,7 +125,7 @@ module YNAB
|
|
95
125
|
end
|
96
126
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
97
127
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
98
|
-
end
|
128
|
+
end
|
99
129
|
end
|
100
130
|
|
101
131
|
self
|
@@ -107,8 +137,8 @@ module YNAB
|
|
107
137
|
# @return [Object] Deserialized data
|
108
138
|
def _deserialize(type, value)
|
109
139
|
case type.to_sym
|
110
|
-
when :
|
111
|
-
|
140
|
+
when :Time
|
141
|
+
Time.parse(value)
|
112
142
|
when :Date
|
113
143
|
Date.parse(value)
|
114
144
|
when :String
|
@@ -117,7 +147,7 @@ module YNAB
|
|
117
147
|
value.to_i
|
118
148
|
when :Float
|
119
149
|
value.to_f
|
120
|
-
when :
|
150
|
+
when :Boolean
|
121
151
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
122
152
|
true
|
123
153
|
else
|
@@ -138,8 +168,9 @@ module YNAB
|
|
138
168
|
end
|
139
169
|
end
|
140
170
|
else # model
|
141
|
-
|
142
|
-
|
171
|
+
# models (e.g. Pet) or oneOf
|
172
|
+
klass = YNAB.const_get(type)
|
173
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
143
174
|
end
|
144
175
|
end
|
145
176
|
|
@@ -161,7 +192,11 @@ module YNAB
|
|
161
192
|
hash = {}
|
162
193
|
self.class.attribute_map.each_pair do |attr, param|
|
163
194
|
value = self.send(attr)
|
164
|
-
|
195
|
+
if value.nil?
|
196
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
197
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
198
|
+
end
|
199
|
+
|
165
200
|
hash[param] = _to_hash(value)
|
166
201
|
end
|
167
202
|
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 SaveSubTransaction
|
@@ -39,8 +40,13 @@ module YNAB
|
|
39
40
|
}
|
40
41
|
end
|
41
42
|
|
43
|
+
# Returns all the JSON keys this model knows about
|
44
|
+
def self.acceptable_attributes
|
45
|
+
attribute_map.values
|
46
|
+
end
|
47
|
+
|
42
48
|
# Attribute type mapping.
|
43
|
-
def self.
|
49
|
+
def self.openapi_types
|
44
50
|
{
|
45
51
|
:'amount' => :'Integer',
|
46
52
|
:'payee_id' => :'String',
|
@@ -50,31 +56,48 @@ module YNAB
|
|
50
56
|
}
|
51
57
|
end
|
52
58
|
|
59
|
+
# List of attributes with nullable: true
|
60
|
+
def self.openapi_nullable
|
61
|
+
Set.new([
|
62
|
+
:'payee_id',
|
63
|
+
:'payee_name',
|
64
|
+
:'category_id',
|
65
|
+
:'memo'
|
66
|
+
])
|
67
|
+
end
|
68
|
+
|
53
69
|
# Initializes the object
|
54
70
|
# @param [Hash] attributes Model attributes in the form of hash
|
55
71
|
def initialize(attributes = {})
|
56
|
-
|
72
|
+
if (!attributes.is_a?(Hash))
|
73
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveSubTransaction` initialize method"
|
74
|
+
end
|
57
75
|
|
58
|
-
# convert string to symbol for hash key
|
59
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
76
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
77
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
78
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
79
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveSubTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
80
|
+
end
|
81
|
+
h[k.to_sym] = v
|
82
|
+
}
|
60
83
|
|
61
|
-
if attributes.
|
84
|
+
if attributes.key?(:'amount')
|
62
85
|
self.amount = attributes[:'amount']
|
63
86
|
end
|
64
87
|
|
65
|
-
if attributes.
|
88
|
+
if attributes.key?(:'payee_id')
|
66
89
|
self.payee_id = attributes[:'payee_id']
|
67
90
|
end
|
68
91
|
|
69
|
-
if attributes.
|
92
|
+
if attributes.key?(:'payee_name')
|
70
93
|
self.payee_name = attributes[:'payee_name']
|
71
94
|
end
|
72
95
|
|
73
|
-
if attributes.
|
96
|
+
if attributes.key?(:'category_id')
|
74
97
|
self.category_id = attributes[:'category_id']
|
75
98
|
end
|
76
99
|
|
77
|
-
if attributes.
|
100
|
+
if attributes.key?(:'memo')
|
78
101
|
self.memo = attributes[:'memo']
|
79
102
|
end
|
80
103
|
end
|
@@ -146,17 +169,28 @@ module YNAB
|
|
146
169
|
end
|
147
170
|
|
148
171
|
# Calculates hash code according to all attributes.
|
149
|
-
# @return [
|
172
|
+
# @return [Integer] Hash code
|
150
173
|
def hash
|
151
174
|
[amount, payee_id, payee_name, category_id, memo].hash
|
152
175
|
end
|
176
|
+
|
177
|
+
# Builds the object from hash
|
178
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
179
|
+
# @return [Object] Returns the model itself
|
180
|
+
def self.build_from_hash(attributes)
|
181
|
+
new.build_from_hash(attributes)
|
182
|
+
end
|
183
|
+
|
153
184
|
# Builds the object from hash
|
154
185
|
# @param [Hash] attributes Model attributes in the form of hash
|
155
186
|
# @return [Object] Returns the model itself
|
156
187
|
def build_from_hash(attributes)
|
157
188
|
return nil unless attributes.is_a?(Hash)
|
158
|
-
|
159
|
-
|
189
|
+
attributes = attributes.transform_keys(&:to_sym)
|
190
|
+
self.class.openapi_types.each_pair do |key, type|
|
191
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
192
|
+
self.send("#{key}=", nil)
|
193
|
+
elsif type =~ /\AArray<(.*)>/i
|
160
194
|
# check to ensure the input is an array given that the attribute
|
161
195
|
# is documented as an array but the input is not
|
162
196
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -164,7 +198,7 @@ module YNAB
|
|
164
198
|
end
|
165
199
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
166
200
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
167
|
-
end
|
201
|
+
end
|
168
202
|
end
|
169
203
|
|
170
204
|
self
|
@@ -176,8 +210,8 @@ module YNAB
|
|
176
210
|
# @return [Object] Deserialized data
|
177
211
|
def _deserialize(type, value)
|
178
212
|
case type.to_sym
|
179
|
-
when :
|
180
|
-
|
213
|
+
when :Time
|
214
|
+
Time.parse(value)
|
181
215
|
when :Date
|
182
216
|
Date.parse(value)
|
183
217
|
when :String
|
@@ -186,7 +220,7 @@ module YNAB
|
|
186
220
|
value.to_i
|
187
221
|
when :Float
|
188
222
|
value.to_f
|
189
|
-
when :
|
223
|
+
when :Boolean
|
190
224
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
191
225
|
true
|
192
226
|
else
|
@@ -207,8 +241,9 @@ module YNAB
|
|
207
241
|
end
|
208
242
|
end
|
209
243
|
else # model
|
210
|
-
|
211
|
-
|
244
|
+
# models (e.g. Pet) or oneOf
|
245
|
+
klass = YNAB.const_get(type)
|
246
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
212
247
|
end
|
213
248
|
end
|
214
249
|
|
@@ -230,7 +265,11 @@ module YNAB
|
|
230
265
|
hash = {}
|
231
266
|
self.class.attribute_map.each_pair do |attr, param|
|
232
267
|
value = self.send(attr)
|
233
|
-
|
268
|
+
if value.nil?
|
269
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
270
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
271
|
+
end
|
272
|
+
|
234
273
|
hash[param] = _to_hash(value)
|
235
274
|
end
|
236
275
|
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 SaveTransaction
|
@@ -45,7 +46,7 @@ module YNAB
|
|
45
46
|
# 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
47
|
attr_accessor :import_id
|
47
48
|
|
48
|
-
# An array of subtransactions to configure a transaction as a split.
|
49
|
+
# An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
|
49
50
|
attr_accessor :subtransactions
|
50
51
|
|
51
52
|
class EnumAttributeValidator
|
@@ -88,8 +89,13 @@ module YNAB
|
|
88
89
|
}
|
89
90
|
end
|
90
91
|
|
92
|
+
# Returns all the JSON keys this model knows about
|
93
|
+
def self.acceptable_attributes
|
94
|
+
attribute_map.values
|
95
|
+
end
|
96
|
+
|
91
97
|
# Attribute type mapping.
|
92
|
-
def self.
|
98
|
+
def self.openapi_types
|
93
99
|
{
|
94
100
|
:'account_id' => :'String',
|
95
101
|
:'date' => :'Date',
|
@@ -99,66 +105,91 @@ module YNAB
|
|
99
105
|
:'category_id' => :'String',
|
100
106
|
:'memo' => :'String',
|
101
107
|
:'cleared' => :'String',
|
102
|
-
:'approved' => :'
|
108
|
+
:'approved' => :'Boolean',
|
103
109
|
:'flag_color' => :'String',
|
104
110
|
:'import_id' => :'String',
|
105
111
|
:'subtransactions' => :'Array<SaveSubTransaction>'
|
106
112
|
}
|
107
113
|
end
|
108
114
|
|
115
|
+
# List of attributes with nullable: true
|
116
|
+
def self.openapi_nullable
|
117
|
+
Set.new([
|
118
|
+
:'payee_id',
|
119
|
+
:'payee_name',
|
120
|
+
:'category_id',
|
121
|
+
:'memo',
|
122
|
+
:'import_id',
|
123
|
+
])
|
124
|
+
end
|
125
|
+
|
126
|
+
# List of class defined in allOf (OpenAPI v3)
|
127
|
+
def self.openapi_all_of
|
128
|
+
[
|
129
|
+
:'SaveTransactionWithOptionalFields'
|
130
|
+
]
|
131
|
+
end
|
132
|
+
|
109
133
|
# Initializes the object
|
110
134
|
# @param [Hash] attributes Model attributes in the form of hash
|
111
135
|
def initialize(attributes = {})
|
112
|
-
|
136
|
+
if (!attributes.is_a?(Hash))
|
137
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveTransaction` initialize method"
|
138
|
+
end
|
113
139
|
|
114
|
-
# convert string to symbol for hash key
|
115
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
140
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
141
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
142
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
143
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
144
|
+
end
|
145
|
+
h[k.to_sym] = v
|
146
|
+
}
|
116
147
|
|
117
|
-
if attributes.
|
148
|
+
if attributes.key?(:'account_id')
|
118
149
|
self.account_id = attributes[:'account_id']
|
119
150
|
end
|
120
151
|
|
121
|
-
if attributes.
|
152
|
+
if attributes.key?(:'date')
|
122
153
|
self.date = attributes[:'date']
|
123
154
|
end
|
124
155
|
|
125
|
-
if attributes.
|
156
|
+
if attributes.key?(:'amount')
|
126
157
|
self.amount = attributes[:'amount']
|
127
158
|
end
|
128
159
|
|
129
|
-
if attributes.
|
160
|
+
if attributes.key?(:'payee_id')
|
130
161
|
self.payee_id = attributes[:'payee_id']
|
131
162
|
end
|
132
163
|
|
133
|
-
if attributes.
|
164
|
+
if attributes.key?(:'payee_name')
|
134
165
|
self.payee_name = attributes[:'payee_name']
|
135
166
|
end
|
136
167
|
|
137
|
-
if attributes.
|
168
|
+
if attributes.key?(:'category_id')
|
138
169
|
self.category_id = attributes[:'category_id']
|
139
170
|
end
|
140
171
|
|
141
|
-
if attributes.
|
172
|
+
if attributes.key?(:'memo')
|
142
173
|
self.memo = attributes[:'memo']
|
143
174
|
end
|
144
175
|
|
145
|
-
if attributes.
|
176
|
+
if attributes.key?(:'cleared')
|
146
177
|
self.cleared = attributes[:'cleared']
|
147
178
|
end
|
148
179
|
|
149
|
-
if attributes.
|
180
|
+
if attributes.key?(:'approved')
|
150
181
|
self.approved = attributes[:'approved']
|
151
182
|
end
|
152
183
|
|
153
|
-
if attributes.
|
184
|
+
if attributes.key?(:'flag_color')
|
154
185
|
self.flag_color = attributes[:'flag_color']
|
155
186
|
end
|
156
187
|
|
157
|
-
if attributes.
|
188
|
+
if attributes.key?(:'import_id')
|
158
189
|
self.import_id = attributes[:'import_id']
|
159
190
|
end
|
160
191
|
|
161
|
-
if attributes.
|
192
|
+
if attributes.key?(:'subtransactions')
|
162
193
|
if (value = attributes[:'subtransactions']).is_a?(Array)
|
163
194
|
self.subtransactions = value
|
164
195
|
end
|
@@ -189,9 +220,9 @@ module YNAB
|
|
189
220
|
def valid?
|
190
221
|
return false if !@payee_name.nil? && @payee_name.to_s.length > 50
|
191
222
|
return false if !@memo.nil? && @memo.to_s.length > 200
|
192
|
-
cleared_validator = EnumAttributeValidator.new('String', [
|
223
|
+
cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
193
224
|
return false unless cleared_validator.valid?(@cleared)
|
194
|
-
flag_color_validator = EnumAttributeValidator.new('String', [
|
225
|
+
flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
195
226
|
return false unless flag_color_validator.valid?(@flag_color)
|
196
227
|
return false if !@import_id.nil? && @import_id.to_s.length > 36
|
197
228
|
true
|
@@ -220,12 +251,20 @@ module YNAB
|
|
220
251
|
# Custom attribute writer method checking allowed values (enum).
|
221
252
|
# @param [Object] cleared Object to be assigned
|
222
253
|
def cleared=(cleared)
|
254
|
+
validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
255
|
+
unless validator.valid?(cleared)
|
256
|
+
fail ArgumentError, "invalid value for \"cleared\", must be one of #{validator.allowable_values}."
|
257
|
+
end
|
223
258
|
@cleared = cleared
|
224
259
|
end
|
225
260
|
|
226
261
|
# Custom attribute writer method checking allowed values (enum).
|
227
262
|
# @param [Object] flag_color Object to be assigned
|
228
263
|
def flag_color=(flag_color)
|
264
|
+
validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
265
|
+
unless validator.valid?(flag_color)
|
266
|
+
fail ArgumentError, "invalid value for \"flag_color\", must be one of #{validator.allowable_values}."
|
267
|
+
end
|
229
268
|
@flag_color = flag_color
|
230
269
|
end
|
231
270
|
|
@@ -265,17 +304,28 @@ module YNAB
|
|
265
304
|
end
|
266
305
|
|
267
306
|
# Calculates hash code according to all attributes.
|
268
|
-
# @return [
|
307
|
+
# @return [Integer] Hash code
|
269
308
|
def hash
|
270
309
|
[account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions].hash
|
271
310
|
end
|
311
|
+
|
312
|
+
# Builds the object from hash
|
313
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
314
|
+
# @return [Object] Returns the model itself
|
315
|
+
def self.build_from_hash(attributes)
|
316
|
+
new.build_from_hash(attributes)
|
317
|
+
end
|
318
|
+
|
272
319
|
# Builds the object from hash
|
273
320
|
# @param [Hash] attributes Model attributes in the form of hash
|
274
321
|
# @return [Object] Returns the model itself
|
275
322
|
def build_from_hash(attributes)
|
276
323
|
return nil unless attributes.is_a?(Hash)
|
277
|
-
|
278
|
-
|
324
|
+
attributes = attributes.transform_keys(&:to_sym)
|
325
|
+
self.class.openapi_types.each_pair do |key, type|
|
326
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
327
|
+
self.send("#{key}=", nil)
|
328
|
+
elsif type =~ /\AArray<(.*)>/i
|
279
329
|
# check to ensure the input is an array given that the attribute
|
280
330
|
# is documented as an array but the input is not
|
281
331
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -283,7 +333,7 @@ module YNAB
|
|
283
333
|
end
|
284
334
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
285
335
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
286
|
-
end
|
336
|
+
end
|
287
337
|
end
|
288
338
|
|
289
339
|
self
|
@@ -295,8 +345,8 @@ module YNAB
|
|
295
345
|
# @return [Object] Deserialized data
|
296
346
|
def _deserialize(type, value)
|
297
347
|
case type.to_sym
|
298
|
-
when :
|
299
|
-
|
348
|
+
when :Time
|
349
|
+
Time.parse(value)
|
300
350
|
when :Date
|
301
351
|
Date.parse(value)
|
302
352
|
when :String
|
@@ -305,7 +355,7 @@ module YNAB
|
|
305
355
|
value.to_i
|
306
356
|
when :Float
|
307
357
|
value.to_f
|
308
|
-
when :
|
358
|
+
when :Boolean
|
309
359
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
310
360
|
true
|
311
361
|
else
|
@@ -326,8 +376,9 @@ module YNAB
|
|
326
376
|
end
|
327
377
|
end
|
328
378
|
else # model
|
329
|
-
|
330
|
-
|
379
|
+
# models (e.g. Pet) or oneOf
|
380
|
+
klass = YNAB.const_get(type)
|
381
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
331
382
|
end
|
332
383
|
end
|
333
384
|
|
@@ -349,7 +400,11 @@ module YNAB
|
|
349
400
|
hash = {}
|
350
401
|
self.class.attribute_map.each_pair do |attr, param|
|
351
402
|
value = self.send(attr)
|
352
|
-
|
403
|
+
if value.nil?
|
404
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
405
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
406
|
+
end
|
407
|
+
|
353
408
|
hash[param] = _to_hash(value)
|
354
409
|
end
|
355
410
|
hash
|