ynab 4.9.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.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/Rakefile +2 -2
  4. data/docs/Account.md +6 -0
  5. data/docs/AccountBase.md +25 -0
  6. data/docs/AccountsApi.md +3 -3
  7. data/docs/CategoriesApi.md +8 -8
  8. data/docs/Category.md +14 -0
  9. data/docs/CategoryBase.md +33 -0
  10. data/docs/ExistingCategory.md +2 -1
  11. data/docs/HybridTransaction.md +2 -0
  12. data/docs/MoneyMovement.md +2 -0
  13. data/docs/MoneyMovementBase.md +16 -0
  14. data/docs/MoneyMovementsApi.md +4 -4
  15. data/docs/MonthDetail.md +8 -0
  16. data/docs/MonthDetailBase.md +16 -0
  17. data/docs/MonthSummary.md +8 -0
  18. data/docs/MonthSummaryBase.md +15 -0
  19. data/docs/MonthsApi.md +2 -2
  20. data/docs/NewCategory.md +2 -1
  21. data/docs/PayeeLocationsApi.md +3 -3
  22. data/docs/PayeesApi.md +24 -3
  23. data/docs/PlanDetail.md +7 -7
  24. data/docs/PlanDetailResponseData.md +1 -1
  25. data/docs/PlanSummaryResponseData.md +2 -2
  26. data/docs/PlansApi.md +3 -3
  27. data/docs/PostPayee.md +8 -0
  28. data/docs/PostPayeeWrapper.md +8 -0
  29. data/docs/SaveAccount.md +1 -1
  30. data/docs/SaveAccountType.md +7 -0
  31. data/docs/SaveCategory.md +2 -1
  32. data/docs/SavePayee.md +1 -1
  33. data/docs/ScheduledSubTransaction.md +2 -0
  34. data/docs/ScheduledSubTransactionBase.md +17 -0
  35. data/docs/ScheduledTransactionDetail.md +2 -0
  36. data/docs/ScheduledTransactionSummary.md +2 -0
  37. data/docs/ScheduledTransactionSummaryBase.md +20 -0
  38. data/docs/ScheduledTransactionsApi.md +5 -5
  39. data/docs/SubTransaction.md +2 -0
  40. data/docs/SubTransactionBase.md +18 -0
  41. data/docs/TransactionDetail.md +2 -0
  42. data/docs/TransactionSummary.md +2 -0
  43. data/docs/TransactionSummaryBase.md +26 -0
  44. data/docs/TransactionsApi.md +11 -11
  45. data/lib/ynab/api/accounts_api.rb +3 -3
  46. data/lib/ynab/api/categories_api.rb +8 -8
  47. data/lib/ynab/api/deprecated_api.rb +3 -3
  48. data/lib/ynab/api/money_movements_api.rb +4 -4
  49. data/lib/ynab/api/months_api.rb +2 -2
  50. data/lib/ynab/api/payee_locations_api.rb +3 -3
  51. data/lib/ynab/api/payees_api.rb +77 -3
  52. data/lib/ynab/api/plans_api.rb +3 -3
  53. data/lib/ynab/api/scheduled_transactions_api.rb +5 -5
  54. data/lib/ynab/api/transactions_api.rb +11 -11
  55. data/lib/ynab/models/account.rb +72 -8
  56. data/lib/ynab/models/account_base.rb +340 -0
  57. data/lib/ynab/models/category.rb +159 -20
  58. data/lib/ynab/models/category_base.rb +436 -0
  59. data/lib/ynab/models/existing_category.rb +15 -5
  60. data/lib/ynab/models/hybrid_transaction.rb +21 -1
  61. data/lib/ynab/models/money_movement.rb +31 -11
  62. data/lib/ynab/models/money_movement_base.rb +223 -0
  63. data/lib/ynab/models/month_detail.rb +81 -1
  64. data/lib/ynab/models/month_detail_base.rb +230 -0
  65. data/lib/ynab/models/month_summary.rb +91 -6
  66. data/lib/ynab/models/month_summary_base.rb +212 -0
  67. data/lib/ynab/models/new_category.rb +15 -5
  68. data/lib/ynab/models/plan_detail.rb +7 -7
  69. data/lib/ynab/models/plan_detail_response_data.rb +8 -8
  70. data/lib/ynab/models/plan_summary_response_data.rb +15 -15
  71. data/lib/ynab/models/post_payee.rb +148 -0
  72. data/lib/ynab/models/post_payee_wrapper.rb +136 -0
  73. data/lib/ynab/models/save_account.rb +1 -1
  74. data/lib/ynab/models/save_account_type.rb +45 -0
  75. data/lib/ynab/models/save_category.rb +17 -6
  76. data/lib/ynab/models/save_payee.rb +1 -1
  77. data/lib/ynab/models/scheduled_sub_transaction.rb +31 -10
  78. data/lib/ynab/models/scheduled_sub_transaction_base.rb +229 -0
  79. data/lib/ynab/models/scheduled_transaction_detail.rb +21 -1
  80. data/lib/ynab/models/scheduled_transaction_summary.rb +31 -9
  81. data/lib/ynab/models/scheduled_transaction_summary_base.rb +292 -0
  82. data/lib/ynab/models/sub_transaction.rb +31 -11
  83. data/lib/ynab/models/sub_transaction_base.rb +240 -0
  84. data/lib/ynab/models/transaction_detail.rb +21 -1
  85. data/lib/ynab/models/transaction_summary.rb +31 -14
  86. data/lib/ynab/models/transaction_summary_base.rb +358 -0
  87. data/lib/ynab/version.rb +1 -1
  88. data/lib/ynab.rb +12 -0
  89. data/open_api_spec.yaml +330 -56
  90. data/spec/api/accounts_spec.rb +3 -3
  91. data/spec/api/categories_spec.rb +3 -3
  92. data/spec/api/months_spec.rb +2 -2
  93. data/spec/api/payee_locations_spec.rb +2 -2
  94. data/spec/api/payees_spec.rb +2 -2
  95. data/spec/api/plans_spec.rb +9 -9
  96. data/spec/api/scheduled_transactions_spec.rb +3 -3
  97. data/spec/api/transactions_spec.rb +11 -11
  98. data/spec/fixtures/vcr_cassettes/account.yml +2 -2
  99. data/spec/fixtures/vcr_cassettes/accounts.yml +2 -2
  100. data/spec/fixtures/vcr_cassettes/accounts_unauthorized.yml +2 -2
  101. data/spec/fixtures/vcr_cassettes/bulk_transactions.yml +2 -2
  102. data/spec/fixtures/vcr_cassettes/categories.yml +2 -2
  103. data/spec/fixtures/vcr_cassettes/categories_unauthorized.yml +2 -2
  104. data/spec/fixtures/vcr_cassettes/category.yml +2 -2
  105. data/spec/fixtures/vcr_cassettes/category_transactions.yml +2 -2
  106. data/spec/fixtures/vcr_cassettes/create_account.yml +2 -2
  107. data/spec/fixtures/vcr_cassettes/create_scheduled_transaction.yml +2 -2
  108. data/spec/fixtures/vcr_cassettes/create_transaction.yml +2 -2
  109. data/spec/fixtures/vcr_cassettes/create_transactions.yml +2 -2
  110. data/spec/fixtures/vcr_cassettes/import_transactions.yml +2 -2
  111. data/spec/fixtures/vcr_cassettes/month.yml +2 -2
  112. data/spec/fixtures/vcr_cassettes/month_transactions.yml +2 -2
  113. data/spec/fixtures/vcr_cassettes/months.yml +2 -2
  114. data/spec/fixtures/vcr_cassettes/months_unauthorized.yml +2 -2
  115. data/spec/fixtures/vcr_cassettes/multiple_transactions.yml +2 -2
  116. data/spec/fixtures/vcr_cassettes/patch_month_category.yml +2 -2
  117. data/spec/fixtures/vcr_cassettes/payee.yml +2 -2
  118. data/spec/fixtures/vcr_cassettes/payee_location.yml +2 -2
  119. data/spec/fixtures/vcr_cassettes/payee_locations.yml +2 -2
  120. data/spec/fixtures/vcr_cassettes/payee_locations_unauthorized.yml +2 -2
  121. data/spec/fixtures/vcr_cassettes/payee_transactions.yml +2 -2
  122. data/spec/fixtures/vcr_cassettes/payees.yml +2 -2
  123. data/spec/fixtures/vcr_cassettes/payees_unauthorized.yml +2 -2
  124. data/spec/fixtures/vcr_cassettes/{budget.yml → plan.yml} +3 -3
  125. data/spec/fixtures/vcr_cassettes/plans.yml +3 -3
  126. data/spec/fixtures/vcr_cassettes/plans_unauthorized.yml +2 -2
  127. data/spec/fixtures/vcr_cassettes/scheduled_transaction.yml +2 -2
  128. data/spec/fixtures/vcr_cassettes/scheduled_transactions.yml +2 -2
  129. data/spec/fixtures/vcr_cassettes/scheduled_transactions_unauthorized.yml +2 -2
  130. data/spec/fixtures/vcr_cassettes/transaction.yml +2 -2
  131. data/spec/fixtures/vcr_cassettes/transactions.yml +2 -2
  132. data/spec/fixtures/vcr_cassettes/transactions_invalid_flags.yml +2 -2
  133. data/spec/fixtures/vcr_cassettes/transactions_unauthorized.yml +2 -2
  134. data/spec/fixtures/vcr_cassettes/update_transaction.yml +2 -2
  135. data/spec/fixtures/vcr_cassettes/update_transactions.yml +2 -2
  136. data/ynab.gemspec +1 -1
  137. metadata +29 -9
  138. data/spec/fixtures/vcr_cassettes/budgets.yml +0 -49
  139. data/spec/fixtures/vcr_cassettes/budgets_unauthorized.yml +0 -49
@@ -0,0 +1,230 @@
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 MonthDetailBase < ApiModelBase
15
+ attr_accessor :month
16
+
17
+ attr_accessor :note
18
+
19
+ # The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month
20
+ attr_accessor :income
21
+
22
+ # The total amount assigned (budgeted) in the month
23
+ attr_accessor :budgeted
24
+
25
+ # The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign'
26
+ attr_accessor :activity
27
+
28
+ # The available amount for 'Ready to Assign'
29
+ attr_accessor :to_be_budgeted
30
+
31
+ # The Age of Money as of the month
32
+ attr_accessor :age_of_money
33
+
34
+ # Whether or not the month has been deleted. Deleted months will only be included in delta requests.
35
+ attr_accessor :deleted
36
+
37
+ # The plan month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified.
38
+ attr_accessor :categories
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'month' => :'month',
44
+ :'note' => :'note',
45
+ :'income' => :'income',
46
+ :'budgeted' => :'budgeted',
47
+ :'activity' => :'activity',
48
+ :'to_be_budgeted' => :'to_be_budgeted',
49
+ :'age_of_money' => :'age_of_money',
50
+ :'deleted' => :'deleted',
51
+ :'categories' => :'categories'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'month' => :'Date',
64
+ :'note' => :'String',
65
+ :'income' => :'Integer',
66
+ :'budgeted' => :'Integer',
67
+ :'activity' => :'Integer',
68
+ :'to_be_budgeted' => :'Integer',
69
+ :'age_of_money' => :'Integer',
70
+ :'deleted' => :'Boolean',
71
+ :'categories' => :'Array<CategoryBase>'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # List of class defined in allOf (OpenAPI v3)
82
+ def self.openapi_all_of
83
+ [
84
+ :'MonthSummaryBase'
85
+ ]
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MonthDetailBase` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!self.class.attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::MonthDetailBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'month')
104
+ self.month = attributes[:'month']
105
+ end
106
+
107
+ if attributes.key?(:'note')
108
+ self.note = attributes[:'note']
109
+ end
110
+
111
+ if attributes.key?(:'income')
112
+ self.income = attributes[:'income']
113
+ end
114
+
115
+ if attributes.key?(:'budgeted')
116
+ self.budgeted = attributes[:'budgeted']
117
+ end
118
+
119
+ if attributes.key?(:'activity')
120
+ self.activity = attributes[:'activity']
121
+ end
122
+
123
+ if attributes.key?(:'to_be_budgeted')
124
+ self.to_be_budgeted = attributes[:'to_be_budgeted']
125
+ end
126
+
127
+ if attributes.key?(:'age_of_money')
128
+ self.age_of_money = attributes[:'age_of_money']
129
+ end
130
+
131
+ if attributes.key?(:'deleted')
132
+ self.deleted = attributes[:'deleted']
133
+ end
134
+
135
+ if attributes.key?(:'categories')
136
+ if (value = attributes[:'categories']).is_a?(Array)
137
+ self.categories = value
138
+ end
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ invalid_properties = Array.new
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ return false if @month.nil?
153
+ return false if @income.nil?
154
+ return false if @budgeted.nil?
155
+ return false if @activity.nil?
156
+ return false if @to_be_budgeted.nil?
157
+ return false if @deleted.nil?
158
+ return false if @categories.nil?
159
+ true
160
+ end
161
+
162
+ # Checks equality by comparing each attribute.
163
+ # @param [Object] Object to be compared
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ month == o.month &&
168
+ note == o.note &&
169
+ income == o.income &&
170
+ budgeted == o.budgeted &&
171
+ activity == o.activity &&
172
+ to_be_budgeted == o.to_be_budgeted &&
173
+ age_of_money == o.age_of_money &&
174
+ deleted == o.deleted &&
175
+ categories == o.categories
176
+ end
177
+
178
+ # @see the `==` method
179
+ # @param [Object] Object to be compared
180
+ def eql?(o)
181
+ self == o
182
+ end
183
+
184
+ # Calculates hash code according to all attributes.
185
+ # @return [Integer] Hash code
186
+ def hash
187
+ [month, note, income, budgeted, activity, to_be_budgeted, age_of_money, deleted, categories].hash
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def self.build_from_hash(attributes)
194
+ return nil unless attributes.is_a?(Hash)
195
+ attributes = attributes.transform_keys(&:to_sym)
196
+ transformed_hash = {}
197
+ openapi_types.each_pair do |key, type|
198
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
199
+ transformed_hash["#{key}"] = nil
200
+ elsif type =~ /\AArray<(.*)>/i
201
+ # check to ensure the input is an array given that the attribute
202
+ # is documented as an array but the input is not
203
+ if attributes[attribute_map[key]].is_a?(Array)
204
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
205
+ end
206
+ elsif !attributes[attribute_map[key]].nil?
207
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
208
+ end
209
+ end
210
+ new(transformed_hash)
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+ end
229
+
230
+ end
@@ -34,6 +34,30 @@ 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 total income formatted in the plan's currency format
38
+ attr_accessor :income_formatted
39
+
40
+ # The total income as a decimal currency amount
41
+ attr_accessor :income_currency
42
+
43
+ # The total amount assigned formatted in the plan's currency format
44
+ attr_accessor :budgeted_formatted
45
+
46
+ # The total amount assigned as a decimal currency amount
47
+ attr_accessor :budgeted_currency
48
+
49
+ # The total activity amount formatted in the plan's currency format
50
+ attr_accessor :activity_formatted
51
+
52
+ # The total activity amount as a decimal currency amount
53
+ attr_accessor :activity_currency
54
+
55
+ # The available amount for 'Ready to Assign' formatted in the plan's currency format
56
+ attr_accessor :to_be_budgeted_formatted
57
+
58
+ # The available amount for 'Ready to Assign' as a decimal currency amount
59
+ attr_accessor :to_be_budgeted_currency
60
+
37
61
  # Attribute mapping from ruby-style variable name to JSON key.
38
62
  def self.attribute_map
39
63
  {
@@ -44,7 +68,15 @@ module YNAB
44
68
  :'activity' => :'activity',
45
69
  :'to_be_budgeted' => :'to_be_budgeted',
46
70
  :'age_of_money' => :'age_of_money',
47
- :'deleted' => :'deleted'
71
+ :'deleted' => :'deleted',
72
+ :'income_formatted' => :'income_formatted',
73
+ :'income_currency' => :'income_currency',
74
+ :'budgeted_formatted' => :'budgeted_formatted',
75
+ :'budgeted_currency' => :'budgeted_currency',
76
+ :'activity_formatted' => :'activity_formatted',
77
+ :'activity_currency' => :'activity_currency',
78
+ :'to_be_budgeted_formatted' => :'to_be_budgeted_formatted',
79
+ :'to_be_budgeted_currency' => :'to_be_budgeted_currency'
48
80
  }
49
81
  end
50
82
 
@@ -63,18 +95,31 @@ module YNAB
63
95
  :'activity' => :'Integer',
64
96
  :'to_be_budgeted' => :'Integer',
65
97
  :'age_of_money' => :'Integer',
66
- :'deleted' => :'Boolean'
98
+ :'deleted' => :'Boolean',
99
+ :'income_formatted' => :'String',
100
+ :'income_currency' => :'Float',
101
+ :'budgeted_formatted' => :'String',
102
+ :'budgeted_currency' => :'Float',
103
+ :'activity_formatted' => :'String',
104
+ :'activity_currency' => :'Float',
105
+ :'to_be_budgeted_formatted' => :'String',
106
+ :'to_be_budgeted_currency' => :'Float'
67
107
  }
68
108
  end
69
109
 
70
110
  # List of attributes with nullable: true
71
111
  def self.openapi_nullable
72
112
  Set.new([
73
- :'note',
74
- :'age_of_money',
75
113
  ])
76
114
  end
77
115
 
116
+ # List of class defined in allOf (OpenAPI v3)
117
+ def self.openapi_all_of
118
+ [
119
+ :'MonthSummaryBase'
120
+ ]
121
+ end
122
+
78
123
  # Initializes the object
79
124
  # @param [Hash] attributes Model attributes in the form of hash
80
125
  def initialize(attributes = {})
@@ -121,6 +166,38 @@ module YNAB
121
166
  if attributes.key?(:'deleted')
122
167
  self.deleted = attributes[:'deleted']
123
168
  end
169
+
170
+ if attributes.key?(:'income_formatted')
171
+ self.income_formatted = attributes[:'income_formatted']
172
+ end
173
+
174
+ if attributes.key?(:'income_currency')
175
+ self.income_currency = attributes[:'income_currency']
176
+ end
177
+
178
+ if attributes.key?(:'budgeted_formatted')
179
+ self.budgeted_formatted = attributes[:'budgeted_formatted']
180
+ end
181
+
182
+ if attributes.key?(:'budgeted_currency')
183
+ self.budgeted_currency = attributes[:'budgeted_currency']
184
+ end
185
+
186
+ if attributes.key?(:'activity_formatted')
187
+ self.activity_formatted = attributes[:'activity_formatted']
188
+ end
189
+
190
+ if attributes.key?(:'activity_currency')
191
+ self.activity_currency = attributes[:'activity_currency']
192
+ end
193
+
194
+ if attributes.key?(:'to_be_budgeted_formatted')
195
+ self.to_be_budgeted_formatted = attributes[:'to_be_budgeted_formatted']
196
+ end
197
+
198
+ if attributes.key?(:'to_be_budgeted_currency')
199
+ self.to_be_budgeted_currency = attributes[:'to_be_budgeted_currency']
200
+ end
124
201
  end
125
202
 
126
203
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -154,7 +231,15 @@ module YNAB
154
231
  activity == o.activity &&
155
232
  to_be_budgeted == o.to_be_budgeted &&
156
233
  age_of_money == o.age_of_money &&
157
- deleted == o.deleted
234
+ deleted == o.deleted &&
235
+ income_formatted == o.income_formatted &&
236
+ income_currency == o.income_currency &&
237
+ budgeted_formatted == o.budgeted_formatted &&
238
+ budgeted_currency == o.budgeted_currency &&
239
+ activity_formatted == o.activity_formatted &&
240
+ activity_currency == o.activity_currency &&
241
+ to_be_budgeted_formatted == o.to_be_budgeted_formatted &&
242
+ to_be_budgeted_currency == o.to_be_budgeted_currency
158
243
  end
159
244
 
160
245
  # @see the `==` method
@@ -166,7 +251,7 @@ module YNAB
166
251
  # Calculates hash code according to all attributes.
167
252
  # @return [Integer] Hash code
168
253
  def hash
169
- [month, note, income, budgeted, activity, to_be_budgeted, age_of_money, deleted].hash
254
+ [month, note, income, budgeted, activity, to_be_budgeted, age_of_money, deleted, income_formatted, income_currency, budgeted_formatted, budgeted_currency, activity_formatted, activity_currency, to_be_budgeted_formatted, to_be_budgeted_currency].hash
170
255
  end
171
256
 
172
257
  # Builds the object from hash
@@ -0,0 +1,212 @@
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 MonthSummaryBase < ApiModelBase
15
+ attr_accessor :month
16
+
17
+ attr_accessor :note
18
+
19
+ # The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month
20
+ attr_accessor :income
21
+
22
+ # The total amount assigned (budgeted) in the month
23
+ attr_accessor :budgeted
24
+
25
+ # The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign'
26
+ attr_accessor :activity
27
+
28
+ # The available amount for 'Ready to Assign'
29
+ attr_accessor :to_be_budgeted
30
+
31
+ # The Age of Money as of the month
32
+ attr_accessor :age_of_money
33
+
34
+ # Whether or not the month has been deleted. Deleted months will only be included in delta requests.
35
+ attr_accessor :deleted
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'month' => :'month',
41
+ :'note' => :'note',
42
+ :'income' => :'income',
43
+ :'budgeted' => :'budgeted',
44
+ :'activity' => :'activity',
45
+ :'to_be_budgeted' => :'to_be_budgeted',
46
+ :'age_of_money' => :'age_of_money',
47
+ :'deleted' => :'deleted'
48
+ }
49
+ end
50
+
51
+ # Returns all the JSON keys this model knows about
52
+ def self.acceptable_attributes
53
+ attribute_map.values
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'month' => :'Date',
60
+ :'note' => :'String',
61
+ :'income' => :'Integer',
62
+ :'budgeted' => :'Integer',
63
+ :'activity' => :'Integer',
64
+ :'to_be_budgeted' => :'Integer',
65
+ :'age_of_money' => :'Integer',
66
+ :'deleted' => :'Boolean'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ :'note',
74
+ :'age_of_money',
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MonthSummaryBase` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!self.class.attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::MonthSummaryBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'month')
94
+ self.month = attributes[:'month']
95
+ end
96
+
97
+ if attributes.key?(:'note')
98
+ self.note = attributes[:'note']
99
+ end
100
+
101
+ if attributes.key?(:'income')
102
+ self.income = attributes[:'income']
103
+ end
104
+
105
+ if attributes.key?(:'budgeted')
106
+ self.budgeted = attributes[:'budgeted']
107
+ end
108
+
109
+ if attributes.key?(:'activity')
110
+ self.activity = attributes[:'activity']
111
+ end
112
+
113
+ if attributes.key?(:'to_be_budgeted')
114
+ self.to_be_budgeted = attributes[:'to_be_budgeted']
115
+ end
116
+
117
+ if attributes.key?(:'age_of_money')
118
+ self.age_of_money = attributes[:'age_of_money']
119
+ end
120
+
121
+ if attributes.key?(:'deleted')
122
+ self.deleted = attributes[:'deleted']
123
+ end
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properties with the reasons
128
+ def list_invalid_properties
129
+ invalid_properties = Array.new
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ return false if @month.nil?
137
+ return false if @income.nil?
138
+ return false if @budgeted.nil?
139
+ return false if @activity.nil?
140
+ return false if @to_be_budgeted.nil?
141
+ return false if @deleted.nil?
142
+ true
143
+ end
144
+
145
+ # Checks equality by comparing each attribute.
146
+ # @param [Object] Object to be compared
147
+ def ==(o)
148
+ return true if self.equal?(o)
149
+ self.class == o.class &&
150
+ month == o.month &&
151
+ note == o.note &&
152
+ income == o.income &&
153
+ budgeted == o.budgeted &&
154
+ activity == o.activity &&
155
+ to_be_budgeted == o.to_be_budgeted &&
156
+ age_of_money == o.age_of_money &&
157
+ deleted == o.deleted
158
+ end
159
+
160
+ # @see the `==` method
161
+ # @param [Object] Object to be compared
162
+ def eql?(o)
163
+ self == o
164
+ end
165
+
166
+ # Calculates hash code according to all attributes.
167
+ # @return [Integer] Hash code
168
+ def hash
169
+ [month, note, income, budgeted, activity, to_be_budgeted, age_of_money, deleted].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def self.build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+ attributes = attributes.transform_keys(&:to_sym)
178
+ transformed_hash = {}
179
+ openapi_types.each_pair do |key, type|
180
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = nil
182
+ elsif type =~ /\AArray<(.*)>/i
183
+ # check to ensure the input is an array given that the attribute
184
+ # is documented as an array but the input is not
185
+ if attributes[attribute_map[key]].is_a?(Array)
186
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
187
+ end
188
+ elsif !attributes[attribute_map[key]].nil?
189
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
190
+ end
191
+ end
192
+ new(transformed_hash)
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+ end
211
+
212
+ end
@@ -18,12 +18,15 @@ module YNAB
18
18
 
19
19
  attr_accessor :category_group_id
20
20
 
21
- # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount.
21
+ # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories.
22
22
  attr_accessor :goal_target
23
23
 
24
24
  # The goal target date in ISO format (e.g. 2016-12-01).
25
25
  attr_accessor :goal_target_date
26
26
 
27
+ # Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'.
28
+ attr_accessor :goal_needs_whole_amount
29
+
27
30
  # Attribute mapping from ruby-style variable name to JSON key.
28
31
  def self.attribute_map
29
32
  {
@@ -31,7 +34,8 @@ module YNAB
31
34
  :'note' => :'note',
32
35
  :'category_group_id' => :'category_group_id',
33
36
  :'goal_target' => :'goal_target',
34
- :'goal_target_date' => :'goal_target_date'
37
+ :'goal_target_date' => :'goal_target_date',
38
+ :'goal_needs_whole_amount' => :'goal_needs_whole_amount'
35
39
  }
36
40
  end
37
41
 
@@ -47,7 +51,8 @@ module YNAB
47
51
  :'note' => :'String',
48
52
  :'category_group_id' => :'String',
49
53
  :'goal_target' => :'Integer',
50
- :'goal_target_date' => :'Date'
54
+ :'goal_target_date' => :'Date',
55
+ :'goal_needs_whole_amount' => :'Boolean'
51
56
  }
52
57
  end
53
58
 
@@ -98,6 +103,10 @@ module YNAB
98
103
  if attributes.key?(:'goal_target_date')
99
104
  self.goal_target_date = attributes[:'goal_target_date']
100
105
  end
106
+
107
+ if attributes.key?(:'goal_needs_whole_amount')
108
+ self.goal_needs_whole_amount = attributes[:'goal_needs_whole_amount']
109
+ end
101
110
  end
102
111
 
103
112
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -122,7 +131,8 @@ module YNAB
122
131
  note == o.note &&
123
132
  category_group_id == o.category_group_id &&
124
133
  goal_target == o.goal_target &&
125
- goal_target_date == o.goal_target_date
134
+ goal_target_date == o.goal_target_date &&
135
+ goal_needs_whole_amount == o.goal_needs_whole_amount
126
136
  end
127
137
 
128
138
  # @see the `==` method
@@ -134,7 +144,7 @@ module YNAB
134
144
  # Calculates hash code according to all attributes.
135
145
  # @return [Integer] Hash code
136
146
  def hash
137
- [name, note, category_group_id, goal_target, goal_target_date].hash
147
+ [name, note, category_group_id, goal_target, goal_target_date, goal_needs_whole_amount].hash
138
148
  end
139
149
 
140
150
  # Builds the object from hash
@@ -87,16 +87,16 @@ module YNAB
87
87
  :'last_month' => :'Date',
88
88
  :'date_format' => :'DateFormat',
89
89
  :'currency_format' => :'CurrencyFormat',
90
- :'accounts' => :'Array<Account>',
90
+ :'accounts' => :'Array<AccountBase>',
91
91
  :'payees' => :'Array<Payee>',
92
92
  :'payee_locations' => :'Array<PayeeLocation>',
93
93
  :'category_groups' => :'Array<CategoryGroup>',
94
- :'categories' => :'Array<Category>',
95
- :'months' => :'Array<MonthDetail>',
96
- :'transactions' => :'Array<TransactionSummary>',
97
- :'subtransactions' => :'Array<SubTransaction>',
98
- :'scheduled_transactions' => :'Array<ScheduledTransactionSummary>',
99
- :'scheduled_subtransactions' => :'Array<ScheduledSubTransaction>'
94
+ :'categories' => :'Array<CategoryBase>',
95
+ :'months' => :'Array<MonthDetailBase>',
96
+ :'transactions' => :'Array<TransactionSummaryBase>',
97
+ :'subtransactions' => :'Array<SubTransactionBase>',
98
+ :'scheduled_transactions' => :'Array<ScheduledTransactionSummaryBase>',
99
+ :'scheduled_subtransactions' => :'Array<ScheduledSubTransactionBase>'
100
100
  }
101
101
  end
102
102