ynab 3.8.0 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +3 -1
- data/README.md +48 -40
- data/Rakefile +1 -1
- data/docs/Account.md +3 -3
- data/docs/AccountsApi.md +12 -12
- data/docs/CategoriesApi.md +89 -25
- data/docs/Category.md +5 -3
- data/docs/CategoryGroupWithCategories.md +1 -1
- data/docs/ExistingCategory.md +12 -0
- data/docs/MoneyMovement.md +16 -0
- data/docs/MoneyMovementGroup.md +12 -0
- data/docs/MoneyMovementGroupsResponse.md +8 -0
- data/docs/MoneyMovementGroupsResponseData.md +9 -0
- data/docs/MoneyMovementsApi.md +89 -0
- data/docs/{BudgetSettingsResponse.md → MoneyMovementsResponse.md} +2 -2
- data/docs/MoneyMovementsResponseData.md +9 -0
- data/docs/MonthDetail.md +2 -2
- data/docs/MonthSummary.md +1 -1
- data/docs/MonthsApi.md +13 -13
- data/docs/NewCategory.md +12 -0
- data/docs/PatchCategoryGroupWrapper.md +8 -0
- data/docs/PatchCategoryWrapper.md +1 -1
- data/docs/PayeeLocationsApi.md +12 -12
- data/docs/PayeesApi.md +11 -11
- data/docs/{BudgetDetail.md → PlanDetail.md} +4 -4
- data/docs/PlanDetailResponse.md +8 -0
- data/docs/{BudgetDetailResponseData.md → PlanDetailResponseData.md} +2 -2
- data/docs/{BudgetSettings.md → PlanSettings.md} +1 -1
- data/docs/{BudgetDetailResponse.md → PlanSettingsResponse.md} +2 -2
- data/docs/PlanSettingsResponseData.md +8 -0
- data/docs/PlanSummary.md +15 -0
- data/docs/PlanSummaryResponse.md +8 -0
- data/docs/PlanSummaryResponseData.md +9 -0
- data/docs/PlansApi.md +68 -0
- data/docs/PostCategoryGroupWrapper.md +8 -0
- data/docs/PostCategoryWrapper.md +8 -0
- data/docs/SaveCategory.md +2 -1
- data/docs/SaveCategoryGroup.md +8 -0
- data/docs/SaveCategoryGroupResponse.md +8 -0
- data/docs/SaveCategoryGroupResponseData.md +9 -0
- data/docs/SaveMonthCategory.md +1 -1
- data/docs/ScheduledTransactionsApi.md +20 -20
- data/docs/TransactionResponseData.md +1 -0
- data/docs/TransactionsApi.md +48 -48
- data/docs/UserApi.md +2 -2
- data/examples/category-balance.rb +2 -2
- data/examples/create-multiple-transactions.rb +2 -2
- data/examples/create-transaction.rb +2 -2
- data/examples/{budget-list.rb → plan-list.rb} +6 -6
- data/examples/{budget-month.rb → plan-month.rb} +9 -10
- data/examples/update-category-budgeted.rb +2 -2
- data/examples/update-multiple-transactions.rb +3 -3
- data/lib/ynab/api/accounts_api.rb +33 -34
- data/lib/ynab/api/categories_api.rb +293 -66
- data/lib/ynab/api/deprecated_api.rb +11 -11
- data/lib/ynab/api/money_movements_api.rb +282 -0
- data/lib/ynab/api/months_api.rb +35 -36
- data/lib/ynab/api/payee_locations_api.rb +33 -34
- data/lib/ynab/api/payees_api.rb +31 -32
- data/lib/ynab/api/{budgets_api.rb → plans_api.rb} +54 -55
- data/lib/ynab/api/scheduled_transactions_api.rb +55 -56
- data/lib/ynab/api/transactions_api.rb +130 -131
- data/lib/ynab/api/user_api.rb +2 -3
- data/lib/ynab/api_client.rb +0 -2
- data/lib/ynab/api_model_base.rb +85 -0
- data/lib/ynab/models/account.rb +4 -81
- data/lib/ynab/models/account_response.rb +1 -75
- data/lib/ynab/models/account_response_data.rb +1 -75
- data/lib/ynab/models/accounts_response.rb +1 -75
- data/lib/ynab/models/accounts_response_data.rb +1 -75
- data/lib/ynab/models/bulk_response.rb +1 -75
- data/lib/ynab/models/bulk_response_data.rb +1 -75
- data/lib/ynab/models/bulk_response_data_bulk.rb +1 -75
- data/lib/ynab/models/bulk_transactions.rb +1 -75
- data/lib/ynab/models/categories_response.rb +1 -75
- data/lib/ynab/models/categories_response_data.rb +1 -75
- data/lib/ynab/models/category.rb +27 -79
- data/lib/ynab/models/category_group.rb +1 -75
- data/lib/ynab/models/category_group_with_categories.rb +2 -76
- data/lib/ynab/models/category_response.rb +1 -75
- data/lib/ynab/models/category_response_data.rb +1 -75
- data/lib/ynab/models/currency_format.rb +2 -76
- data/lib/ynab/models/date_format.rb +2 -76
- data/lib/ynab/models/error_detail.rb +1 -75
- data/lib/ynab/models/error_response.rb +1 -75
- data/lib/ynab/models/existing_category.rb +180 -0
- data/lib/ynab/models/existing_transaction.rb +1 -79
- data/lib/ynab/models/hybrid_transaction.rb +1 -85
- data/lib/ynab/models/hybrid_transactions_response.rb +1 -75
- data/lib/ynab/models/hybrid_transactions_response_data.rb +1 -75
- data/lib/ynab/models/money_movement.rb +223 -0
- data/lib/ynab/models/money_movement_group.rb +179 -0
- data/lib/ynab/models/{budget_summary_response.rb → money_movement_groups_response.rb} +4 -78
- data/lib/ynab/models/money_movement_groups_response_data.rb +149 -0
- data/lib/ynab/models/{budget_settings_response.rb → money_movements_response.rb} +4 -78
- data/lib/ynab/models/money_movements_response_data.rb +149 -0
- data/lib/ynab/models/month_detail.rb +3 -79
- data/lib/ynab/models/month_detail_response.rb +1 -75
- data/lib/ynab/models/month_detail_response_data.rb +1 -75
- data/lib/ynab/models/month_summaries_response.rb +1 -75
- data/lib/ynab/models/month_summaries_response_data.rb +1 -75
- data/lib/ynab/models/month_summary.rb +2 -76
- data/lib/ynab/models/new_category.rb +180 -0
- data/lib/ynab/models/new_transaction.rb +1 -79
- data/lib/ynab/models/patch_category_group_wrapper.rb +136 -0
- data/lib/ynab/models/patch_category_wrapper.rb +2 -76
- data/lib/ynab/models/patch_month_category_wrapper.rb +1 -75
- data/lib/ynab/models/patch_payee_wrapper.rb +1 -75
- data/lib/ynab/models/patch_transactions_wrapper.rb +1 -75
- data/lib/ynab/models/payee.rb +1 -75
- data/lib/ynab/models/payee_location.rb +1 -75
- data/lib/ynab/models/payee_location_response.rb +1 -75
- data/lib/ynab/models/payee_location_response_data.rb +1 -75
- data/lib/ynab/models/payee_locations_response.rb +1 -75
- data/lib/ynab/models/payee_locations_response_data.rb +1 -75
- data/lib/ynab/models/payee_response.rb +1 -75
- data/lib/ynab/models/payee_response_data.rb +1 -75
- data/lib/ynab/models/payees_response.rb +1 -75
- data/lib/ynab/models/payees_response_data.rb +1 -75
- data/lib/ynab/models/{budget_detail.rb → plan_detail.rb} +7 -83
- data/lib/ynab/models/plan_detail_response.rb +136 -0
- data/lib/ynab/models/{budget_detail_response_data.rb → plan_detail_response_data.rb} +4 -78
- data/lib/ynab/models/{budget_settings.rb → plan_settings.rb} +5 -79
- data/lib/ynab/models/{budget_detail_response.rb → plan_settings_response.rb} +4 -78
- data/lib/ynab/models/{budget_settings_response_data.rb → plan_settings_response_data.rb} +4 -78
- data/lib/ynab/models/{budget_summary.rb → plan_summary.rb} +7 -83
- data/lib/ynab/models/plan_summary_response.rb +136 -0
- data/lib/ynab/models/{budget_summary_response_data.rb → plan_summary_response_data.rb} +5 -79
- data/lib/ynab/models/post_account_wrapper.rb +1 -75
- data/lib/ynab/models/post_category_group_wrapper.rb +136 -0
- data/lib/ynab/models/post_category_wrapper.rb +136 -0
- data/lib/ynab/models/post_scheduled_transaction_wrapper.rb +1 -75
- data/lib/ynab/models/post_transactions_wrapper.rb +1 -75
- data/lib/ynab/models/put_scheduled_transaction_wrapper.rb +1 -75
- data/lib/ynab/models/put_transaction_wrapper.rb +1 -75
- data/lib/ynab/models/save_account.rb +1 -75
- data/lib/ynab/models/save_category.rb +18 -81
- data/lib/ynab/models/save_category_group.rb +148 -0
- data/lib/ynab/models/save_category_group_response.rb +136 -0
- data/lib/ynab/models/save_category_group_response_data.rb +147 -0
- data/lib/ynab/models/save_category_response.rb +1 -75
- data/lib/ynab/models/save_category_response_data.rb +1 -75
- data/lib/ynab/models/save_month_category.rb +2 -76
- data/lib/ynab/models/save_payee.rb +1 -75
- data/lib/ynab/models/save_payee_response.rb +1 -75
- data/lib/ynab/models/save_payee_response_data.rb +1 -75
- data/lib/ynab/models/save_scheduled_transaction.rb +1 -75
- data/lib/ynab/models/save_sub_transaction.rb +1 -75
- data/lib/ynab/models/save_transaction_with_id_or_import_id.rb +1 -79
- data/lib/ynab/models/save_transaction_with_optional_fields.rb +1 -75
- data/lib/ynab/models/save_transactions_response.rb +1 -75
- data/lib/ynab/models/save_transactions_response_data.rb +1 -75
- data/lib/ynab/models/scheduled_sub_transaction.rb +1 -75
- data/lib/ynab/models/scheduled_transaction_detail.rb +1 -80
- data/lib/ynab/models/scheduled_transaction_response.rb +1 -75
- data/lib/ynab/models/scheduled_transaction_response_data.rb +1 -75
- data/lib/ynab/models/scheduled_transaction_summary.rb +1 -75
- data/lib/ynab/models/scheduled_transactions_response.rb +1 -75
- data/lib/ynab/models/scheduled_transactions_response_data.rb +1 -75
- data/lib/ynab/models/sub_transaction.rb +1 -75
- data/lib/ynab/models/transaction_detail.rb +1 -85
- data/lib/ynab/models/transaction_flag_color.rb +2 -1
- data/lib/ynab/models/transaction_response.rb +1 -75
- data/lib/ynab/models/transaction_response_data.rb +16 -79
- data/lib/ynab/models/transaction_summary.rb +1 -75
- data/lib/ynab/models/transactions_import_response.rb +1 -75
- data/lib/ynab/models/transactions_import_response_data.rb +1 -75
- data/lib/ynab/models/transactions_response.rb +1 -75
- data/lib/ynab/models/transactions_response_data.rb +1 -75
- data/lib/ynab/models/user.rb +1 -75
- data/lib/ynab/models/user_response.rb +1 -75
- data/lib/ynab/models/user_response_data.rb +1 -75
- data/lib/ynab/overrides/transactions_api.rb +6 -6
- data/lib/ynab/version.rb +1 -1
- data/lib/ynab.rb +28 -13
- data/open_api_spec.yaml +1163 -905
- data/spec/api/accounts_spec.rb +9 -9
- data/spec/api/categories_spec.rb +9 -9
- data/spec/api/months_spec.rb +7 -7
- data/spec/api/payee_locations_spec.rb +7 -7
- data/spec/api/payees_spec.rb +7 -7
- data/spec/api/{budgets_spec.rb → plans_spec.rb} +12 -12
- data/spec/api/scheduled_transactions_spec.rb +9 -9
- data/spec/api/transactions_spec.rb +28 -28
- data/spec/fixtures/vcr_cassettes/plans.yml +49 -0
- data/spec/fixtures/vcr_cassettes/plans_unauthorized.yml +49 -0
- data/templates/gem.mustache +3 -2
- data/templates/partial_model_generic.mustache +1 -1
- data/ynab.gemspec +1 -2
- metadata +94 -59
- data/docs/BudgetSettingsResponseData.md +0 -8
- data/docs/BudgetSummary.md +0 -15
- data/docs/BudgetSummaryResponse.md +0 -8
- data/docs/BudgetSummaryResponseData.md +0 -9
- data/docs/BudgetsApi.md +0 -68
|
@@ -11,8 +11,8 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
# The currency format setting for the
|
|
15
|
-
class CurrencyFormat
|
|
14
|
+
# The currency format setting for the plan. In some cases the format will not be available and will be specified as null.
|
|
15
|
+
class CurrencyFormat < ApiModelBase
|
|
16
16
|
attr_accessor :iso_code
|
|
17
17
|
|
|
18
18
|
attr_accessor :example_format
|
|
@@ -187,61 +187,6 @@ module YNAB
|
|
|
187
187
|
new(transformed_hash)
|
|
188
188
|
end
|
|
189
189
|
|
|
190
|
-
# Deserializes the data based on type
|
|
191
|
-
# @param string type Data type
|
|
192
|
-
# @param string value Value to be deserialized
|
|
193
|
-
# @return [Object] Deserialized data
|
|
194
|
-
def self._deserialize(type, value)
|
|
195
|
-
case type.to_sym
|
|
196
|
-
when :Time
|
|
197
|
-
Time.parse(value)
|
|
198
|
-
when :Date
|
|
199
|
-
Date.parse(value)
|
|
200
|
-
when :String
|
|
201
|
-
value.to_s
|
|
202
|
-
when :Integer
|
|
203
|
-
value.to_i
|
|
204
|
-
when :Float
|
|
205
|
-
value.to_f
|
|
206
|
-
when :Boolean
|
|
207
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
208
|
-
true
|
|
209
|
-
else
|
|
210
|
-
false
|
|
211
|
-
end
|
|
212
|
-
when :Object
|
|
213
|
-
# generic object (usually a Hash), return directly
|
|
214
|
-
value
|
|
215
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
216
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
217
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
218
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
219
|
-
k_type = Regexp.last_match[:k_type]
|
|
220
|
-
v_type = Regexp.last_match[:v_type]
|
|
221
|
-
{}.tap do |hash|
|
|
222
|
-
value.each do |k, v|
|
|
223
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
224
|
-
end
|
|
225
|
-
end
|
|
226
|
-
else # model
|
|
227
|
-
# models (e.g. Pet) or oneOf
|
|
228
|
-
klass = YNAB.const_get(type)
|
|
229
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
230
|
-
end
|
|
231
|
-
end
|
|
232
|
-
|
|
233
|
-
# Returns the string representation of the object
|
|
234
|
-
# @return [String] String presentation of the object
|
|
235
|
-
def to_s
|
|
236
|
-
to_hash.to_s
|
|
237
|
-
end
|
|
238
|
-
|
|
239
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
240
|
-
# @return [Hash] Returns the object in the form of hash
|
|
241
|
-
def to_body
|
|
242
|
-
to_hash
|
|
243
|
-
end
|
|
244
|
-
|
|
245
190
|
# Returns the object in the form of hash
|
|
246
191
|
# @return [Hash] Returns the object in the form of hash
|
|
247
192
|
def to_hash
|
|
@@ -257,25 +202,6 @@ module YNAB
|
|
|
257
202
|
end
|
|
258
203
|
hash
|
|
259
204
|
end
|
|
260
|
-
|
|
261
|
-
# Outputs non-array value in the form of hash
|
|
262
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
263
|
-
# @param [Object] value Any valid value
|
|
264
|
-
# @return [Hash] Returns the value in the form of hash
|
|
265
|
-
def _to_hash(value)
|
|
266
|
-
if value.is_a?(Array)
|
|
267
|
-
value.compact.map { |v| _to_hash(v) }
|
|
268
|
-
elsif value.is_a?(Hash)
|
|
269
|
-
{}.tap do |hash|
|
|
270
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
271
|
-
end
|
|
272
|
-
elsif value.respond_to? :to_hash
|
|
273
|
-
value.to_hash
|
|
274
|
-
else
|
|
275
|
-
value
|
|
276
|
-
end
|
|
277
|
-
end
|
|
278
|
-
|
|
279
205
|
end
|
|
280
206
|
|
|
281
207
|
end
|
|
@@ -11,8 +11,8 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
# The date format setting for the
|
|
15
|
-
class DateFormat
|
|
14
|
+
# The date format setting for the plan. In some cases the format will not be available and will be specified as null.
|
|
15
|
+
class DateFormat < ApiModelBase
|
|
16
16
|
attr_accessor :format
|
|
17
17
|
|
|
18
18
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -117,61 +117,6 @@ module YNAB
|
|
|
117
117
|
new(transformed_hash)
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
-
# Deserializes the data based on type
|
|
121
|
-
# @param string type Data type
|
|
122
|
-
# @param string value Value to be deserialized
|
|
123
|
-
# @return [Object] Deserialized data
|
|
124
|
-
def self._deserialize(type, value)
|
|
125
|
-
case type.to_sym
|
|
126
|
-
when :Time
|
|
127
|
-
Time.parse(value)
|
|
128
|
-
when :Date
|
|
129
|
-
Date.parse(value)
|
|
130
|
-
when :String
|
|
131
|
-
value.to_s
|
|
132
|
-
when :Integer
|
|
133
|
-
value.to_i
|
|
134
|
-
when :Float
|
|
135
|
-
value.to_f
|
|
136
|
-
when :Boolean
|
|
137
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
138
|
-
true
|
|
139
|
-
else
|
|
140
|
-
false
|
|
141
|
-
end
|
|
142
|
-
when :Object
|
|
143
|
-
# generic object (usually a Hash), return directly
|
|
144
|
-
value
|
|
145
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
146
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
147
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
148
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
149
|
-
k_type = Regexp.last_match[:k_type]
|
|
150
|
-
v_type = Regexp.last_match[:v_type]
|
|
151
|
-
{}.tap do |hash|
|
|
152
|
-
value.each do |k, v|
|
|
153
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
154
|
-
end
|
|
155
|
-
end
|
|
156
|
-
else # model
|
|
157
|
-
# models (e.g. Pet) or oneOf
|
|
158
|
-
klass = YNAB.const_get(type)
|
|
159
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
# Returns the string representation of the object
|
|
164
|
-
# @return [String] String presentation of the object
|
|
165
|
-
def to_s
|
|
166
|
-
to_hash.to_s
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
170
|
-
# @return [Hash] Returns the object in the form of hash
|
|
171
|
-
def to_body
|
|
172
|
-
to_hash
|
|
173
|
-
end
|
|
174
|
-
|
|
175
120
|
# Returns the object in the form of hash
|
|
176
121
|
# @return [Hash] Returns the object in the form of hash
|
|
177
122
|
def to_hash
|
|
@@ -187,25 +132,6 @@ module YNAB
|
|
|
187
132
|
end
|
|
188
133
|
hash
|
|
189
134
|
end
|
|
190
|
-
|
|
191
|
-
# Outputs non-array value in the form of hash
|
|
192
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
193
|
-
# @param [Object] value Any valid value
|
|
194
|
-
# @return [Hash] Returns the value in the form of hash
|
|
195
|
-
def _to_hash(value)
|
|
196
|
-
if value.is_a?(Array)
|
|
197
|
-
value.compact.map { |v| _to_hash(v) }
|
|
198
|
-
elsif value.is_a?(Hash)
|
|
199
|
-
{}.tap do |hash|
|
|
200
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
201
|
-
end
|
|
202
|
-
elsif value.respond_to? :to_hash
|
|
203
|
-
value.to_hash
|
|
204
|
-
else
|
|
205
|
-
value
|
|
206
|
-
end
|
|
207
|
-
end
|
|
208
|
-
|
|
209
135
|
end
|
|
210
136
|
|
|
211
137
|
end
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
class ErrorDetail
|
|
14
|
+
class ErrorDetail < ApiModelBase
|
|
15
15
|
attr_accessor :id
|
|
16
16
|
|
|
17
17
|
attr_accessor :name
|
|
@@ -136,61 +136,6 @@ module YNAB
|
|
|
136
136
|
new(transformed_hash)
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
-
# Deserializes the data based on type
|
|
140
|
-
# @param string type Data type
|
|
141
|
-
# @param string value Value to be deserialized
|
|
142
|
-
# @return [Object] Deserialized data
|
|
143
|
-
def self._deserialize(type, value)
|
|
144
|
-
case type.to_sym
|
|
145
|
-
when :Time
|
|
146
|
-
Time.parse(value)
|
|
147
|
-
when :Date
|
|
148
|
-
Date.parse(value)
|
|
149
|
-
when :String
|
|
150
|
-
value.to_s
|
|
151
|
-
when :Integer
|
|
152
|
-
value.to_i
|
|
153
|
-
when :Float
|
|
154
|
-
value.to_f
|
|
155
|
-
when :Boolean
|
|
156
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
157
|
-
true
|
|
158
|
-
else
|
|
159
|
-
false
|
|
160
|
-
end
|
|
161
|
-
when :Object
|
|
162
|
-
# generic object (usually a Hash), return directly
|
|
163
|
-
value
|
|
164
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
165
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
166
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
167
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
168
|
-
k_type = Regexp.last_match[:k_type]
|
|
169
|
-
v_type = Regexp.last_match[:v_type]
|
|
170
|
-
{}.tap do |hash|
|
|
171
|
-
value.each do |k, v|
|
|
172
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
else # model
|
|
176
|
-
# models (e.g. Pet) or oneOf
|
|
177
|
-
klass = YNAB.const_get(type)
|
|
178
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
179
|
-
end
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
# Returns the string representation of the object
|
|
183
|
-
# @return [String] String presentation of the object
|
|
184
|
-
def to_s
|
|
185
|
-
to_hash.to_s
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
189
|
-
# @return [Hash] Returns the object in the form of hash
|
|
190
|
-
def to_body
|
|
191
|
-
to_hash
|
|
192
|
-
end
|
|
193
|
-
|
|
194
139
|
# Returns the object in the form of hash
|
|
195
140
|
# @return [Hash] Returns the object in the form of hash
|
|
196
141
|
def to_hash
|
|
@@ -206,25 +151,6 @@ module YNAB
|
|
|
206
151
|
end
|
|
207
152
|
hash
|
|
208
153
|
end
|
|
209
|
-
|
|
210
|
-
# Outputs non-array value in the form of hash
|
|
211
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
212
|
-
# @param [Object] value Any valid value
|
|
213
|
-
# @return [Hash] Returns the value in the form of hash
|
|
214
|
-
def _to_hash(value)
|
|
215
|
-
if value.is_a?(Array)
|
|
216
|
-
value.compact.map { |v| _to_hash(v) }
|
|
217
|
-
elsif value.is_a?(Hash)
|
|
218
|
-
{}.tap do |hash|
|
|
219
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
220
|
-
end
|
|
221
|
-
elsif value.respond_to? :to_hash
|
|
222
|
-
value.to_hash
|
|
223
|
-
else
|
|
224
|
-
value
|
|
225
|
-
end
|
|
226
|
-
end
|
|
227
|
-
|
|
228
154
|
end
|
|
229
155
|
|
|
230
156
|
end
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
class ErrorResponse
|
|
14
|
+
class ErrorResponse < ApiModelBase
|
|
15
15
|
attr_accessor :error
|
|
16
16
|
|
|
17
17
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -116,61 +116,6 @@ module YNAB
|
|
|
116
116
|
new(transformed_hash)
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
-
# Deserializes the data based on type
|
|
120
|
-
# @param string type Data type
|
|
121
|
-
# @param string value Value to be deserialized
|
|
122
|
-
# @return [Object] Deserialized data
|
|
123
|
-
def self._deserialize(type, value)
|
|
124
|
-
case type.to_sym
|
|
125
|
-
when :Time
|
|
126
|
-
Time.parse(value)
|
|
127
|
-
when :Date
|
|
128
|
-
Date.parse(value)
|
|
129
|
-
when :String
|
|
130
|
-
value.to_s
|
|
131
|
-
when :Integer
|
|
132
|
-
value.to_i
|
|
133
|
-
when :Float
|
|
134
|
-
value.to_f
|
|
135
|
-
when :Boolean
|
|
136
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
137
|
-
true
|
|
138
|
-
else
|
|
139
|
-
false
|
|
140
|
-
end
|
|
141
|
-
when :Object
|
|
142
|
-
# generic object (usually a Hash), return directly
|
|
143
|
-
value
|
|
144
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
145
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
146
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
147
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
148
|
-
k_type = Regexp.last_match[:k_type]
|
|
149
|
-
v_type = Regexp.last_match[:v_type]
|
|
150
|
-
{}.tap do |hash|
|
|
151
|
-
value.each do |k, v|
|
|
152
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
|
-
else # model
|
|
156
|
-
# models (e.g. Pet) or oneOf
|
|
157
|
-
klass = YNAB.const_get(type)
|
|
158
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
# Returns the string representation of the object
|
|
163
|
-
# @return [String] String presentation of the object
|
|
164
|
-
def to_s
|
|
165
|
-
to_hash.to_s
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
169
|
-
# @return [Hash] Returns the object in the form of hash
|
|
170
|
-
def to_body
|
|
171
|
-
to_hash
|
|
172
|
-
end
|
|
173
|
-
|
|
174
119
|
# Returns the object in the form of hash
|
|
175
120
|
# @return [Hash] Returns the object in the form of hash
|
|
176
121
|
def to_hash
|
|
@@ -186,25 +131,6 @@ module YNAB
|
|
|
186
131
|
end
|
|
187
132
|
hash
|
|
188
133
|
end
|
|
189
|
-
|
|
190
|
-
# Outputs non-array value in the form of hash
|
|
191
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
192
|
-
# @param [Object] value Any valid value
|
|
193
|
-
# @return [Hash] Returns the value in the form of hash
|
|
194
|
-
def _to_hash(value)
|
|
195
|
-
if value.is_a?(Array)
|
|
196
|
-
value.compact.map { |v| _to_hash(v) }
|
|
197
|
-
elsif value.is_a?(Hash)
|
|
198
|
-
{}.tap do |hash|
|
|
199
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
200
|
-
end
|
|
201
|
-
elsif value.respond_to? :to_hash
|
|
202
|
-
value.to_hash
|
|
203
|
-
else
|
|
204
|
-
value
|
|
205
|
-
end
|
|
206
|
-
end
|
|
207
|
-
|
|
208
134
|
end
|
|
209
135
|
|
|
210
136
|
end
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#YNAB API Endpoints
|
|
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.ynab.com
|
|
5
|
+
|
|
6
|
+
Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'date'
|
|
11
|
+
require 'time'
|
|
12
|
+
|
|
13
|
+
module YNAB
|
|
14
|
+
class ExistingCategory < ApiModelBase
|
|
15
|
+
attr_accessor :name
|
|
16
|
+
|
|
17
|
+
attr_accessor :note
|
|
18
|
+
|
|
19
|
+
attr_accessor :category_group_id
|
|
20
|
+
|
|
21
|
+
# The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount.
|
|
22
|
+
attr_accessor :goal_target
|
|
23
|
+
|
|
24
|
+
# The goal target date in ISO format (e.g. 2016-12-01).
|
|
25
|
+
attr_accessor :goal_target_date
|
|
26
|
+
|
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
28
|
+
def self.attribute_map
|
|
29
|
+
{
|
|
30
|
+
:'name' => :'name',
|
|
31
|
+
:'note' => :'note',
|
|
32
|
+
:'category_group_id' => :'category_group_id',
|
|
33
|
+
:'goal_target' => :'goal_target',
|
|
34
|
+
:'goal_target_date' => :'goal_target_date'
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Returns all the JSON keys this model knows about
|
|
39
|
+
def self.acceptable_attributes
|
|
40
|
+
attribute_map.values
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Attribute type mapping.
|
|
44
|
+
def self.openapi_types
|
|
45
|
+
{
|
|
46
|
+
:'name' => :'String',
|
|
47
|
+
:'note' => :'String',
|
|
48
|
+
:'category_group_id' => :'String',
|
|
49
|
+
:'goal_target' => :'Integer',
|
|
50
|
+
:'goal_target_date' => :'Date'
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# List of attributes with nullable: true
|
|
55
|
+
def self.openapi_nullable
|
|
56
|
+
Set.new([
|
|
57
|
+
])
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# List of class defined in allOf (OpenAPI v3)
|
|
61
|
+
def self.openapi_all_of
|
|
62
|
+
[
|
|
63
|
+
:'SaveCategory'
|
|
64
|
+
]
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Initializes the object
|
|
68
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
69
|
+
def initialize(attributes = {})
|
|
70
|
+
if (!attributes.is_a?(Hash))
|
|
71
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::ExistingCategory` initialize method"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
75
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
76
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
77
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ExistingCategory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
78
|
+
end
|
|
79
|
+
h[k.to_sym] = v
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if attributes.key?(:'name')
|
|
83
|
+
self.name = attributes[:'name']
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'note')
|
|
87
|
+
self.note = attributes[:'note']
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if attributes.key?(:'category_group_id')
|
|
91
|
+
self.category_group_id = attributes[:'category_group_id']
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'goal_target')
|
|
95
|
+
self.goal_target = attributes[:'goal_target']
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'goal_target_date')
|
|
99
|
+
self.goal_target_date = attributes[:'goal_target_date']
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
104
|
+
# @return Array for valid properties with the reasons
|
|
105
|
+
def list_invalid_properties
|
|
106
|
+
invalid_properties = Array.new
|
|
107
|
+
invalid_properties
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Check to see if the all the properties in the model are valid
|
|
111
|
+
# @return true if the model is valid
|
|
112
|
+
def valid?
|
|
113
|
+
true
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Checks equality by comparing each attribute.
|
|
117
|
+
# @param [Object] Object to be compared
|
|
118
|
+
def ==(o)
|
|
119
|
+
return true if self.equal?(o)
|
|
120
|
+
self.class == o.class &&
|
|
121
|
+
name == o.name &&
|
|
122
|
+
note == o.note &&
|
|
123
|
+
category_group_id == o.category_group_id &&
|
|
124
|
+
goal_target == o.goal_target &&
|
|
125
|
+
goal_target_date == o.goal_target_date
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# @see the `==` method
|
|
129
|
+
# @param [Object] Object to be compared
|
|
130
|
+
def eql?(o)
|
|
131
|
+
self == o
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Calculates hash code according to all attributes.
|
|
135
|
+
# @return [Integer] Hash code
|
|
136
|
+
def hash
|
|
137
|
+
[name, note, category_group_id, goal_target, goal_target_date].hash
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Builds the object from hash
|
|
141
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
142
|
+
# @return [Object] Returns the model itself
|
|
143
|
+
def self.build_from_hash(attributes)
|
|
144
|
+
return nil unless attributes.is_a?(Hash)
|
|
145
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
146
|
+
transformed_hash = {}
|
|
147
|
+
openapi_types.each_pair do |key, type|
|
|
148
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
149
|
+
transformed_hash["#{key}"] = nil
|
|
150
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
151
|
+
# check to ensure the input is an array given that the attribute
|
|
152
|
+
# is documented as an array but the input is not
|
|
153
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
154
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
155
|
+
end
|
|
156
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
157
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
new(transformed_hash)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Returns the object in the form of hash
|
|
164
|
+
# @return [Hash] Returns the object in the form of hash
|
|
165
|
+
def to_hash
|
|
166
|
+
hash = {}
|
|
167
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
168
|
+
value = self.send(attr)
|
|
169
|
+
if value.nil?
|
|
170
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
171
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
hash[param] = _to_hash(value)
|
|
175
|
+
end
|
|
176
|
+
hash
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
end
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
class ExistingTransaction
|
|
14
|
+
class ExistingTransaction < ApiModelBase
|
|
15
15
|
attr_accessor :account_id
|
|
16
16
|
|
|
17
17
|
# The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored.
|
|
@@ -105,10 +105,6 @@ module YNAB
|
|
|
105
105
|
# List of attributes with nullable: true
|
|
106
106
|
def self.openapi_nullable
|
|
107
107
|
Set.new([
|
|
108
|
-
:'payee_id',
|
|
109
|
-
:'payee_name',
|
|
110
|
-
:'category_id',
|
|
111
|
-
:'memo',
|
|
112
108
|
:'flag_color',
|
|
113
109
|
])
|
|
114
110
|
end
|
|
@@ -262,61 +258,6 @@ module YNAB
|
|
|
262
258
|
new(transformed_hash)
|
|
263
259
|
end
|
|
264
260
|
|
|
265
|
-
# Deserializes the data based on type
|
|
266
|
-
# @param string type Data type
|
|
267
|
-
# @param string value Value to be deserialized
|
|
268
|
-
# @return [Object] Deserialized data
|
|
269
|
-
def self._deserialize(type, value)
|
|
270
|
-
case type.to_sym
|
|
271
|
-
when :Time
|
|
272
|
-
Time.parse(value)
|
|
273
|
-
when :Date
|
|
274
|
-
Date.parse(value)
|
|
275
|
-
when :String
|
|
276
|
-
value.to_s
|
|
277
|
-
when :Integer
|
|
278
|
-
value.to_i
|
|
279
|
-
when :Float
|
|
280
|
-
value.to_f
|
|
281
|
-
when :Boolean
|
|
282
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
283
|
-
true
|
|
284
|
-
else
|
|
285
|
-
false
|
|
286
|
-
end
|
|
287
|
-
when :Object
|
|
288
|
-
# generic object (usually a Hash), return directly
|
|
289
|
-
value
|
|
290
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
291
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
292
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
293
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
294
|
-
k_type = Regexp.last_match[:k_type]
|
|
295
|
-
v_type = Regexp.last_match[:v_type]
|
|
296
|
-
{}.tap do |hash|
|
|
297
|
-
value.each do |k, v|
|
|
298
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
299
|
-
end
|
|
300
|
-
end
|
|
301
|
-
else # model
|
|
302
|
-
# models (e.g. Pet) or oneOf
|
|
303
|
-
klass = YNAB.const_get(type)
|
|
304
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
305
|
-
end
|
|
306
|
-
end
|
|
307
|
-
|
|
308
|
-
# Returns the string representation of the object
|
|
309
|
-
# @return [String] String presentation of the object
|
|
310
|
-
def to_s
|
|
311
|
-
to_hash.to_s
|
|
312
|
-
end
|
|
313
|
-
|
|
314
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
315
|
-
# @return [Hash] Returns the object in the form of hash
|
|
316
|
-
def to_body
|
|
317
|
-
to_hash
|
|
318
|
-
end
|
|
319
|
-
|
|
320
261
|
# Returns the object in the form of hash
|
|
321
262
|
# @return [Hash] Returns the object in the form of hash
|
|
322
263
|
def to_hash
|
|
@@ -332,25 +273,6 @@ module YNAB
|
|
|
332
273
|
end
|
|
333
274
|
hash
|
|
334
275
|
end
|
|
335
|
-
|
|
336
|
-
# Outputs non-array value in the form of hash
|
|
337
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
338
|
-
# @param [Object] value Any valid value
|
|
339
|
-
# @return [Hash] Returns the value in the form of hash
|
|
340
|
-
def _to_hash(value)
|
|
341
|
-
if value.is_a?(Array)
|
|
342
|
-
value.compact.map { |v| _to_hash(v) }
|
|
343
|
-
elsif value.is_a?(Hash)
|
|
344
|
-
{}.tap do |hash|
|
|
345
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
346
|
-
end
|
|
347
|
-
elsif value.respond_to? :to_hash
|
|
348
|
-
value.to_hash
|
|
349
|
-
else
|
|
350
|
-
value
|
|
351
|
-
end
|
|
352
|
-
end
|
|
353
|
-
|
|
354
276
|
end
|
|
355
277
|
|
|
356
278
|
end
|