ynab 3.9.0 → 5.0.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 +4 -2
- data/README.md +47 -39
- data/Rakefile +3 -3
- 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} +55 -56
- 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/{budget_summary_response_data.rb → money_movement.rb} +95 -93
- 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/{budget_detail_response_data.rb → money_movements_response_data.rb} +13 -85
- 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/plan_detail_response_data.rb +147 -0
- 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/plan_summary_response_data.rb +147 -0
- 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 +1161 -916
- 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/plans_spec.rb +55 -0
- data/spec/api/scheduled_transactions_spec.rb +9 -9
- data/spec/api/transactions_spec.rb +27 -27
- data/spec/fixtures/vcr_cassettes/account.yml +2 -2
- data/spec/fixtures/vcr_cassettes/accounts.yml +2 -2
- data/spec/fixtures/vcr_cassettes/accounts_unauthorized.yml +2 -2
- data/spec/fixtures/vcr_cassettes/bulk_transactions.yml +2 -2
- data/spec/fixtures/vcr_cassettes/categories.yml +2 -2
- data/spec/fixtures/vcr_cassettes/categories_unauthorized.yml +2 -2
- data/spec/fixtures/vcr_cassettes/category.yml +2 -2
- data/spec/fixtures/vcr_cassettes/category_transactions.yml +2 -2
- data/spec/fixtures/vcr_cassettes/create_account.yml +2 -2
- data/spec/fixtures/vcr_cassettes/create_scheduled_transaction.yml +2 -2
- data/spec/fixtures/vcr_cassettes/create_transaction.yml +2 -2
- data/spec/fixtures/vcr_cassettes/create_transactions.yml +2 -2
- data/spec/fixtures/vcr_cassettes/import_transactions.yml +2 -2
- data/spec/fixtures/vcr_cassettes/month.yml +2 -2
- data/spec/fixtures/vcr_cassettes/month_transactions.yml +2 -2
- data/spec/fixtures/vcr_cassettes/months.yml +2 -2
- data/spec/fixtures/vcr_cassettes/months_unauthorized.yml +2 -2
- data/spec/fixtures/vcr_cassettes/multiple_transactions.yml +2 -2
- data/spec/fixtures/vcr_cassettes/patch_month_category.yml +2 -2
- data/spec/fixtures/vcr_cassettes/payee.yml +2 -2
- data/spec/fixtures/vcr_cassettes/payee_location.yml +2 -2
- data/spec/fixtures/vcr_cassettes/payee_locations.yml +2 -2
- data/spec/fixtures/vcr_cassettes/payee_locations_unauthorized.yml +2 -2
- data/spec/fixtures/vcr_cassettes/payee_transactions.yml +2 -2
- data/spec/fixtures/vcr_cassettes/payees.yml +2 -2
- data/spec/fixtures/vcr_cassettes/payees_unauthorized.yml +2 -2
- data/spec/fixtures/vcr_cassettes/{budget.yml → plan.yml} +3 -3
- data/spec/fixtures/vcr_cassettes/{budgets.yml → plans.yml} +3 -3
- data/spec/fixtures/vcr_cassettes/{budgets_unauthorized.yml → plans_unauthorized.yml} +3 -3
- data/spec/fixtures/vcr_cassettes/scheduled_transaction.yml +2 -2
- data/spec/fixtures/vcr_cassettes/scheduled_transactions.yml +2 -2
- data/spec/fixtures/vcr_cassettes/scheduled_transactions_unauthorized.yml +2 -2
- data/spec/fixtures/vcr_cassettes/transaction.yml +2 -2
- data/spec/fixtures/vcr_cassettes/transactions.yml +2 -2
- data/spec/fixtures/vcr_cassettes/transactions_invalid_flags.yml +2 -2
- data/spec/fixtures/vcr_cassettes/transactions_unauthorized.yml +2 -2
- data/spec/fixtures/vcr_cassettes/update_transaction.yml +2 -2
- data/spec/fixtures/vcr_cassettes/update_transactions.yml +2 -2
- data/templates/gem.mustache +3 -2
- data/templates/partial_model_generic.mustache +1 -1
- data/ynab.gemspec +1 -2
- metadata +64 -33
- 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
- data/spec/api/budgets_spec.rb +0 -55
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
class
|
|
14
|
+
class MoneyMovementGroupsResponse < ApiModelBase
|
|
15
15
|
attr_accessor :data
|
|
16
16
|
|
|
17
17
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -29,7 +29,7 @@ module YNAB
|
|
|
29
29
|
# Attribute type mapping.
|
|
30
30
|
def self.openapi_types
|
|
31
31
|
{
|
|
32
|
-
:'data' => :'
|
|
32
|
+
:'data' => :'MoneyMovementGroupsResponseData'
|
|
33
33
|
}
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -43,13 +43,13 @@ module YNAB
|
|
|
43
43
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
44
44
|
def initialize(attributes = {})
|
|
45
45
|
if (!attributes.is_a?(Hash))
|
|
46
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::
|
|
46
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MoneyMovementGroupsResponse` initialize method"
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
50
50
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
51
51
|
if (!self.class.attribute_map.key?(k.to_sym))
|
|
52
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::
|
|
52
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::MoneyMovementGroupsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
53
53
|
end
|
|
54
54
|
h[k.to_sym] = v
|
|
55
55
|
}
|
|
@@ -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,149 @@
|
|
|
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 MoneyMovementGroupsResponseData < ApiModelBase
|
|
15
|
+
attr_accessor :money_movement_groups
|
|
16
|
+
|
|
17
|
+
# The knowledge of the server
|
|
18
|
+
attr_accessor :server_knowledge
|
|
19
|
+
|
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
|
+
def self.attribute_map
|
|
22
|
+
{
|
|
23
|
+
:'money_movement_groups' => :'money_movement_groups',
|
|
24
|
+
:'server_knowledge' => :'server_knowledge'
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns all the JSON keys this model knows about
|
|
29
|
+
def self.acceptable_attributes
|
|
30
|
+
attribute_map.values
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.openapi_types
|
|
35
|
+
{
|
|
36
|
+
:'money_movement_groups' => :'Array<MoneyMovementGroup>',
|
|
37
|
+
:'server_knowledge' => :'Integer'
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# List of attributes with nullable: true
|
|
42
|
+
def self.openapi_nullable
|
|
43
|
+
Set.new([
|
|
44
|
+
])
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Initializes the object
|
|
48
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
49
|
+
def initialize(attributes = {})
|
|
50
|
+
if (!attributes.is_a?(Hash))
|
|
51
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MoneyMovementGroupsResponseData` initialize method"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
55
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
56
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
57
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::MoneyMovementGroupsResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
58
|
+
end
|
|
59
|
+
h[k.to_sym] = v
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if attributes.key?(:'money_movement_groups')
|
|
63
|
+
if (value = attributes[:'money_movement_groups']).is_a?(Array)
|
|
64
|
+
self.money_movement_groups = value
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
if attributes.key?(:'server_knowledge')
|
|
69
|
+
self.server_knowledge = attributes[:'server_knowledge']
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
74
|
+
# @return Array for valid properties with the reasons
|
|
75
|
+
def list_invalid_properties
|
|
76
|
+
invalid_properties = Array.new
|
|
77
|
+
invalid_properties
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Check to see if the all the properties in the model are valid
|
|
81
|
+
# @return true if the model is valid
|
|
82
|
+
def valid?
|
|
83
|
+
return false if @money_movement_groups.nil?
|
|
84
|
+
return false if @server_knowledge.nil?
|
|
85
|
+
true
|
|
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
|
+
money_movement_groups == o.money_movement_groups &&
|
|
94
|
+
server_knowledge == o.server_knowledge
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# @see the `==` method
|
|
98
|
+
# @param [Object] Object to be compared
|
|
99
|
+
def eql?(o)
|
|
100
|
+
self == o
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Calculates hash code according to all attributes.
|
|
104
|
+
# @return [Integer] Hash code
|
|
105
|
+
def hash
|
|
106
|
+
[money_movement_groups, server_knowledge].hash
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Builds the object from hash
|
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
111
|
+
# @return [Object] Returns the model itself
|
|
112
|
+
def self.build_from_hash(attributes)
|
|
113
|
+
return nil unless attributes.is_a?(Hash)
|
|
114
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
115
|
+
transformed_hash = {}
|
|
116
|
+
openapi_types.each_pair do |key, type|
|
|
117
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
118
|
+
transformed_hash["#{key}"] = nil
|
|
119
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
120
|
+
# check to ensure the input is an array given that the attribute
|
|
121
|
+
# is documented as an array but the input is not
|
|
122
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
123
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
124
|
+
end
|
|
125
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
126
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
new(transformed_hash)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Returns the object in the form of hash
|
|
133
|
+
# @return [Hash] Returns the object in the form of hash
|
|
134
|
+
def to_hash
|
|
135
|
+
hash = {}
|
|
136
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
137
|
+
value = self.send(attr)
|
|
138
|
+
if value.nil?
|
|
139
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
140
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
hash[param] = _to_hash(value)
|
|
144
|
+
end
|
|
145
|
+
hash
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
end
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
class
|
|
14
|
+
class MoneyMovementsResponse < ApiModelBase
|
|
15
15
|
attr_accessor :data
|
|
16
16
|
|
|
17
17
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -29,7 +29,7 @@ module YNAB
|
|
|
29
29
|
# Attribute type mapping.
|
|
30
30
|
def self.openapi_types
|
|
31
31
|
{
|
|
32
|
-
:'data' => :'
|
|
32
|
+
:'data' => :'MoneyMovementsResponseData'
|
|
33
33
|
}
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -43,13 +43,13 @@ module YNAB
|
|
|
43
43
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
44
44
|
def initialize(attributes = {})
|
|
45
45
|
if (!attributes.is_a?(Hash))
|
|
46
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::
|
|
46
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MoneyMovementsResponse` initialize method"
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
50
50
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
51
51
|
if (!self.class.attribute_map.key?(k.to_sym))
|
|
52
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::
|
|
52
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::MoneyMovementsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
53
53
|
end
|
|
54
54
|
h[k.to_sym] = v
|
|
55
55
|
}
|
|
@@ -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,8 +11,8 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
class
|
|
15
|
-
attr_accessor :
|
|
14
|
+
class MoneyMovementsResponseData < ApiModelBase
|
|
15
|
+
attr_accessor :money_movements
|
|
16
16
|
|
|
17
17
|
# The knowledge of the server
|
|
18
18
|
attr_accessor :server_knowledge
|
|
@@ -20,7 +20,7 @@ module YNAB
|
|
|
20
20
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
21
|
def self.attribute_map
|
|
22
22
|
{
|
|
23
|
-
:'
|
|
23
|
+
:'money_movements' => :'money_movements',
|
|
24
24
|
:'server_knowledge' => :'server_knowledge'
|
|
25
25
|
}
|
|
26
26
|
end
|
|
@@ -33,7 +33,7 @@ module YNAB
|
|
|
33
33
|
# Attribute type mapping.
|
|
34
34
|
def self.openapi_types
|
|
35
35
|
{
|
|
36
|
-
:'
|
|
36
|
+
:'money_movements' => :'Array<MoneyMovement>',
|
|
37
37
|
:'server_knowledge' => :'Integer'
|
|
38
38
|
}
|
|
39
39
|
end
|
|
@@ -48,19 +48,21 @@ module YNAB
|
|
|
48
48
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
49
49
|
def initialize(attributes = {})
|
|
50
50
|
if (!attributes.is_a?(Hash))
|
|
51
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::
|
|
51
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MoneyMovementsResponseData` initialize method"
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
55
55
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
56
56
|
if (!self.class.attribute_map.key?(k.to_sym))
|
|
57
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::
|
|
57
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::MoneyMovementsResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
58
58
|
end
|
|
59
59
|
h[k.to_sym] = v
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
if attributes.key?(:'
|
|
63
|
-
|
|
62
|
+
if attributes.key?(:'money_movements')
|
|
63
|
+
if (value = attributes[:'money_movements']).is_a?(Array)
|
|
64
|
+
self.money_movements = value
|
|
65
|
+
end
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
if attributes.key?(:'server_knowledge')
|
|
@@ -78,7 +80,7 @@ module YNAB
|
|
|
78
80
|
# Check to see if the all the properties in the model are valid
|
|
79
81
|
# @return true if the model is valid
|
|
80
82
|
def valid?
|
|
81
|
-
return false if @
|
|
83
|
+
return false if @money_movements.nil?
|
|
82
84
|
return false if @server_knowledge.nil?
|
|
83
85
|
true
|
|
84
86
|
end
|
|
@@ -88,7 +90,7 @@ module YNAB
|
|
|
88
90
|
def ==(o)
|
|
89
91
|
return true if self.equal?(o)
|
|
90
92
|
self.class == o.class &&
|
|
91
|
-
|
|
93
|
+
money_movements == o.money_movements &&
|
|
92
94
|
server_knowledge == o.server_knowledge
|
|
93
95
|
end
|
|
94
96
|
|
|
@@ -101,7 +103,7 @@ module YNAB
|
|
|
101
103
|
# Calculates hash code according to all attributes.
|
|
102
104
|
# @return [Integer] Hash code
|
|
103
105
|
def hash
|
|
104
|
-
[
|
|
106
|
+
[money_movements, server_knowledge].hash
|
|
105
107
|
end
|
|
106
108
|
|
|
107
109
|
# Builds the object from hash
|
|
@@ -127,61 +129,6 @@ module YNAB
|
|
|
127
129
|
new(transformed_hash)
|
|
128
130
|
end
|
|
129
131
|
|
|
130
|
-
# Deserializes the data based on type
|
|
131
|
-
# @param string type Data type
|
|
132
|
-
# @param string value Value to be deserialized
|
|
133
|
-
# @return [Object] Deserialized data
|
|
134
|
-
def self._deserialize(type, value)
|
|
135
|
-
case type.to_sym
|
|
136
|
-
when :Time
|
|
137
|
-
Time.parse(value)
|
|
138
|
-
when :Date
|
|
139
|
-
Date.parse(value)
|
|
140
|
-
when :String
|
|
141
|
-
value.to_s
|
|
142
|
-
when :Integer
|
|
143
|
-
value.to_i
|
|
144
|
-
when :Float
|
|
145
|
-
value.to_f
|
|
146
|
-
when :Boolean
|
|
147
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
148
|
-
true
|
|
149
|
-
else
|
|
150
|
-
false
|
|
151
|
-
end
|
|
152
|
-
when :Object
|
|
153
|
-
# generic object (usually a Hash), return directly
|
|
154
|
-
value
|
|
155
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
156
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
157
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
158
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
159
|
-
k_type = Regexp.last_match[:k_type]
|
|
160
|
-
v_type = Regexp.last_match[:v_type]
|
|
161
|
-
{}.tap do |hash|
|
|
162
|
-
value.each do |k, v|
|
|
163
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
164
|
-
end
|
|
165
|
-
end
|
|
166
|
-
else # model
|
|
167
|
-
# models (e.g. Pet) or oneOf
|
|
168
|
-
klass = YNAB.const_get(type)
|
|
169
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
# Returns the string representation of the object
|
|
174
|
-
# @return [String] String presentation of the object
|
|
175
|
-
def to_s
|
|
176
|
-
to_hash.to_s
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
180
|
-
# @return [Hash] Returns the object in the form of hash
|
|
181
|
-
def to_body
|
|
182
|
-
to_hash
|
|
183
|
-
end
|
|
184
|
-
|
|
185
132
|
# Returns the object in the form of hash
|
|
186
133
|
# @return [Hash] Returns the object in the form of hash
|
|
187
134
|
def to_hash
|
|
@@ -197,25 +144,6 @@ module YNAB
|
|
|
197
144
|
end
|
|
198
145
|
hash
|
|
199
146
|
end
|
|
200
|
-
|
|
201
|
-
# Outputs non-array value in the form of hash
|
|
202
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
203
|
-
# @param [Object] value Any valid value
|
|
204
|
-
# @return [Hash] Returns the value in the form of hash
|
|
205
|
-
def _to_hash(value)
|
|
206
|
-
if value.is_a?(Array)
|
|
207
|
-
value.compact.map { |v| _to_hash(v) }
|
|
208
|
-
elsif value.is_a?(Hash)
|
|
209
|
-
{}.tap do |hash|
|
|
210
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
211
|
-
end
|
|
212
|
-
elsif value.respond_to? :to_hash
|
|
213
|
-
value.to_hash
|
|
214
|
-
else
|
|
215
|
-
value
|
|
216
|
-
end
|
|
217
|
-
end
|
|
218
|
-
|
|
219
147
|
end
|
|
220
148
|
|
|
221
149
|
end
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module YNAB
|
|
14
|
-
class MonthDetail
|
|
14
|
+
class MonthDetail < ApiModelBase
|
|
15
15
|
attr_accessor :month
|
|
16
16
|
|
|
17
17
|
attr_accessor :note
|
|
@@ -19,7 +19,7 @@ module YNAB
|
|
|
19
19
|
# The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month
|
|
20
20
|
attr_accessor :income
|
|
21
21
|
|
|
22
|
-
# The total amount budgeted in the month
|
|
22
|
+
# The total amount assigned (budgeted) in the month
|
|
23
23
|
attr_accessor :budgeted
|
|
24
24
|
|
|
25
25
|
# The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign'
|
|
@@ -34,7 +34,7 @@ module YNAB
|
|
|
34
34
|
# Whether or not the month has been deleted. Deleted months will only be included in delta requests.
|
|
35
35
|
attr_accessor :deleted
|
|
36
36
|
|
|
37
|
-
# The
|
|
37
|
+
# The plan month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified.
|
|
38
38
|
attr_accessor :categories
|
|
39
39
|
|
|
40
40
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -75,8 +75,6 @@ module YNAB
|
|
|
75
75
|
# List of attributes with nullable: true
|
|
76
76
|
def self.openapi_nullable
|
|
77
77
|
Set.new([
|
|
78
|
-
:'note',
|
|
79
|
-
:'age_of_money',
|
|
80
78
|
])
|
|
81
79
|
end
|
|
82
80
|
|
|
@@ -212,61 +210,6 @@ module YNAB
|
|
|
212
210
|
new(transformed_hash)
|
|
213
211
|
end
|
|
214
212
|
|
|
215
|
-
# Deserializes the data based on type
|
|
216
|
-
# @param string type Data type
|
|
217
|
-
# @param string value Value to be deserialized
|
|
218
|
-
# @return [Object] Deserialized data
|
|
219
|
-
def self._deserialize(type, value)
|
|
220
|
-
case type.to_sym
|
|
221
|
-
when :Time
|
|
222
|
-
Time.parse(value)
|
|
223
|
-
when :Date
|
|
224
|
-
Date.parse(value)
|
|
225
|
-
when :String
|
|
226
|
-
value.to_s
|
|
227
|
-
when :Integer
|
|
228
|
-
value.to_i
|
|
229
|
-
when :Float
|
|
230
|
-
value.to_f
|
|
231
|
-
when :Boolean
|
|
232
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
233
|
-
true
|
|
234
|
-
else
|
|
235
|
-
false
|
|
236
|
-
end
|
|
237
|
-
when :Object
|
|
238
|
-
# generic object (usually a Hash), return directly
|
|
239
|
-
value
|
|
240
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
241
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
242
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
243
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
244
|
-
k_type = Regexp.last_match[:k_type]
|
|
245
|
-
v_type = Regexp.last_match[:v_type]
|
|
246
|
-
{}.tap do |hash|
|
|
247
|
-
value.each do |k, v|
|
|
248
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
249
|
-
end
|
|
250
|
-
end
|
|
251
|
-
else # model
|
|
252
|
-
# models (e.g. Pet) or oneOf
|
|
253
|
-
klass = YNAB.const_get(type)
|
|
254
|
-
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
255
|
-
end
|
|
256
|
-
end
|
|
257
|
-
|
|
258
|
-
# Returns the string representation of the object
|
|
259
|
-
# @return [String] String presentation of the object
|
|
260
|
-
def to_s
|
|
261
|
-
to_hash.to_s
|
|
262
|
-
end
|
|
263
|
-
|
|
264
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
265
|
-
# @return [Hash] Returns the object in the form of hash
|
|
266
|
-
def to_body
|
|
267
|
-
to_hash
|
|
268
|
-
end
|
|
269
|
-
|
|
270
213
|
# Returns the object in the form of hash
|
|
271
214
|
# @return [Hash] Returns the object in the form of hash
|
|
272
215
|
def to_hash
|
|
@@ -282,25 +225,6 @@ module YNAB
|
|
|
282
225
|
end
|
|
283
226
|
hash
|
|
284
227
|
end
|
|
285
|
-
|
|
286
|
-
# Outputs non-array value in the form of hash
|
|
287
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
288
|
-
# @param [Object] value Any valid value
|
|
289
|
-
# @return [Hash] Returns the value in the form of hash
|
|
290
|
-
def _to_hash(value)
|
|
291
|
-
if value.is_a?(Array)
|
|
292
|
-
value.compact.map { |v| _to_hash(v) }
|
|
293
|
-
elsif value.is_a?(Hash)
|
|
294
|
-
{}.tap do |hash|
|
|
295
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
296
|
-
end
|
|
297
|
-
elsif value.respond_to? :to_hash
|
|
298
|
-
value.to_hash
|
|
299
|
-
else
|
|
300
|
-
value
|
|
301
|
-
end
|
|
302
|
-
end
|
|
303
|
-
|
|
304
228
|
end
|
|
305
229
|
|
|
306
230
|
end
|