ynab 5.0.0 → 5.1.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.lock +1 -1
- data/docs/Account.md +6 -0
- data/docs/AccountBase.md +25 -0
- data/docs/Category.md +14 -0
- data/docs/CategoryBase.md +33 -0
- data/docs/ExistingCategory.md +2 -1
- data/docs/HybridTransaction.md +2 -0
- data/docs/MoneyMovement.md +2 -0
- data/docs/MoneyMovementBase.md +16 -0
- data/docs/MonthDetail.md +8 -0
- data/docs/MonthDetailBase.md +16 -0
- data/docs/MonthSummary.md +8 -0
- data/docs/MonthSummaryBase.md +15 -0
- data/docs/NewCategory.md +2 -1
- data/docs/PayeesApi.md +21 -0
- data/docs/PlanDetail.md +7 -7
- data/docs/PostPayee.md +8 -0
- data/docs/PostPayeeWrapper.md +8 -0
- data/docs/SaveAccount.md +1 -1
- data/docs/SaveAccountType.md +7 -0
- data/docs/SaveCategory.md +2 -1
- data/docs/SavePayee.md +1 -1
- data/docs/ScheduledSubTransaction.md +2 -0
- data/docs/ScheduledSubTransactionBase.md +17 -0
- data/docs/ScheduledTransactionDetail.md +2 -0
- data/docs/ScheduledTransactionSummary.md +2 -0
- data/docs/ScheduledTransactionSummaryBase.md +20 -0
- data/docs/SubTransaction.md +2 -0
- data/docs/SubTransactionBase.md +18 -0
- data/docs/TransactionDetail.md +2 -0
- data/docs/TransactionSummary.md +2 -0
- data/docs/TransactionSummaryBase.md +26 -0
- data/lib/ynab/api/payees_api.rb +74 -0
- data/lib/ynab/models/account.rb +72 -8
- data/lib/ynab/models/account_base.rb +340 -0
- data/lib/ynab/models/category.rb +159 -20
- data/lib/ynab/models/category_base.rb +436 -0
- data/lib/ynab/models/existing_category.rb +15 -5
- data/lib/ynab/models/hybrid_transaction.rb +21 -1
- data/lib/ynab/models/money_movement.rb +31 -11
- data/lib/ynab/models/money_movement_base.rb +223 -0
- data/lib/ynab/models/month_detail.rb +81 -1
- data/lib/ynab/models/month_detail_base.rb +230 -0
- data/lib/ynab/models/month_summary.rb +91 -6
- data/lib/ynab/models/month_summary_base.rb +212 -0
- data/lib/ynab/models/new_category.rb +15 -5
- data/lib/ynab/models/plan_detail.rb +7 -7
- data/lib/ynab/models/post_payee.rb +148 -0
- data/lib/ynab/models/post_payee_wrapper.rb +136 -0
- data/lib/ynab/models/save_account.rb +1 -1
- data/lib/ynab/models/save_account_type.rb +45 -0
- data/lib/ynab/models/save_category.rb +17 -6
- data/lib/ynab/models/save_payee.rb +1 -1
- data/lib/ynab/models/scheduled_sub_transaction.rb +31 -10
- data/lib/ynab/models/scheduled_sub_transaction_base.rb +229 -0
- data/lib/ynab/models/scheduled_transaction_detail.rb +21 -1
- data/lib/ynab/models/scheduled_transaction_summary.rb +31 -9
- data/lib/ynab/models/scheduled_transaction_summary_base.rb +292 -0
- data/lib/ynab/models/sub_transaction.rb +31 -11
- data/lib/ynab/models/sub_transaction_base.rb +240 -0
- data/lib/ynab/models/transaction_detail.rb +21 -1
- data/lib/ynab/models/transaction_summary.rb +31 -14
- data/lib/ynab/models/transaction_summary_base.rb +358 -0
- data/lib/ynab/version.rb +1 -1
- data/lib/ynab.rb +12 -0
- data/open_api_spec.yaml +295 -21
- data/ynab.gemspec +1 -1
- metadata +27 -3
data/lib/ynab/models/category.rb
CHANGED
|
@@ -85,6 +85,48 @@ module YNAB
|
|
|
85
85
|
# Whether or not the category has been deleted. Deleted categories will only be included in delta requests.
|
|
86
86
|
attr_accessor :deleted
|
|
87
87
|
|
|
88
|
+
# Available balance of the category formatted in the plan's currency format
|
|
89
|
+
attr_accessor :balance_formatted
|
|
90
|
+
|
|
91
|
+
# Available balance of the category as a decimal currency amount
|
|
92
|
+
attr_accessor :balance_currency
|
|
93
|
+
|
|
94
|
+
# Activity of the category formatted in the plan's currency format
|
|
95
|
+
attr_accessor :activity_formatted
|
|
96
|
+
|
|
97
|
+
# Activity of the category as a decimal currency amount
|
|
98
|
+
attr_accessor :activity_currency
|
|
99
|
+
|
|
100
|
+
# Assigned (budgeted) amount of the category formatted in the plan's currency format
|
|
101
|
+
attr_accessor :budgeted_formatted
|
|
102
|
+
|
|
103
|
+
# Assigned (budgeted) amount of the category as a decimal currency amount
|
|
104
|
+
attr_accessor :budgeted_currency
|
|
105
|
+
|
|
106
|
+
# The goal target amount formatted in the plan's currency format
|
|
107
|
+
attr_accessor :goal_target_formatted
|
|
108
|
+
|
|
109
|
+
# The goal target amount as a decimal currency amount
|
|
110
|
+
attr_accessor :goal_target_currency
|
|
111
|
+
|
|
112
|
+
# The goal underfunded amount formatted in the plan's currency format
|
|
113
|
+
attr_accessor :goal_under_funded_formatted
|
|
114
|
+
|
|
115
|
+
# The goal underfunded amount as a decimal currency amount
|
|
116
|
+
attr_accessor :goal_under_funded_currency
|
|
117
|
+
|
|
118
|
+
# The total amount funded towards the goal formatted in the plan's currency format
|
|
119
|
+
attr_accessor :goal_overall_funded_formatted
|
|
120
|
+
|
|
121
|
+
# The total amount funded towards the goal as a decimal currency amount
|
|
122
|
+
attr_accessor :goal_overall_funded_currency
|
|
123
|
+
|
|
124
|
+
# The amount of funding still needed to complete the goal formatted in the plan's currency format
|
|
125
|
+
attr_accessor :goal_overall_left_formatted
|
|
126
|
+
|
|
127
|
+
# The amount of funding still needed to complete the goal as a decimal currency amount
|
|
128
|
+
attr_accessor :goal_overall_left_currency
|
|
129
|
+
|
|
88
130
|
class EnumAttributeValidator
|
|
89
131
|
attr_reader :datatype
|
|
90
132
|
attr_reader :allowable_values
|
|
@@ -135,7 +177,21 @@ module YNAB
|
|
|
135
177
|
:'goal_overall_funded' => :'goal_overall_funded',
|
|
136
178
|
:'goal_overall_left' => :'goal_overall_left',
|
|
137
179
|
:'goal_snoozed_at' => :'goal_snoozed_at',
|
|
138
|
-
:'deleted' => :'deleted'
|
|
180
|
+
:'deleted' => :'deleted',
|
|
181
|
+
:'balance_formatted' => :'balance_formatted',
|
|
182
|
+
:'balance_currency' => :'balance_currency',
|
|
183
|
+
:'activity_formatted' => :'activity_formatted',
|
|
184
|
+
:'activity_currency' => :'activity_currency',
|
|
185
|
+
:'budgeted_formatted' => :'budgeted_formatted',
|
|
186
|
+
:'budgeted_currency' => :'budgeted_currency',
|
|
187
|
+
:'goal_target_formatted' => :'goal_target_formatted',
|
|
188
|
+
:'goal_target_currency' => :'goal_target_currency',
|
|
189
|
+
:'goal_under_funded_formatted' => :'goal_under_funded_formatted',
|
|
190
|
+
:'goal_under_funded_currency' => :'goal_under_funded_currency',
|
|
191
|
+
:'goal_overall_funded_formatted' => :'goal_overall_funded_formatted',
|
|
192
|
+
:'goal_overall_funded_currency' => :'goal_overall_funded_currency',
|
|
193
|
+
:'goal_overall_left_formatted' => :'goal_overall_left_formatted',
|
|
194
|
+
:'goal_overall_left_currency' => :'goal_overall_left_currency'
|
|
139
195
|
}
|
|
140
196
|
end
|
|
141
197
|
|
|
@@ -172,33 +228,46 @@ module YNAB
|
|
|
172
228
|
:'goal_overall_funded' => :'Integer',
|
|
173
229
|
:'goal_overall_left' => :'Integer',
|
|
174
230
|
:'goal_snoozed_at' => :'Time',
|
|
175
|
-
:'deleted' => :'Boolean'
|
|
231
|
+
:'deleted' => :'Boolean',
|
|
232
|
+
:'balance_formatted' => :'String',
|
|
233
|
+
:'balance_currency' => :'Float',
|
|
234
|
+
:'activity_formatted' => :'String',
|
|
235
|
+
:'activity_currency' => :'Float',
|
|
236
|
+
:'budgeted_formatted' => :'String',
|
|
237
|
+
:'budgeted_currency' => :'Float',
|
|
238
|
+
:'goal_target_formatted' => :'String',
|
|
239
|
+
:'goal_target_currency' => :'Float',
|
|
240
|
+
:'goal_under_funded_formatted' => :'String',
|
|
241
|
+
:'goal_under_funded_currency' => :'Float',
|
|
242
|
+
:'goal_overall_funded_formatted' => :'String',
|
|
243
|
+
:'goal_overall_funded_currency' => :'Float',
|
|
244
|
+
:'goal_overall_left_formatted' => :'String',
|
|
245
|
+
:'goal_overall_left_currency' => :'Float'
|
|
176
246
|
}
|
|
177
247
|
end
|
|
178
248
|
|
|
179
249
|
# List of attributes with nullable: true
|
|
180
250
|
def self.openapi_nullable
|
|
181
251
|
Set.new([
|
|
182
|
-
:'original_category_group_id',
|
|
183
|
-
:'note',
|
|
184
252
|
:'goal_type',
|
|
185
|
-
:'
|
|
186
|
-
:'
|
|
187
|
-
:'
|
|
188
|
-
:'
|
|
189
|
-
:'
|
|
190
|
-
:'
|
|
191
|
-
:'
|
|
192
|
-
:'
|
|
193
|
-
:'goal_percentage_complete',
|
|
194
|
-
:'goal_months_to_budget',
|
|
195
|
-
:'goal_under_funded',
|
|
196
|
-
:'goal_overall_funded',
|
|
197
|
-
:'goal_overall_left',
|
|
198
|
-
:'goal_snoozed_at',
|
|
253
|
+
:'goal_target_formatted',
|
|
254
|
+
:'goal_target_currency',
|
|
255
|
+
:'goal_under_funded_formatted',
|
|
256
|
+
:'goal_under_funded_currency',
|
|
257
|
+
:'goal_overall_funded_formatted',
|
|
258
|
+
:'goal_overall_funded_currency',
|
|
259
|
+
:'goal_overall_left_formatted',
|
|
260
|
+
:'goal_overall_left_currency'
|
|
199
261
|
])
|
|
200
262
|
end
|
|
201
263
|
|
|
264
|
+
# List of class defined in allOf (OpenAPI v3)
|
|
265
|
+
def self.openapi_all_of
|
|
266
|
+
[
|
|
267
|
+
:'CategoryBase'
|
|
268
|
+
]
|
|
269
|
+
end
|
|
270
|
+
|
|
202
271
|
# Initializes the object
|
|
203
272
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
204
273
|
def initialize(attributes = {})
|
|
@@ -317,6 +386,62 @@ module YNAB
|
|
|
317
386
|
if attributes.key?(:'deleted')
|
|
318
387
|
self.deleted = attributes[:'deleted']
|
|
319
388
|
end
|
|
389
|
+
|
|
390
|
+
if attributes.key?(:'balance_formatted')
|
|
391
|
+
self.balance_formatted = attributes[:'balance_formatted']
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
if attributes.key?(:'balance_currency')
|
|
395
|
+
self.balance_currency = attributes[:'balance_currency']
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
if attributes.key?(:'activity_formatted')
|
|
399
|
+
self.activity_formatted = attributes[:'activity_formatted']
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
if attributes.key?(:'activity_currency')
|
|
403
|
+
self.activity_currency = attributes[:'activity_currency']
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
if attributes.key?(:'budgeted_formatted')
|
|
407
|
+
self.budgeted_formatted = attributes[:'budgeted_formatted']
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
if attributes.key?(:'budgeted_currency')
|
|
411
|
+
self.budgeted_currency = attributes[:'budgeted_currency']
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
if attributes.key?(:'goal_target_formatted')
|
|
415
|
+
self.goal_target_formatted = attributes[:'goal_target_formatted']
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
if attributes.key?(:'goal_target_currency')
|
|
419
|
+
self.goal_target_currency = attributes[:'goal_target_currency']
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
if attributes.key?(:'goal_under_funded_formatted')
|
|
423
|
+
self.goal_under_funded_formatted = attributes[:'goal_under_funded_formatted']
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
if attributes.key?(:'goal_under_funded_currency')
|
|
427
|
+
self.goal_under_funded_currency = attributes[:'goal_under_funded_currency']
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
if attributes.key?(:'goal_overall_funded_formatted')
|
|
431
|
+
self.goal_overall_funded_formatted = attributes[:'goal_overall_funded_formatted']
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
if attributes.key?(:'goal_overall_funded_currency')
|
|
435
|
+
self.goal_overall_funded_currency = attributes[:'goal_overall_funded_currency']
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
if attributes.key?(:'goal_overall_left_formatted')
|
|
439
|
+
self.goal_overall_left_formatted = attributes[:'goal_overall_left_formatted']
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
if attributes.key?(:'goal_overall_left_currency')
|
|
443
|
+
self.goal_overall_left_currency = attributes[:'goal_overall_left_currency']
|
|
444
|
+
end
|
|
320
445
|
end
|
|
321
446
|
|
|
322
447
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -378,7 +503,21 @@ module YNAB
|
|
|
378
503
|
goal_overall_funded == o.goal_overall_funded &&
|
|
379
504
|
goal_overall_left == o.goal_overall_left &&
|
|
380
505
|
goal_snoozed_at == o.goal_snoozed_at &&
|
|
381
|
-
deleted == o.deleted
|
|
506
|
+
deleted == o.deleted &&
|
|
507
|
+
balance_formatted == o.balance_formatted &&
|
|
508
|
+
balance_currency == o.balance_currency &&
|
|
509
|
+
activity_formatted == o.activity_formatted &&
|
|
510
|
+
activity_currency == o.activity_currency &&
|
|
511
|
+
budgeted_formatted == o.budgeted_formatted &&
|
|
512
|
+
budgeted_currency == o.budgeted_currency &&
|
|
513
|
+
goal_target_formatted == o.goal_target_formatted &&
|
|
514
|
+
goal_target_currency == o.goal_target_currency &&
|
|
515
|
+
goal_under_funded_formatted == o.goal_under_funded_formatted &&
|
|
516
|
+
goal_under_funded_currency == o.goal_under_funded_currency &&
|
|
517
|
+
goal_overall_funded_formatted == o.goal_overall_funded_formatted &&
|
|
518
|
+
goal_overall_funded_currency == o.goal_overall_funded_currency &&
|
|
519
|
+
goal_overall_left_formatted == o.goal_overall_left_formatted &&
|
|
520
|
+
goal_overall_left_currency == o.goal_overall_left_currency
|
|
382
521
|
end
|
|
383
522
|
|
|
384
523
|
# @see the `==` method
|
|
@@ -390,7 +529,7 @@ module YNAB
|
|
|
390
529
|
# Calculates hash code according to all attributes.
|
|
391
530
|
# @return [Integer] Hash code
|
|
392
531
|
def hash
|
|
393
|
-
[id, category_group_id, category_group_name, name, hidden, original_category_group_id, note, budgeted, activity, balance, goal_type, goal_needs_whole_amount, goal_day, goal_cadence, goal_cadence_frequency, goal_creation_month, goal_target, goal_target_month, goal_target_date, goal_percentage_complete, goal_months_to_budget, goal_under_funded, goal_overall_funded, goal_overall_left, goal_snoozed_at, deleted].hash
|
|
532
|
+
[id, category_group_id, category_group_name, name, hidden, original_category_group_id, note, budgeted, activity, balance, goal_type, goal_needs_whole_amount, goal_day, goal_cadence, goal_cadence_frequency, goal_creation_month, goal_target, goal_target_month, goal_target_date, goal_percentage_complete, goal_months_to_budget, goal_under_funded, goal_overall_funded, goal_overall_left, goal_snoozed_at, deleted, balance_formatted, balance_currency, activity_formatted, activity_currency, budgeted_formatted, budgeted_currency, goal_target_formatted, goal_target_currency, goal_under_funded_formatted, goal_under_funded_currency, goal_overall_funded_formatted, goal_overall_funded_currency, goal_overall_left_formatted, goal_overall_left_currency].hash
|
|
394
533
|
end
|
|
395
534
|
|
|
396
535
|
# Builds the object from hash
|
|
@@ -0,0 +1,436 @@
|
|
|
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 CategoryBase < ApiModelBase
|
|
15
|
+
attr_accessor :id
|
|
16
|
+
|
|
17
|
+
attr_accessor :category_group_id
|
|
18
|
+
|
|
19
|
+
attr_accessor :category_group_name
|
|
20
|
+
|
|
21
|
+
attr_accessor :name
|
|
22
|
+
|
|
23
|
+
# Whether or not the category is hidden
|
|
24
|
+
attr_accessor :hidden
|
|
25
|
+
|
|
26
|
+
# DEPRECATED: No longer used. Value will always be null.
|
|
27
|
+
attr_accessor :original_category_group_id
|
|
28
|
+
|
|
29
|
+
attr_accessor :note
|
|
30
|
+
|
|
31
|
+
# Assigned (budgeted) amount in milliunits format
|
|
32
|
+
attr_accessor :budgeted
|
|
33
|
+
|
|
34
|
+
# Activity amount in milliunits format
|
|
35
|
+
attr_accessor :activity
|
|
36
|
+
|
|
37
|
+
# Available balance in milliunits format
|
|
38
|
+
attr_accessor :balance
|
|
39
|
+
|
|
40
|
+
# The type of goal, if the category has a goal (TB='Target Category Balance', TBD='Target Category Balance by Date', MF='Monthly Funding', NEED='Plan Your Spending')
|
|
41
|
+
attr_accessor :goal_type
|
|
42
|
+
|
|
43
|
+
# Indicates the monthly rollover behavior for \"NEED\"-type goals. When \"true\", the goal will always ask for the target amount in the new month (\"Set Aside\"). When \"false\", previous month category funding is used (\"Refill\"). For other goal types, this field will be null.
|
|
44
|
+
attr_accessor :goal_needs_whole_amount
|
|
45
|
+
|
|
46
|
+
# A day offset modifier for the goal's due date. When goal_cadence is 2 (Weekly), this value specifies which day of the week the goal is due (0 = Sunday, 6 = Saturday). Otherwise, this value specifies which day of the month the goal is due (1 = 1st, 31 = 31st, null = Last day of Month).
|
|
47
|
+
attr_accessor :goal_day
|
|
48
|
+
|
|
49
|
+
# The goal cadence. Value in range 0-14. There are two subsets of these values which behave differently. For values 0, 1, 2, and 13, the goal's due date repeats every goal_cadence * goal_cadence_frequency, where 0 = None, 1 = Monthly, 2 = Weekly, and 13 = Yearly. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. For values 3-12 and 14, goal_cadence_frequency is ignored and the goal's due date repeats every goal_cadence, where 3 = Every 2 Months, 4 = Every 3 Months, ..., 12 = Every 11 Months, and 14 = Every 2 Years.
|
|
50
|
+
attr_accessor :goal_cadence
|
|
51
|
+
|
|
52
|
+
# The goal cadence frequency. When goal_cadence is 0, 1, 2, or 13, a goal's due date repeats every goal_cadence * goal_cadence_frequency. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. When goal_cadence is 3-12 or 14, goal_cadence_frequency is ignored.
|
|
53
|
+
attr_accessor :goal_cadence_frequency
|
|
54
|
+
|
|
55
|
+
# The month a goal was created
|
|
56
|
+
attr_accessor :goal_creation_month
|
|
57
|
+
|
|
58
|
+
# The goal target amount in milliunits
|
|
59
|
+
attr_accessor :goal_target
|
|
60
|
+
|
|
61
|
+
# DEPRECATED: No longer used. Use `goal_target_date` instead.
|
|
62
|
+
attr_accessor :goal_target_month
|
|
63
|
+
|
|
64
|
+
# The target date for the goal to be completed. Only some goal types specify this date.
|
|
65
|
+
attr_accessor :goal_target_date
|
|
66
|
+
|
|
67
|
+
# The percentage completion of the goal
|
|
68
|
+
attr_accessor :goal_percentage_complete
|
|
69
|
+
|
|
70
|
+
# The number of months, including the current month, left in the current goal period.
|
|
71
|
+
attr_accessor :goal_months_to_budget
|
|
72
|
+
|
|
73
|
+
# The amount of funding still needed in the current month to stay on track towards completing the goal within the current goal period. This amount will generally correspond to the 'Underfunded' amount in the web and mobile clients except when viewing a category with a Needed for Spending Goal in a future month. The web and mobile clients will ignore any funding from a prior goal period when viewing category with a Needed for Spending Goal in a future month.
|
|
74
|
+
attr_accessor :goal_under_funded
|
|
75
|
+
|
|
76
|
+
# The total amount funded towards the goal within the current goal period.
|
|
77
|
+
attr_accessor :goal_overall_funded
|
|
78
|
+
|
|
79
|
+
# The amount of funding still needed to complete the goal within the current goal period.
|
|
80
|
+
attr_accessor :goal_overall_left
|
|
81
|
+
|
|
82
|
+
# The date/time the goal was snoozed. If the goal is not snoozed, this will be null.
|
|
83
|
+
attr_accessor :goal_snoozed_at
|
|
84
|
+
|
|
85
|
+
# Whether or not the category has been deleted. Deleted categories will only be included in delta requests.
|
|
86
|
+
attr_accessor :deleted
|
|
87
|
+
|
|
88
|
+
class EnumAttributeValidator
|
|
89
|
+
attr_reader :datatype
|
|
90
|
+
attr_reader :allowable_values
|
|
91
|
+
|
|
92
|
+
def initialize(datatype, allowable_values)
|
|
93
|
+
@allowable_values = allowable_values.map do |value|
|
|
94
|
+
case datatype.to_s
|
|
95
|
+
when /Integer/i
|
|
96
|
+
value.to_i
|
|
97
|
+
when /Float/i
|
|
98
|
+
value.to_f
|
|
99
|
+
else
|
|
100
|
+
value
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def valid?(value)
|
|
106
|
+
!value || allowable_values.include?(value)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
111
|
+
def self.attribute_map
|
|
112
|
+
{
|
|
113
|
+
:'id' => :'id',
|
|
114
|
+
:'category_group_id' => :'category_group_id',
|
|
115
|
+
:'category_group_name' => :'category_group_name',
|
|
116
|
+
:'name' => :'name',
|
|
117
|
+
:'hidden' => :'hidden',
|
|
118
|
+
:'original_category_group_id' => :'original_category_group_id',
|
|
119
|
+
:'note' => :'note',
|
|
120
|
+
:'budgeted' => :'budgeted',
|
|
121
|
+
:'activity' => :'activity',
|
|
122
|
+
:'balance' => :'balance',
|
|
123
|
+
:'goal_type' => :'goal_type',
|
|
124
|
+
:'goal_needs_whole_amount' => :'goal_needs_whole_amount',
|
|
125
|
+
:'goal_day' => :'goal_day',
|
|
126
|
+
:'goal_cadence' => :'goal_cadence',
|
|
127
|
+
:'goal_cadence_frequency' => :'goal_cadence_frequency',
|
|
128
|
+
:'goal_creation_month' => :'goal_creation_month',
|
|
129
|
+
:'goal_target' => :'goal_target',
|
|
130
|
+
:'goal_target_month' => :'goal_target_month',
|
|
131
|
+
:'goal_target_date' => :'goal_target_date',
|
|
132
|
+
:'goal_percentage_complete' => :'goal_percentage_complete',
|
|
133
|
+
:'goal_months_to_budget' => :'goal_months_to_budget',
|
|
134
|
+
:'goal_under_funded' => :'goal_under_funded',
|
|
135
|
+
:'goal_overall_funded' => :'goal_overall_funded',
|
|
136
|
+
:'goal_overall_left' => :'goal_overall_left',
|
|
137
|
+
:'goal_snoozed_at' => :'goal_snoozed_at',
|
|
138
|
+
:'deleted' => :'deleted'
|
|
139
|
+
}
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Returns all the JSON keys this model knows about
|
|
143
|
+
def self.acceptable_attributes
|
|
144
|
+
attribute_map.values
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Attribute type mapping.
|
|
148
|
+
def self.openapi_types
|
|
149
|
+
{
|
|
150
|
+
:'id' => :'String',
|
|
151
|
+
:'category_group_id' => :'String',
|
|
152
|
+
:'category_group_name' => :'String',
|
|
153
|
+
:'name' => :'String',
|
|
154
|
+
:'hidden' => :'Boolean',
|
|
155
|
+
:'original_category_group_id' => :'String',
|
|
156
|
+
:'note' => :'String',
|
|
157
|
+
:'budgeted' => :'Integer',
|
|
158
|
+
:'activity' => :'Integer',
|
|
159
|
+
:'balance' => :'Integer',
|
|
160
|
+
:'goal_type' => :'String',
|
|
161
|
+
:'goal_needs_whole_amount' => :'Boolean',
|
|
162
|
+
:'goal_day' => :'Integer',
|
|
163
|
+
:'goal_cadence' => :'Integer',
|
|
164
|
+
:'goal_cadence_frequency' => :'Integer',
|
|
165
|
+
:'goal_creation_month' => :'Date',
|
|
166
|
+
:'goal_target' => :'Integer',
|
|
167
|
+
:'goal_target_month' => :'Date',
|
|
168
|
+
:'goal_target_date' => :'Date',
|
|
169
|
+
:'goal_percentage_complete' => :'Integer',
|
|
170
|
+
:'goal_months_to_budget' => :'Integer',
|
|
171
|
+
:'goal_under_funded' => :'Integer',
|
|
172
|
+
:'goal_overall_funded' => :'Integer',
|
|
173
|
+
:'goal_overall_left' => :'Integer',
|
|
174
|
+
:'goal_snoozed_at' => :'Time',
|
|
175
|
+
:'deleted' => :'Boolean'
|
|
176
|
+
}
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# List of attributes with nullable: true
|
|
180
|
+
def self.openapi_nullable
|
|
181
|
+
Set.new([
|
|
182
|
+
:'original_category_group_id',
|
|
183
|
+
:'note',
|
|
184
|
+
:'goal_type',
|
|
185
|
+
:'goal_needs_whole_amount',
|
|
186
|
+
:'goal_day',
|
|
187
|
+
:'goal_cadence',
|
|
188
|
+
:'goal_cadence_frequency',
|
|
189
|
+
:'goal_creation_month',
|
|
190
|
+
:'goal_target',
|
|
191
|
+
:'goal_target_month',
|
|
192
|
+
:'goal_target_date',
|
|
193
|
+
:'goal_percentage_complete',
|
|
194
|
+
:'goal_months_to_budget',
|
|
195
|
+
:'goal_under_funded',
|
|
196
|
+
:'goal_overall_funded',
|
|
197
|
+
:'goal_overall_left',
|
|
198
|
+
:'goal_snoozed_at',
|
|
199
|
+
])
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Initializes the object
|
|
203
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
204
|
+
def initialize(attributes = {})
|
|
205
|
+
if (!attributes.is_a?(Hash))
|
|
206
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::CategoryBase` initialize method"
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
210
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
211
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
212
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::CategoryBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
213
|
+
end
|
|
214
|
+
h[k.to_sym] = v
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if attributes.key?(:'id')
|
|
218
|
+
self.id = attributes[:'id']
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
if attributes.key?(:'category_group_id')
|
|
222
|
+
self.category_group_id = attributes[:'category_group_id']
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
if attributes.key?(:'category_group_name')
|
|
226
|
+
self.category_group_name = attributes[:'category_group_name']
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
if attributes.key?(:'name')
|
|
230
|
+
self.name = attributes[:'name']
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
if attributes.key?(:'hidden')
|
|
234
|
+
self.hidden = attributes[:'hidden']
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
if attributes.key?(:'original_category_group_id')
|
|
238
|
+
self.original_category_group_id = attributes[:'original_category_group_id']
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
if attributes.key?(:'note')
|
|
242
|
+
self.note = attributes[:'note']
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
if attributes.key?(:'budgeted')
|
|
246
|
+
self.budgeted = attributes[:'budgeted']
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
if attributes.key?(:'activity')
|
|
250
|
+
self.activity = attributes[:'activity']
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
if attributes.key?(:'balance')
|
|
254
|
+
self.balance = attributes[:'balance']
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
if attributes.key?(:'goal_type')
|
|
258
|
+
self.goal_type = attributes[:'goal_type']
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
if attributes.key?(:'goal_needs_whole_amount')
|
|
262
|
+
self.goal_needs_whole_amount = attributes[:'goal_needs_whole_amount']
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
if attributes.key?(:'goal_day')
|
|
266
|
+
self.goal_day = attributes[:'goal_day']
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
if attributes.key?(:'goal_cadence')
|
|
270
|
+
self.goal_cadence = attributes[:'goal_cadence']
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
if attributes.key?(:'goal_cadence_frequency')
|
|
274
|
+
self.goal_cadence_frequency = attributes[:'goal_cadence_frequency']
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
if attributes.key?(:'goal_creation_month')
|
|
278
|
+
self.goal_creation_month = attributes[:'goal_creation_month']
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
if attributes.key?(:'goal_target')
|
|
282
|
+
self.goal_target = attributes[:'goal_target']
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
if attributes.key?(:'goal_target_month')
|
|
286
|
+
self.goal_target_month = attributes[:'goal_target_month']
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
if attributes.key?(:'goal_target_date')
|
|
290
|
+
self.goal_target_date = attributes[:'goal_target_date']
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
if attributes.key?(:'goal_percentage_complete')
|
|
294
|
+
self.goal_percentage_complete = attributes[:'goal_percentage_complete']
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
if attributes.key?(:'goal_months_to_budget')
|
|
298
|
+
self.goal_months_to_budget = attributes[:'goal_months_to_budget']
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
if attributes.key?(:'goal_under_funded')
|
|
302
|
+
self.goal_under_funded = attributes[:'goal_under_funded']
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
if attributes.key?(:'goal_overall_funded')
|
|
306
|
+
self.goal_overall_funded = attributes[:'goal_overall_funded']
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
if attributes.key?(:'goal_overall_left')
|
|
310
|
+
self.goal_overall_left = attributes[:'goal_overall_left']
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
if attributes.key?(:'goal_snoozed_at')
|
|
314
|
+
self.goal_snoozed_at = attributes[:'goal_snoozed_at']
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
if attributes.key?(:'deleted')
|
|
318
|
+
self.deleted = attributes[:'deleted']
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
323
|
+
# @return Array for valid properties with the reasons
|
|
324
|
+
def list_invalid_properties
|
|
325
|
+
invalid_properties = Array.new
|
|
326
|
+
invalid_properties
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# Check to see if the all the properties in the model are valid
|
|
330
|
+
# @return true if the model is valid
|
|
331
|
+
def valid?
|
|
332
|
+
return false if @id.nil?
|
|
333
|
+
return false if @category_group_id.nil?
|
|
334
|
+
return false if @name.nil?
|
|
335
|
+
return false if @hidden.nil?
|
|
336
|
+
return false if @budgeted.nil?
|
|
337
|
+
return false if @activity.nil?
|
|
338
|
+
return false if @balance.nil?
|
|
339
|
+
goal_type_validator = EnumAttributeValidator.new('String', ["TB", "TBD", "MF", "NEED", "DEBT"])
|
|
340
|
+
return false unless goal_type_validator.valid?(@goal_type)
|
|
341
|
+
return false if @deleted.nil?
|
|
342
|
+
true
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
346
|
+
# @param [Object] goal_type Object to be assigned
|
|
347
|
+
def goal_type=(goal_type)
|
|
348
|
+
@goal_type = goal_type
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
# Checks equality by comparing each attribute.
|
|
352
|
+
# @param [Object] Object to be compared
|
|
353
|
+
def ==(o)
|
|
354
|
+
return true if self.equal?(o)
|
|
355
|
+
self.class == o.class &&
|
|
356
|
+
id == o.id &&
|
|
357
|
+
category_group_id == o.category_group_id &&
|
|
358
|
+
category_group_name == o.category_group_name &&
|
|
359
|
+
name == o.name &&
|
|
360
|
+
hidden == o.hidden &&
|
|
361
|
+
original_category_group_id == o.original_category_group_id &&
|
|
362
|
+
note == o.note &&
|
|
363
|
+
budgeted == o.budgeted &&
|
|
364
|
+
activity == o.activity &&
|
|
365
|
+
balance == o.balance &&
|
|
366
|
+
goal_type == o.goal_type &&
|
|
367
|
+
goal_needs_whole_amount == o.goal_needs_whole_amount &&
|
|
368
|
+
goal_day == o.goal_day &&
|
|
369
|
+
goal_cadence == o.goal_cadence &&
|
|
370
|
+
goal_cadence_frequency == o.goal_cadence_frequency &&
|
|
371
|
+
goal_creation_month == o.goal_creation_month &&
|
|
372
|
+
goal_target == o.goal_target &&
|
|
373
|
+
goal_target_month == o.goal_target_month &&
|
|
374
|
+
goal_target_date == o.goal_target_date &&
|
|
375
|
+
goal_percentage_complete == o.goal_percentage_complete &&
|
|
376
|
+
goal_months_to_budget == o.goal_months_to_budget &&
|
|
377
|
+
goal_under_funded == o.goal_under_funded &&
|
|
378
|
+
goal_overall_funded == o.goal_overall_funded &&
|
|
379
|
+
goal_overall_left == o.goal_overall_left &&
|
|
380
|
+
goal_snoozed_at == o.goal_snoozed_at &&
|
|
381
|
+
deleted == o.deleted
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
# @see the `==` method
|
|
385
|
+
# @param [Object] Object to be compared
|
|
386
|
+
def eql?(o)
|
|
387
|
+
self == o
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
# Calculates hash code according to all attributes.
|
|
391
|
+
# @return [Integer] Hash code
|
|
392
|
+
def hash
|
|
393
|
+
[id, category_group_id, category_group_name, name, hidden, original_category_group_id, note, budgeted, activity, balance, goal_type, goal_needs_whole_amount, goal_day, goal_cadence, goal_cadence_frequency, goal_creation_month, goal_target, goal_target_month, goal_target_date, goal_percentage_complete, goal_months_to_budget, goal_under_funded, goal_overall_funded, goal_overall_left, goal_snoozed_at, deleted].hash
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
# Builds the object from hash
|
|
397
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
398
|
+
# @return [Object] Returns the model itself
|
|
399
|
+
def self.build_from_hash(attributes)
|
|
400
|
+
return nil unless attributes.is_a?(Hash)
|
|
401
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
402
|
+
transformed_hash = {}
|
|
403
|
+
openapi_types.each_pair do |key, type|
|
|
404
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
405
|
+
transformed_hash["#{key}"] = nil
|
|
406
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
407
|
+
# check to ensure the input is an array given that the attribute
|
|
408
|
+
# is documented as an array but the input is not
|
|
409
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
410
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
411
|
+
end
|
|
412
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
413
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
414
|
+
end
|
|
415
|
+
end
|
|
416
|
+
new(transformed_hash)
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
# Returns the object in the form of hash
|
|
420
|
+
# @return [Hash] Returns the object in the form of hash
|
|
421
|
+
def to_hash
|
|
422
|
+
hash = {}
|
|
423
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
424
|
+
value = self.send(attr)
|
|
425
|
+
if value.nil?
|
|
426
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
427
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
hash[param] = _to_hash(value)
|
|
431
|
+
end
|
|
432
|
+
hash
|
|
433
|
+
end
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
end
|