ynab 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/DEVELOPMENT.md +6 -2
- data/Gemfile.lock +1 -1
- data/README.md +4 -2
- data/docs/BulkTransactions.md +1 -1
- data/docs/CategoriesApi.md +22 -0
- data/docs/ExistingTransaction.md +18 -0
- data/docs/HybridTransaction.md +3 -2
- data/docs/NewTransaction.md +19 -0
- data/docs/PatchCategoryWrapper.md +8 -0
- data/docs/PatchPayeeWrapper.md +8 -0
- data/docs/PatchTransactionsWrapper.md +1 -1
- data/docs/PayeesApi.md +22 -0
- data/docs/PostTransactionsWrapper.md +2 -2
- data/docs/PutTransactionWrapper.md +1 -1
- data/docs/SaveCategory.md +10 -0
- data/docs/SavePayee.md +8 -0
- data/docs/SavePayeeResponse.md +8 -0
- data/docs/SavePayeeResponseData.md +9 -0
- data/docs/SaveTransactionWithIdOrImportId.md +20 -0
- data/docs/SaveTransactionWithOptionalFields.md +2 -3
- data/docs/ScheduledTransactionDetail.md +2 -1
- data/docs/ScheduledTransactionSummary.md +2 -1
- data/docs/TransactionClearedStatus.md +7 -0
- data/docs/TransactionDetail.md +3 -2
- data/docs/TransactionFlagColor.md +7 -0
- data/docs/TransactionSummary.md +3 -2
- data/docs/TransactionsApi.md +7 -7
- data/lib/ynab/api/accounts_api.rb +2 -2
- data/lib/ynab/api/budgets_api.rb +2 -2
- data/lib/ynab/api/categories_api.rb +82 -2
- data/lib/ynab/api/months_api.rb +2 -2
- data/lib/ynab/api/payee_locations_api.rb +2 -2
- data/lib/ynab/api/payees_api.rb +82 -2
- data/lib/ynab/api/scheduled_transactions_api.rb +2 -2
- data/lib/ynab/api/transactions_api.rb +12 -28
- data/lib/ynab/api/user_api.rb +2 -2
- data/lib/ynab/api_client.rb +2 -2
- data/lib/ynab/configuration.rb +14 -11
- data/lib/ynab/models/account.rb +13 -56
- data/lib/ynab/models/account_response.rb +13 -24
- data/lib/ynab/models/account_response_data.rb +13 -24
- data/lib/ynab/models/account_type.rb +2 -2
- data/lib/ynab/models/accounts_response.rb +13 -24
- data/lib/ynab/models/accounts_response_data.rb +13 -28
- data/lib/ynab/models/budget_detail.rb +13 -29
- data/lib/ynab/models/budget_detail_response.rb +13 -24
- data/lib/ynab/models/budget_detail_response_data.rb +13 -28
- data/lib/ynab/models/budget_settings.rb +13 -20
- data/lib/ynab/models/budget_settings_response.rb +13 -24
- data/lib/ynab/models/budget_settings_response_data.rb +13 -24
- data/lib/ynab/models/budget_summary.rb +13 -28
- data/lib/ynab/models/budget_summary_response.rb +13 -24
- data/lib/ynab/models/budget_summary_response_data.rb +13 -24
- data/lib/ynab/models/bulk_response.rb +13 -24
- data/lib/ynab/models/bulk_response_data.rb +13 -24
- data/lib/ynab/models/bulk_response_data_bulk.rb +13 -28
- data/lib/ynab/models/bulk_transactions.rb +14 -25
- data/lib/ynab/models/categories_response.rb +13 -24
- data/lib/ynab/models/categories_response_data.rb +13 -28
- data/lib/ynab/models/category.rb +13 -56
- data/lib/ynab/models/category_group.rb +13 -36
- data/lib/ynab/models/category_group_with_categories.rb +14 -42
- data/lib/ynab/models/category_group_with_categories_all_of.rb +0 -4
- data/lib/ynab/models/category_response.rb +13 -24
- data/lib/ynab/models/category_response_data.rb +13 -24
- data/lib/ynab/models/currency_format.rb +13 -52
- data/lib/ynab/models/date_format.rb +13 -24
- data/lib/ynab/models/error_detail.rb +13 -32
- data/lib/ynab/models/error_response.rb +13 -24
- data/lib/ynab/models/existing_transaction.rb +359 -0
- data/lib/ynab/models/hybrid_transaction.rb +28 -95
- data/lib/ynab/models/hybrid_transaction_all_of.rb +0 -12
- data/lib/ynab/models/hybrid_transactions_response.rb +13 -24
- data/lib/ynab/models/hybrid_transactions_response_data.rb +13 -24
- data/lib/ynab/models/month_detail.rb +13 -49
- data/lib/ynab/models/month_detail_all_of.rb +0 -4
- data/lib/ynab/models/month_detail_response.rb +13 -24
- data/lib/ynab/models/month_detail_response_data.rb +13 -24
- data/lib/ynab/models/month_summaries_response.rb +13 -24
- data/lib/ynab/models/month_summaries_response_data.rb +13 -28
- data/lib/ynab/models/month_summary.rb +13 -44
- data/lib/ynab/models/new_transaction.rb +377 -0
- data/lib/ynab/models/patch_category_wrapper.rb +213 -0
- data/lib/ynab/models/patch_month_category_wrapper.rb +13 -24
- data/lib/ynab/models/patch_payee_wrapper.rb +213 -0
- data/lib/ynab/models/patch_transactions_wrapper.rb +14 -25
- data/lib/ynab/models/payee.rb +13 -32
- data/lib/ynab/models/payee_location.rb +13 -40
- data/lib/ynab/models/payee_location_response.rb +13 -24
- data/lib/ynab/models/payee_location_response_data.rb +13 -24
- data/lib/ynab/models/payee_locations_response.rb +13 -24
- data/lib/ynab/models/payee_locations_response_data.rb +13 -24
- data/lib/ynab/models/payee_response.rb +13 -24
- data/lib/ynab/models/payee_response_data.rb +13 -24
- data/lib/ynab/models/payees_response.rb +13 -24
- data/lib/ynab/models/payees_response_data.rb +13 -28
- data/lib/ynab/models/post_account_wrapper.rb +13 -24
- data/lib/ynab/models/post_transactions_wrapper.rb +15 -22
- data/lib/ynab/models/put_transaction_wrapper.rb +14 -25
- data/lib/ynab/models/save_account.rb +13 -32
- data/lib/ynab/models/save_category.rb +232 -0
- data/lib/ynab/models/save_category_response.rb +13 -24
- data/lib/ynab/models/save_category_response_data.rb +13 -28
- data/lib/ynab/models/save_month_category.rb +13 -24
- data/lib/ynab/models/save_payee.rb +220 -0
- data/lib/ynab/models/save_payee_response.rb +213 -0
- data/lib/ynab/models/save_payee_response_data.rb +224 -0
- data/lib/ynab/models/save_sub_transaction.rb +13 -40
- data/lib/ynab/models/save_transaction.rb +0 -32
- data/lib/ynab/models/save_transaction_with_id.rb +0 -32
- data/lib/ynab/models/save_transaction_with_id_or_import_id.rb +388 -0
- data/lib/ynab/models/save_transaction_with_optional_fields.rb +17 -91
- data/lib/ynab/models/save_transactions_response.rb +13 -24
- data/lib/ynab/models/save_transactions_response_data.rb +13 -28
- data/lib/ynab/models/scheduled_sub_transaction.rb +13 -36
- data/lib/ynab/models/scheduled_transaction_detail.rb +26 -76
- data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +0 -8
- data/lib/ynab/models/scheduled_transaction_response.rb +13 -24
- data/lib/ynab/models/scheduled_transaction_response_data.rb +13 -24
- data/lib/ynab/models/scheduled_transaction_summary.rb +26 -67
- data/lib/ynab/models/scheduled_transactions_response.rb +13 -24
- data/lib/ynab/models/scheduled_transactions_response_data.rb +13 -28
- data/lib/ynab/models/sub_transaction.rb +13 -36
- data/lib/ynab/models/transaction_cleared_status.rb +41 -0
- data/lib/ynab/models/transaction_detail.rb +28 -91
- data/lib/ynab/models/transaction_detail_all_of.rb +0 -8
- data/lib/ynab/models/transaction_flag_color.rb +45 -0
- data/lib/ynab/models/transaction_response.rb +13 -24
- data/lib/ynab/models/transaction_response_data.rb +13 -24
- data/lib/ynab/models/transaction_summary.rb +28 -82
- data/lib/ynab/models/transactions_import_response.rb +13 -24
- data/lib/ynab/models/transactions_import_response_data.rb +13 -24
- data/lib/ynab/models/transactions_response.rb +13 -24
- data/lib/ynab/models/transactions_response_data.rb +13 -28
- data/lib/ynab/models/user.rb +13 -24
- data/lib/ynab/models/user_response.rb +13 -24
- data/lib/ynab/models/user_response_data.rb +13 -24
- data/lib/ynab/version.rb +1 -1
- data/lib/ynab.rb +13 -12
- data/open_api_spec.yaml +455 -343
- data/templates/api.mustache +213 -0
- data/templates/partial_model_generic.mustache +305 -0
- data/ynab.gemspec +4 -3
- metadata +31 -7
@@ -0,0 +1,359 @@
|
|
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
|
+
The version of the OpenAPI document: 1.69.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module YNAB
|
17
|
+
class ExistingTransaction
|
18
|
+
attr_accessor :account_id
|
19
|
+
|
20
|
+
# The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored.
|
21
|
+
attr_accessor :date
|
22
|
+
|
23
|
+
# The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored.
|
24
|
+
attr_accessor :amount
|
25
|
+
|
26
|
+
# The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `tranfer_payee_id` on the account resource.
|
27
|
+
attr_accessor :payee_id
|
28
|
+
|
29
|
+
# The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if `import_id` is also specified) or (2) a payee with the same name or (3) creation of a new payee.
|
30
|
+
attr_accessor :payee_name
|
31
|
+
|
32
|
+
# The category for the transaction. To configure a split transaction, you can specify null for `category_id` and provide a `subtransactions` array as part of the transaction object. If an existing transaction is a split, the `category_id` cannot be changed. Credit Card Payment categories are not permitted and will be ignored if supplied.
|
33
|
+
attr_accessor :category_id
|
34
|
+
|
35
|
+
attr_accessor :memo
|
36
|
+
|
37
|
+
attr_accessor :cleared
|
38
|
+
|
39
|
+
# Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default.
|
40
|
+
attr_accessor :approved
|
41
|
+
|
42
|
+
attr_accessor :flag_color
|
43
|
+
|
44
|
+
# An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
|
45
|
+
attr_accessor :subtransactions
|
46
|
+
|
47
|
+
class EnumAttributeValidator
|
48
|
+
attr_reader :datatype
|
49
|
+
attr_reader :allowable_values
|
50
|
+
|
51
|
+
def initialize(datatype, allowable_values)
|
52
|
+
@allowable_values = allowable_values.map do |value|
|
53
|
+
case datatype.to_s
|
54
|
+
when /Integer/i
|
55
|
+
value.to_i
|
56
|
+
when /Float/i
|
57
|
+
value.to_f
|
58
|
+
else
|
59
|
+
value
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def valid?(value)
|
65
|
+
!value || allowable_values.include?(value)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
70
|
+
def self.attribute_map
|
71
|
+
{
|
72
|
+
:'account_id' => :'account_id',
|
73
|
+
:'date' => :'date',
|
74
|
+
:'amount' => :'amount',
|
75
|
+
:'payee_id' => :'payee_id',
|
76
|
+
:'payee_name' => :'payee_name',
|
77
|
+
:'category_id' => :'category_id',
|
78
|
+
:'memo' => :'memo',
|
79
|
+
:'cleared' => :'cleared',
|
80
|
+
:'approved' => :'approved',
|
81
|
+
:'flag_color' => :'flag_color',
|
82
|
+
:'subtransactions' => :'subtransactions'
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
# Returns all the JSON keys this model knows about
|
87
|
+
def self.acceptable_attributes
|
88
|
+
attribute_map.values
|
89
|
+
end
|
90
|
+
|
91
|
+
# Attribute type mapping.
|
92
|
+
def self.openapi_types
|
93
|
+
{
|
94
|
+
:'account_id' => :'String',
|
95
|
+
:'date' => :'Date',
|
96
|
+
:'amount' => :'Integer',
|
97
|
+
:'payee_id' => :'String',
|
98
|
+
:'payee_name' => :'String',
|
99
|
+
:'category_id' => :'String',
|
100
|
+
:'memo' => :'String',
|
101
|
+
:'cleared' => :'TransactionClearedStatus',
|
102
|
+
:'approved' => :'Boolean',
|
103
|
+
:'flag_color' => :'TransactionFlagColor',
|
104
|
+
:'subtransactions' => :'Array<SaveSubTransaction>'
|
105
|
+
}
|
106
|
+
end
|
107
|
+
|
108
|
+
# List of attributes with nullable: true
|
109
|
+
def self.openapi_nullable
|
110
|
+
Set.new([
|
111
|
+
:'payee_id',
|
112
|
+
:'payee_name',
|
113
|
+
:'category_id',
|
114
|
+
:'memo',
|
115
|
+
:'flag_color',
|
116
|
+
])
|
117
|
+
end
|
118
|
+
|
119
|
+
# List of class defined in allOf (OpenAPI v3)
|
120
|
+
def self.openapi_all_of
|
121
|
+
[
|
122
|
+
:'SaveTransactionWithOptionalFields'
|
123
|
+
]
|
124
|
+
end
|
125
|
+
|
126
|
+
# Initializes the object
|
127
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
128
|
+
def initialize(attributes = {})
|
129
|
+
if (!attributes.is_a?(Hash))
|
130
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::ExistingTransaction` initialize method"
|
131
|
+
end
|
132
|
+
|
133
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
134
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
135
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
136
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ExistingTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
137
|
+
end
|
138
|
+
h[k.to_sym] = v
|
139
|
+
}
|
140
|
+
|
141
|
+
if attributes.key?(:'account_id')
|
142
|
+
self.account_id = attributes[:'account_id']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.key?(:'date')
|
146
|
+
self.date = attributes[:'date']
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.key?(:'amount')
|
150
|
+
self.amount = attributes[:'amount']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'payee_id')
|
154
|
+
self.payee_id = attributes[:'payee_id']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.key?(:'payee_name')
|
158
|
+
self.payee_name = attributes[:'payee_name']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.key?(:'category_id')
|
162
|
+
self.category_id = attributes[:'category_id']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.key?(:'memo')
|
166
|
+
self.memo = attributes[:'memo']
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.key?(:'cleared')
|
170
|
+
self.cleared = attributes[:'cleared']
|
171
|
+
end
|
172
|
+
|
173
|
+
if attributes.key?(:'approved')
|
174
|
+
self.approved = attributes[:'approved']
|
175
|
+
end
|
176
|
+
|
177
|
+
if attributes.key?(:'flag_color')
|
178
|
+
self.flag_color = attributes[:'flag_color']
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.key?(:'subtransactions')
|
182
|
+
if (value = attributes[:'subtransactions']).is_a?(Array)
|
183
|
+
self.subtransactions = value
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
189
|
+
# @return Array for valid properties with the reasons
|
190
|
+
def list_invalid_properties
|
191
|
+
invalid_properties = Array.new
|
192
|
+
invalid_properties
|
193
|
+
end
|
194
|
+
|
195
|
+
# Check to see if the all the properties in the model are valid
|
196
|
+
# @return true if the model is valid
|
197
|
+
def valid?
|
198
|
+
return false if !@payee_name.nil? && @payee_name.to_s.length > 50
|
199
|
+
return false if !@memo.nil? && @memo.to_s.length > 200
|
200
|
+
true
|
201
|
+
end
|
202
|
+
|
203
|
+
# Custom attribute writer method with validation
|
204
|
+
# @param [Object] payee_name Value to be assigned
|
205
|
+
def payee_name=(payee_name)
|
206
|
+
@payee_name = payee_name
|
207
|
+
end
|
208
|
+
|
209
|
+
# Custom attribute writer method with validation
|
210
|
+
# @param [Object] memo Value to be assigned
|
211
|
+
def memo=(memo)
|
212
|
+
@memo = memo
|
213
|
+
end
|
214
|
+
|
215
|
+
# Checks equality by comparing each attribute.
|
216
|
+
# @param [Object] Object to be compared
|
217
|
+
def ==(o)
|
218
|
+
return true if self.equal?(o)
|
219
|
+
self.class == o.class &&
|
220
|
+
account_id == o.account_id &&
|
221
|
+
date == o.date &&
|
222
|
+
amount == o.amount &&
|
223
|
+
payee_id == o.payee_id &&
|
224
|
+
payee_name == o.payee_name &&
|
225
|
+
category_id == o.category_id &&
|
226
|
+
memo == o.memo &&
|
227
|
+
cleared == o.cleared &&
|
228
|
+
approved == o.approved &&
|
229
|
+
flag_color == o.flag_color &&
|
230
|
+
subtransactions == o.subtransactions
|
231
|
+
end
|
232
|
+
|
233
|
+
# @see the `==` method
|
234
|
+
# @param [Object] Object to be compared
|
235
|
+
def eql?(o)
|
236
|
+
self == o
|
237
|
+
end
|
238
|
+
|
239
|
+
# Calculates hash code according to all attributes.
|
240
|
+
# @return [Integer] Hash code
|
241
|
+
def hash
|
242
|
+
[account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, subtransactions].hash
|
243
|
+
end
|
244
|
+
|
245
|
+
# Builds the object from hash
|
246
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
247
|
+
# @return [Object] Returns the model itself
|
248
|
+
def self.build_from_hash(attributes)
|
249
|
+
return nil unless attributes.is_a?(Hash)
|
250
|
+
attributes = attributes.transform_keys(&:to_sym)
|
251
|
+
transformed_hash = {}
|
252
|
+
openapi_types.each_pair do |key, type|
|
253
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
254
|
+
transformed_hash["#{key}"] = nil
|
255
|
+
elsif type =~ /\AArray<(.*)>/i
|
256
|
+
# check to ensure the input is an array given that the attribute
|
257
|
+
# is documented as an array but the input is not
|
258
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
259
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
260
|
+
end
|
261
|
+
elsif !attributes[attribute_map[key]].nil?
|
262
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
263
|
+
end
|
264
|
+
end
|
265
|
+
new(transformed_hash)
|
266
|
+
end
|
267
|
+
|
268
|
+
# Deserializes the data based on type
|
269
|
+
# @param string type Data type
|
270
|
+
# @param string value Value to be deserialized
|
271
|
+
# @return [Object] Deserialized data
|
272
|
+
def self._deserialize(type, value)
|
273
|
+
case type.to_sym
|
274
|
+
when :Time
|
275
|
+
Time.parse(value)
|
276
|
+
when :Date
|
277
|
+
Date.parse(value)
|
278
|
+
when :String
|
279
|
+
value.to_s
|
280
|
+
when :Integer
|
281
|
+
value.to_i
|
282
|
+
when :Float
|
283
|
+
value.to_f
|
284
|
+
when :Boolean
|
285
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
286
|
+
true
|
287
|
+
else
|
288
|
+
false
|
289
|
+
end
|
290
|
+
when :Object
|
291
|
+
# generic object (usually a Hash), return directly
|
292
|
+
value
|
293
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
294
|
+
inner_type = Regexp.last_match[:inner_type]
|
295
|
+
value.map { |v| _deserialize(inner_type, v) }
|
296
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
297
|
+
k_type = Regexp.last_match[:k_type]
|
298
|
+
v_type = Regexp.last_match[:v_type]
|
299
|
+
{}.tap do |hash|
|
300
|
+
value.each do |k, v|
|
301
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
302
|
+
end
|
303
|
+
end
|
304
|
+
else # model
|
305
|
+
# models (e.g. Pet) or oneOf
|
306
|
+
klass = YNAB.const_get(type)
|
307
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
# Returns the string representation of the object
|
312
|
+
# @return [String] String presentation of the object
|
313
|
+
def to_s
|
314
|
+
to_hash.to_s
|
315
|
+
end
|
316
|
+
|
317
|
+
# to_body is an alias to to_hash (backward compatibility)
|
318
|
+
# @return [Hash] Returns the object in the form of hash
|
319
|
+
def to_body
|
320
|
+
to_hash
|
321
|
+
end
|
322
|
+
|
323
|
+
# Returns the object in the form of hash
|
324
|
+
# @return [Hash] Returns the object in the form of hash
|
325
|
+
def to_hash
|
326
|
+
hash = {}
|
327
|
+
self.class.attribute_map.each_pair do |attr, param|
|
328
|
+
value = self.send(attr)
|
329
|
+
if value.nil?
|
330
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
331
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
332
|
+
end
|
333
|
+
|
334
|
+
hash[param] = _to_hash(value)
|
335
|
+
end
|
336
|
+
hash
|
337
|
+
end
|
338
|
+
|
339
|
+
# Outputs non-array value in the form of hash
|
340
|
+
# For object, use to_hash. Otherwise, just return the value
|
341
|
+
# @param [Object] value Any valid value
|
342
|
+
# @return [Hash] Returns the value in the form of hash
|
343
|
+
def _to_hash(value)
|
344
|
+
if value.is_a?(Array)
|
345
|
+
value.compact.map { |v| _to_hash(v) }
|
346
|
+
elsif value.is_a?(Hash)
|
347
|
+
{}.tap do |hash|
|
348
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
349
|
+
end
|
350
|
+
elsif value.respond_to? :to_hash
|
351
|
+
value.to_hash
|
352
|
+
else
|
353
|
+
value
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
end
|
358
|
+
|
359
|
+
end
|
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
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
5
|
|
6
|
-
The version of the OpenAPI document: 1.
|
6
|
+
The version of the OpenAPI document: 1.69.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -25,15 +25,16 @@ module YNAB
|
|
25
25
|
|
26
26
|
attr_accessor :memo
|
27
27
|
|
28
|
-
# The cleared status of the transaction
|
29
28
|
attr_accessor :cleared
|
30
29
|
|
31
30
|
# Whether or not the transaction is approved
|
32
31
|
attr_accessor :approved
|
33
32
|
|
34
|
-
# The transaction flag
|
35
33
|
attr_accessor :flag_color
|
36
34
|
|
35
|
+
# The customized name of a transaction flag
|
36
|
+
attr_accessor :flag_name
|
37
|
+
|
37
38
|
attr_accessor :account_id
|
38
39
|
|
39
40
|
attr_accessor :payee_id
|
@@ -109,6 +110,7 @@ module YNAB
|
|
109
110
|
:'cleared' => :'cleared',
|
110
111
|
:'approved' => :'approved',
|
111
112
|
:'flag_color' => :'flag_color',
|
113
|
+
:'flag_name' => :'flag_name',
|
112
114
|
:'account_id' => :'account_id',
|
113
115
|
:'payee_id' => :'payee_id',
|
114
116
|
:'category_id' => :'category_id',
|
@@ -140,9 +142,10 @@ module YNAB
|
|
140
142
|
:'date' => :'Date',
|
141
143
|
:'amount' => :'Integer',
|
142
144
|
:'memo' => :'String',
|
143
|
-
:'cleared' => :'
|
145
|
+
:'cleared' => :'TransactionClearedStatus',
|
144
146
|
:'approved' => :'Boolean',
|
145
|
-
:'flag_color' => :'
|
147
|
+
:'flag_color' => :'TransactionFlagColor',
|
148
|
+
:'flag_name' => :'String',
|
146
149
|
:'account_id' => :'String',
|
147
150
|
:'payee_id' => :'String',
|
148
151
|
:'category_id' => :'String',
|
@@ -167,6 +170,7 @@ module YNAB
|
|
167
170
|
Set.new([
|
168
171
|
:'memo',
|
169
172
|
:'flag_color',
|
173
|
+
:'flag_name',
|
170
174
|
:'payee_id',
|
171
175
|
:'category_id',
|
172
176
|
:'transfer_account_id',
|
@@ -184,7 +188,6 @@ module YNAB
|
|
184
188
|
# List of class defined in allOf (OpenAPI v3)
|
185
189
|
def self.openapi_all_of
|
186
190
|
[
|
187
|
-
:'HybridTransactionAllOf',
|
188
191
|
:'TransactionSummary'
|
189
192
|
]
|
190
193
|
end
|
@@ -232,6 +235,10 @@ module YNAB
|
|
232
235
|
self.flag_color = attributes[:'flag_color']
|
233
236
|
end
|
234
237
|
|
238
|
+
if attributes.key?(:'flag_name')
|
239
|
+
self.flag_name = attributes[:'flag_name']
|
240
|
+
end
|
241
|
+
|
235
242
|
if attributes.key?(:'account_id')
|
236
243
|
self.account_id = attributes[:'account_id']
|
237
244
|
end
|
@@ -301,42 +308,6 @@ module YNAB
|
|
301
308
|
# @return Array for valid properties with the reasons
|
302
309
|
def list_invalid_properties
|
303
310
|
invalid_properties = Array.new
|
304
|
-
if @id.nil?
|
305
|
-
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
306
|
-
end
|
307
|
-
|
308
|
-
if @date.nil?
|
309
|
-
invalid_properties.push('invalid value for "date", date cannot be nil.')
|
310
|
-
end
|
311
|
-
|
312
|
-
if @amount.nil?
|
313
|
-
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
314
|
-
end
|
315
|
-
|
316
|
-
if @cleared.nil?
|
317
|
-
invalid_properties.push('invalid value for "cleared", cleared cannot be nil.')
|
318
|
-
end
|
319
|
-
|
320
|
-
if @approved.nil?
|
321
|
-
invalid_properties.push('invalid value for "approved", approved cannot be nil.')
|
322
|
-
end
|
323
|
-
|
324
|
-
if @account_id.nil?
|
325
|
-
invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
|
326
|
-
end
|
327
|
-
|
328
|
-
if @deleted.nil?
|
329
|
-
invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
|
330
|
-
end
|
331
|
-
|
332
|
-
if @type.nil?
|
333
|
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
334
|
-
end
|
335
|
-
|
336
|
-
if @account_name.nil?
|
337
|
-
invalid_properties.push('invalid value for "account_name", account_name cannot be nil.')
|
338
|
-
end
|
339
|
-
|
340
311
|
invalid_properties
|
341
312
|
end
|
342
313
|
|
@@ -347,13 +318,9 @@ module YNAB
|
|
347
318
|
return false if @date.nil?
|
348
319
|
return false if @amount.nil?
|
349
320
|
return false if @cleared.nil?
|
350
|
-
cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
351
|
-
return false unless cleared_validator.valid?(@cleared)
|
352
321
|
return false if @approved.nil?
|
353
|
-
flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
354
|
-
return false unless flag_color_validator.valid?(@flag_color)
|
355
322
|
return false if @account_id.nil?
|
356
|
-
debt_transaction_type_validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "
|
323
|
+
debt_transaction_type_validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balanceAdjustment", "credit", "charge", "null"])
|
357
324
|
return false unless debt_transaction_type_validator.valid?(@debt_transaction_type)
|
358
325
|
return false if @deleted.nil?
|
359
326
|
return false if @type.nil?
|
@@ -363,43 +330,15 @@ module YNAB
|
|
363
330
|
true
|
364
331
|
end
|
365
332
|
|
366
|
-
# Custom attribute writer method checking allowed values (enum).
|
367
|
-
# @param [Object] cleared Object to be assigned
|
368
|
-
def cleared=(cleared)
|
369
|
-
validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
370
|
-
unless validator.valid?(cleared)
|
371
|
-
fail ArgumentError, "invalid value for \"cleared\", must be one of #{validator.allowable_values}."
|
372
|
-
end
|
373
|
-
@cleared = cleared
|
374
|
-
end
|
375
|
-
|
376
|
-
# Custom attribute writer method checking allowed values (enum).
|
377
|
-
# @param [Object] flag_color Object to be assigned
|
378
|
-
def flag_color=(flag_color)
|
379
|
-
validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
380
|
-
unless validator.valid?(flag_color)
|
381
|
-
fail ArgumentError, "invalid value for \"flag_color\", must be one of #{validator.allowable_values}."
|
382
|
-
end
|
383
|
-
@flag_color = flag_color
|
384
|
-
end
|
385
|
-
|
386
333
|
# Custom attribute writer method checking allowed values (enum).
|
387
334
|
# @param [Object] debt_transaction_type Object to be assigned
|
388
335
|
def debt_transaction_type=(debt_transaction_type)
|
389
|
-
validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balancedAdjustment", "credit", "charge", "null"])
|
390
|
-
unless validator.valid?(debt_transaction_type)
|
391
|
-
fail ArgumentError, "invalid value for \"debt_transaction_type\", must be one of #{validator.allowable_values}."
|
392
|
-
end
|
393
336
|
@debt_transaction_type = debt_transaction_type
|
394
337
|
end
|
395
338
|
|
396
339
|
# Custom attribute writer method checking allowed values (enum).
|
397
340
|
# @param [Object] type Object to be assigned
|
398
341
|
def type=(type)
|
399
|
-
validator = EnumAttributeValidator.new('String', ["transaction", "subtransaction"])
|
400
|
-
unless validator.valid?(type)
|
401
|
-
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
402
|
-
end
|
403
342
|
@type = type
|
404
343
|
end
|
405
344
|
|
@@ -415,6 +354,7 @@ module YNAB
|
|
415
354
|
cleared == o.cleared &&
|
416
355
|
approved == o.approved &&
|
417
356
|
flag_color == o.flag_color &&
|
357
|
+
flag_name == o.flag_name &&
|
418
358
|
account_id == o.account_id &&
|
419
359
|
payee_id == o.payee_id &&
|
420
360
|
category_id == o.category_id &&
|
@@ -442,44 +382,37 @@ module YNAB
|
|
442
382
|
# Calculates hash code according to all attributes.
|
443
383
|
# @return [Integer] Hash code
|
444
384
|
def hash
|
445
|
-
[id, date, amount, memo, cleared, approved, flag_color, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted, type, parent_transaction_id, account_name, payee_name, category_name].hash
|
385
|
+
[id, date, amount, memo, cleared, approved, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted, type, parent_transaction_id, account_name, payee_name, category_name].hash
|
446
386
|
end
|
447
387
|
|
448
388
|
# Builds the object from hash
|
449
389
|
# @param [Hash] attributes Model attributes in the form of hash
|
450
390
|
# @return [Object] Returns the model itself
|
451
391
|
def self.build_from_hash(attributes)
|
452
|
-
new.build_from_hash(attributes)
|
453
|
-
end
|
454
|
-
|
455
|
-
# Builds the object from hash
|
456
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
457
|
-
# @return [Object] Returns the model itself
|
458
|
-
def build_from_hash(attributes)
|
459
392
|
return nil unless attributes.is_a?(Hash)
|
460
393
|
attributes = attributes.transform_keys(&:to_sym)
|
461
|
-
|
462
|
-
|
463
|
-
|
394
|
+
transformed_hash = {}
|
395
|
+
openapi_types.each_pair do |key, type|
|
396
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
397
|
+
transformed_hash["#{key}"] = nil
|
464
398
|
elsif type =~ /\AArray<(.*)>/i
|
465
399
|
# check to ensure the input is an array given that the attribute
|
466
400
|
# is documented as an array but the input is not
|
467
|
-
if attributes[
|
468
|
-
|
401
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
402
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
469
403
|
end
|
470
|
-
elsif !attributes[
|
471
|
-
|
404
|
+
elsif !attributes[attribute_map[key]].nil?
|
405
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
472
406
|
end
|
473
407
|
end
|
474
|
-
|
475
|
-
self
|
408
|
+
new(transformed_hash)
|
476
409
|
end
|
477
410
|
|
478
411
|
# Deserializes the data based on type
|
479
412
|
# @param string type Data type
|
480
413
|
# @param string value Value to be deserialized
|
481
414
|
# @return [Object] Deserialized data
|
482
|
-
def _deserialize(type, value)
|
415
|
+
def self._deserialize(type, value)
|
483
416
|
case type.to_sym
|
484
417
|
when :Time
|
485
418
|
Time.parse(value)
|
@@ -514,7 +447,7 @@ module YNAB
|
|
514
447
|
else # model
|
515
448
|
# models (e.g. Pet) or oneOf
|
516
449
|
klass = YNAB.const_get(type)
|
517
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
450
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
518
451
|
end
|
519
452
|
end
|
520
453
|
|
@@ -125,14 +125,6 @@ module YNAB
|
|
125
125
|
# @return Array for valid properties with the reasons
|
126
126
|
def list_invalid_properties
|
127
127
|
invalid_properties = Array.new
|
128
|
-
if @type.nil?
|
129
|
-
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
130
|
-
end
|
131
|
-
|
132
|
-
if @account_name.nil?
|
133
|
-
invalid_properties.push('invalid value for "account_name", account_name cannot be nil.')
|
134
|
-
end
|
135
|
-
|
136
128
|
invalid_properties
|
137
129
|
end
|
138
130
|
|
@@ -149,10 +141,6 @@ module YNAB
|
|
149
141
|
# Custom attribute writer method checking allowed values (enum).
|
150
142
|
# @param [Object] type Object to be assigned
|
151
143
|
def type=(type)
|
152
|
-
validator = EnumAttributeValidator.new('String', ["transaction", "subtransaction"])
|
153
|
-
unless validator.valid?(type)
|
154
|
-
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
155
|
-
end
|
156
144
|
@type = type
|
157
145
|
end
|
158
146
|
|