ynab 3.9.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 +47 -39
- 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 +4 -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/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 +16 -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_response.rb +1 -75
- data/lib/ynab/models/transaction_response_data.rb +1 -75
- 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 +1155 -910
- 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 +27 -27
- 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 +62 -27
- 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,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
class PutScheduledTransactionWrapper
|
|
14
|
+
class PutScheduledTransactionWrapper < ApiModelBase
|
|
15
15
|
attr_accessor :scheduled_transaction
|
|
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
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
class PutTransactionWrapper
|
|
14
|
+
class PutTransactionWrapper < ApiModelBase
|
|
15
15
|
attr_accessor :transaction
|
|
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
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
class SaveAccount
|
|
14
|
+
class SaveAccount < ApiModelBase
|
|
15
15
|
# The name of the account
|
|
16
16
|
attr_accessor :name
|
|
17
17
|
|
|
@@ -160,61 +160,6 @@ module YNAB
|
|
|
160
160
|
new(transformed_hash)
|
|
161
161
|
end
|
|
162
162
|
|
|
163
|
-
# Deserializes the data based on type
|
|
164
|
-
# @param string type Data type
|
|
165
|
-
# @param string value Value to be deserialized
|
|
166
|
-
# @return [Object] Deserialized data
|
|
167
|
-
def self._deserialize(type, value)
|
|
168
|
-
case type.to_sym
|
|
169
|
-
when :Time
|
|
170
|
-
Time.parse(value)
|
|
171
|
-
when :Date
|
|
172
|
-
Date.parse(value)
|
|
173
|
-
when :String
|
|
174
|
-
value.to_s
|
|
175
|
-
when :Integer
|
|
176
|
-
value.to_i
|
|
177
|
-
when :Float
|
|
178
|
-
value.to_f
|
|
179
|
-
when :Boolean
|
|
180
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
181
|
-
true
|
|
182
|
-
else
|
|
183
|
-
false
|
|
184
|
-
end
|
|
185
|
-
when :Object
|
|
186
|
-
# generic object (usually a Hash), return directly
|
|
187
|
-
value
|
|
188
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
189
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
190
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
191
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
192
|
-
k_type = Regexp.last_match[:k_type]
|
|
193
|
-
v_type = Regexp.last_match[:v_type]
|
|
194
|
-
{}.tap do |hash|
|
|
195
|
-
value.each do |k, v|
|
|
196
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
197
|
-
end
|
|
198
|
-
end
|
|
199
|
-
else # model
|
|
200
|
-
# models (e.g. Pet) or oneOf
|
|
201
|
-
klass = YNAB.const_get(type)
|
|
202
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
203
|
-
end
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
# Returns the string representation of the object
|
|
207
|
-
# @return [String] String presentation of the object
|
|
208
|
-
def to_s
|
|
209
|
-
to_hash.to_s
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
213
|
-
# @return [Hash] Returns the object in the form of hash
|
|
214
|
-
def to_body
|
|
215
|
-
to_hash
|
|
216
|
-
end
|
|
217
|
-
|
|
218
163
|
# Returns the object in the form of hash
|
|
219
164
|
# @return [Hash] Returns the object in the form of hash
|
|
220
165
|
def to_hash
|
|
@@ -230,25 +175,6 @@ module YNAB
|
|
|
230
175
|
end
|
|
231
176
|
hash
|
|
232
177
|
end
|
|
233
|
-
|
|
234
|
-
# Outputs non-array value in the form of hash
|
|
235
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
236
|
-
# @param [Object] value Any valid value
|
|
237
|
-
# @return [Hash] Returns the value in the form of hash
|
|
238
|
-
def _to_hash(value)
|
|
239
|
-
if value.is_a?(Array)
|
|
240
|
-
value.compact.map { |v| _to_hash(v) }
|
|
241
|
-
elsif value.is_a?(Hash)
|
|
242
|
-
{}.tap do |hash|
|
|
243
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
244
|
-
end
|
|
245
|
-
elsif value.respond_to? :to_hash
|
|
246
|
-
value.to_hash
|
|
247
|
-
else
|
|
248
|
-
value
|
|
249
|
-
end
|
|
250
|
-
end
|
|
251
|
-
|
|
252
178
|
end
|
|
253
179
|
|
|
254
180
|
end
|
|
@@ -11,23 +11,27 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
class SaveCategory
|
|
14
|
+
class SaveCategory < ApiModelBase
|
|
15
15
|
attr_accessor :name
|
|
16
16
|
|
|
17
17
|
attr_accessor :note
|
|
18
18
|
|
|
19
19
|
attr_accessor :category_group_id
|
|
20
20
|
|
|
21
|
-
# The goal target amount in milliunits format.
|
|
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
22
|
attr_accessor :goal_target
|
|
23
23
|
|
|
24
|
+
# The goal target date in ISO format (e.g. 2016-12-01).
|
|
25
|
+
attr_accessor :goal_target_date
|
|
26
|
+
|
|
24
27
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
28
|
def self.attribute_map
|
|
26
29
|
{
|
|
27
30
|
:'name' => :'name',
|
|
28
31
|
:'note' => :'note',
|
|
29
32
|
:'category_group_id' => :'category_group_id',
|
|
30
|
-
:'goal_target' => :'goal_target'
|
|
33
|
+
:'goal_target' => :'goal_target',
|
|
34
|
+
:'goal_target_date' => :'goal_target_date'
|
|
31
35
|
}
|
|
32
36
|
end
|
|
33
37
|
|
|
@@ -42,7 +46,8 @@ module YNAB
|
|
|
42
46
|
:'name' => :'String',
|
|
43
47
|
:'note' => :'String',
|
|
44
48
|
:'category_group_id' => :'String',
|
|
45
|
-
:'goal_target' => :'Integer'
|
|
49
|
+
:'goal_target' => :'Integer',
|
|
50
|
+
:'goal_target_date' => :'Date'
|
|
46
51
|
}
|
|
47
52
|
end
|
|
48
53
|
|
|
@@ -51,7 +56,8 @@ module YNAB
|
|
|
51
56
|
Set.new([
|
|
52
57
|
:'name',
|
|
53
58
|
:'note',
|
|
54
|
-
:'goal_target'
|
|
59
|
+
:'goal_target',
|
|
60
|
+
:'goal_target_date'
|
|
55
61
|
])
|
|
56
62
|
end
|
|
57
63
|
|
|
@@ -85,6 +91,10 @@ module YNAB
|
|
|
85
91
|
if attributes.key?(:'goal_target')
|
|
86
92
|
self.goal_target = attributes[:'goal_target']
|
|
87
93
|
end
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'goal_target_date')
|
|
96
|
+
self.goal_target_date = attributes[:'goal_target_date']
|
|
97
|
+
end
|
|
88
98
|
end
|
|
89
99
|
|
|
90
100
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -108,7 +118,8 @@ module YNAB
|
|
|
108
118
|
name == o.name &&
|
|
109
119
|
note == o.note &&
|
|
110
120
|
category_group_id == o.category_group_id &&
|
|
111
|
-
goal_target == o.goal_target
|
|
121
|
+
goal_target == o.goal_target &&
|
|
122
|
+
goal_target_date == o.goal_target_date
|
|
112
123
|
end
|
|
113
124
|
|
|
114
125
|
# @see the `==` method
|
|
@@ -120,7 +131,7 @@ module YNAB
|
|
|
120
131
|
# Calculates hash code according to all attributes.
|
|
121
132
|
# @return [Integer] Hash code
|
|
122
133
|
def hash
|
|
123
|
-
[name, note, category_group_id, goal_target].hash
|
|
134
|
+
[name, note, category_group_id, goal_target, goal_target_date].hash
|
|
124
135
|
end
|
|
125
136
|
|
|
126
137
|
# Builds the object from hash
|
|
@@ -146,61 +157,6 @@ module YNAB
|
|
|
146
157
|
new(transformed_hash)
|
|
147
158
|
end
|
|
148
159
|
|
|
149
|
-
# Deserializes the data based on type
|
|
150
|
-
# @param string type Data type
|
|
151
|
-
# @param string value Value to be deserialized
|
|
152
|
-
# @return [Object] Deserialized data
|
|
153
|
-
def self._deserialize(type, value)
|
|
154
|
-
case type.to_sym
|
|
155
|
-
when :Time
|
|
156
|
-
Time.parse(value)
|
|
157
|
-
when :Date
|
|
158
|
-
Date.parse(value)
|
|
159
|
-
when :String
|
|
160
|
-
value.to_s
|
|
161
|
-
when :Integer
|
|
162
|
-
value.to_i
|
|
163
|
-
when :Float
|
|
164
|
-
value.to_f
|
|
165
|
-
when :Boolean
|
|
166
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
167
|
-
true
|
|
168
|
-
else
|
|
169
|
-
false
|
|
170
|
-
end
|
|
171
|
-
when :Object
|
|
172
|
-
# generic object (usually a Hash), return directly
|
|
173
|
-
value
|
|
174
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
175
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
176
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
177
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
178
|
-
k_type = Regexp.last_match[:k_type]
|
|
179
|
-
v_type = Regexp.last_match[:v_type]
|
|
180
|
-
{}.tap do |hash|
|
|
181
|
-
value.each do |k, v|
|
|
182
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
else # model
|
|
186
|
-
# models (e.g. Pet) or oneOf
|
|
187
|
-
klass = YNAB.const_get(type)
|
|
188
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
# Returns the string representation of the object
|
|
193
|
-
# @return [String] String presentation of the object
|
|
194
|
-
def to_s
|
|
195
|
-
to_hash.to_s
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
199
|
-
# @return [Hash] Returns the object in the form of hash
|
|
200
|
-
def to_body
|
|
201
|
-
to_hash
|
|
202
|
-
end
|
|
203
|
-
|
|
204
160
|
# Returns the object in the form of hash
|
|
205
161
|
# @return [Hash] Returns the object in the form of hash
|
|
206
162
|
def to_hash
|
|
@@ -216,25 +172,6 @@ module YNAB
|
|
|
216
172
|
end
|
|
217
173
|
hash
|
|
218
174
|
end
|
|
219
|
-
|
|
220
|
-
# Outputs non-array value in the form of hash
|
|
221
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
222
|
-
# @param [Object] value Any valid value
|
|
223
|
-
# @return [Hash] Returns the value in the form of hash
|
|
224
|
-
def _to_hash(value)
|
|
225
|
-
if value.is_a?(Array)
|
|
226
|
-
value.compact.map { |v| _to_hash(v) }
|
|
227
|
-
elsif value.is_a?(Hash)
|
|
228
|
-
{}.tap do |hash|
|
|
229
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
230
|
-
end
|
|
231
|
-
elsif value.respond_to? :to_hash
|
|
232
|
-
value.to_hash
|
|
233
|
-
else
|
|
234
|
-
value
|
|
235
|
-
end
|
|
236
|
-
end
|
|
237
|
-
|
|
238
175
|
end
|
|
239
176
|
|
|
240
177
|
end
|
|
@@ -0,0 +1,148 @@
|
|
|
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 SaveCategoryGroup < ApiModelBase
|
|
15
|
+
# The name of the category group. The name must be a maximum of 50 characters.
|
|
16
|
+
attr_accessor :name
|
|
17
|
+
|
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
19
|
+
def self.attribute_map
|
|
20
|
+
{
|
|
21
|
+
:'name' => :'name'
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Returns all the JSON keys this model knows about
|
|
26
|
+
def self.acceptable_attributes
|
|
27
|
+
attribute_map.values
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Attribute type mapping.
|
|
31
|
+
def self.openapi_types
|
|
32
|
+
{
|
|
33
|
+
:'name' => :'String'
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# List of attributes with nullable: true
|
|
38
|
+
def self.openapi_nullable
|
|
39
|
+
Set.new([
|
|
40
|
+
])
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Initializes the object
|
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
45
|
+
def initialize(attributes = {})
|
|
46
|
+
if (!attributes.is_a?(Hash))
|
|
47
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveCategoryGroup` initialize method"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
51
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
52
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
53
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveCategoryGroup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
54
|
+
end
|
|
55
|
+
h[k.to_sym] = v
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if attributes.key?(:'name')
|
|
59
|
+
self.name = attributes[:'name']
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
64
|
+
# @return Array for valid properties with the reasons
|
|
65
|
+
def list_invalid_properties
|
|
66
|
+
invalid_properties = Array.new
|
|
67
|
+
invalid_properties
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Check to see if the all the properties in the model are valid
|
|
71
|
+
# @return true if the model is valid
|
|
72
|
+
def valid?
|
|
73
|
+
return false if @name.nil?
|
|
74
|
+
return false if @name.to_s.length > 50
|
|
75
|
+
true
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Custom attribute writer method with validation
|
|
79
|
+
# @param [Object] name Value to be assigned
|
|
80
|
+
def name=(name)
|
|
81
|
+
if name.nil?
|
|
82
|
+
fail ArgumentError, 'name cannot be nil'
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
@name = name
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Checks equality by comparing each attribute.
|
|
89
|
+
# @param [Object] Object to be compared
|
|
90
|
+
def ==(o)
|
|
91
|
+
return true if self.equal?(o)
|
|
92
|
+
self.class == o.class &&
|
|
93
|
+
name == o.name
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# @see the `==` method
|
|
97
|
+
# @param [Object] Object to be compared
|
|
98
|
+
def eql?(o)
|
|
99
|
+
self == o
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Calculates hash code according to all attributes.
|
|
103
|
+
# @return [Integer] Hash code
|
|
104
|
+
def hash
|
|
105
|
+
[name].hash
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Builds the object from hash
|
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
110
|
+
# @return [Object] Returns the model itself
|
|
111
|
+
def self.build_from_hash(attributes)
|
|
112
|
+
return nil unless attributes.is_a?(Hash)
|
|
113
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
114
|
+
transformed_hash = {}
|
|
115
|
+
openapi_types.each_pair do |key, type|
|
|
116
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
117
|
+
transformed_hash["#{key}"] = nil
|
|
118
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
119
|
+
# check to ensure the input is an array given that the attribute
|
|
120
|
+
# is documented as an array but the input is not
|
|
121
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
122
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
123
|
+
end
|
|
124
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
125
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
new(transformed_hash)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Returns the object in the form of hash
|
|
132
|
+
# @return [Hash] Returns the object in the form of hash
|
|
133
|
+
def to_hash
|
|
134
|
+
hash = {}
|
|
135
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
136
|
+
value = self.send(attr)
|
|
137
|
+
if value.nil?
|
|
138
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
139
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
hash[param] = _to_hash(value)
|
|
143
|
+
end
|
|
144
|
+
hash
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|