ynab 2.1.0 → 3.2.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 +3 -1
- data/Rakefile +3 -1
- data/docs/BulkTransactions.md +1 -1
- data/docs/CategoriesApi.md +22 -0
- data/docs/Category.md +1 -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 -12
- 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 -20
- data/lib/ynab/models/account_response.rb +13 -20
- data/lib/ynab/models/account_response_data.rb +13 -20
- data/lib/ynab/models/account_type.rb +2 -2
- data/lib/ynab/models/accounts_response.rb +13 -20
- data/lib/ynab/models/accounts_response_data.rb +13 -20
- data/lib/ynab/models/budget_detail.rb +13 -21
- data/lib/ynab/models/budget_detail_response.rb +13 -20
- data/lib/ynab/models/budget_detail_response_data.rb +13 -20
- data/lib/ynab/models/budget_settings.rb +13 -20
- data/lib/ynab/models/budget_settings_response.rb +13 -20
- data/lib/ynab/models/budget_settings_response_data.rb +13 -20
- data/lib/ynab/models/budget_summary.rb +13 -20
- data/lib/ynab/models/budget_summary_response.rb +13 -20
- data/lib/ynab/models/budget_summary_response_data.rb +13 -20
- data/lib/ynab/models/bulk_response.rb +13 -20
- data/lib/ynab/models/bulk_response_data.rb +13 -20
- data/lib/ynab/models/bulk_response_data_bulk.rb +13 -20
- data/lib/ynab/models/bulk_transactions.rb +14 -21
- data/lib/ynab/models/categories_response.rb +13 -20
- data/lib/ynab/models/categories_response_data.rb +13 -20
- data/lib/ynab/models/category.rb +25 -21
- data/lib/ynab/models/category_group.rb +13 -20
- data/lib/ynab/models/category_group_with_categories.rb +14 -22
- data/lib/ynab/models/category_response.rb +13 -20
- data/lib/ynab/models/category_response_data.rb +13 -20
- data/lib/ynab/models/currency_format.rb +13 -20
- data/lib/ynab/models/date_format.rb +13 -20
- data/lib/ynab/models/error_detail.rb +13 -20
- data/lib/ynab/models/error_response.rb +13 -20
- data/lib/ynab/models/existing_transaction.rb +359 -0
- data/lib/ynab/models/hybrid_transaction.rb +28 -43
- data/lib/ynab/models/hybrid_transactions_response.rb +13 -20
- data/lib/ynab/models/hybrid_transactions_response_data.rb +13 -20
- data/lib/ynab/models/month_detail.rb +13 -21
- data/lib/ynab/models/month_detail_response.rb +13 -20
- data/lib/ynab/models/month_detail_response_data.rb +13 -20
- data/lib/ynab/models/month_summaries_response.rb +13 -20
- data/lib/ynab/models/month_summaries_response_data.rb +13 -20
- data/lib/ynab/models/month_summary.rb +13 -20
- 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 -20
- data/lib/ynab/models/patch_payee_wrapper.rb +213 -0
- data/lib/ynab/models/patch_transactions_wrapper.rb +14 -21
- data/lib/ynab/models/payee.rb +13 -20
- data/lib/ynab/models/payee_location.rb +13 -20
- data/lib/ynab/models/payee_location_response.rb +13 -20
- data/lib/ynab/models/payee_location_response_data.rb +13 -20
- data/lib/ynab/models/payee_locations_response.rb +13 -20
- data/lib/ynab/models/payee_locations_response_data.rb +13 -20
- data/lib/ynab/models/payee_response.rb +13 -20
- data/lib/ynab/models/payee_response_data.rb +13 -20
- data/lib/ynab/models/payees_response.rb +13 -20
- data/lib/ynab/models/payees_response_data.rb +13 -20
- data/lib/ynab/models/post_account_wrapper.rb +13 -20
- data/lib/ynab/models/post_transactions_wrapper.rb +15 -22
- data/lib/ynab/models/put_transaction_wrapper.rb +14 -21
- data/lib/ynab/models/save_account.rb +13 -20
- data/lib/ynab/models/save_category.rb +232 -0
- data/lib/ynab/models/save_category_response.rb +13 -20
- data/lib/ynab/models/save_category_response_data.rb +13 -20
- data/lib/ynab/models/save_month_category.rb +13 -20
- 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 -20
- 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 -59
- data/lib/ynab/models/save_transactions_response.rb +13 -20
- data/lib/ynab/models/save_transactions_response_data.rb +13 -20
- data/lib/ynab/models/scheduled_sub_transaction.rb +13 -20
- data/lib/ynab/models/scheduled_transaction_detail.rb +26 -32
- data/lib/ynab/models/scheduled_transaction_response.rb +13 -20
- data/lib/ynab/models/scheduled_transaction_response_data.rb +13 -20
- data/lib/ynab/models/scheduled_transaction_summary.rb +26 -31
- data/lib/ynab/models/scheduled_transactions_response.rb +13 -20
- data/lib/ynab/models/scheduled_transactions_response_data.rb +13 -20
- data/lib/ynab/models/sub_transaction.rb +13 -20
- data/lib/ynab/models/transaction_cleared_status.rb +41 -0
- data/lib/ynab/models/transaction_detail.rb +28 -43
- data/lib/ynab/models/transaction_flag_color.rb +45 -0
- data/lib/ynab/models/transaction_response.rb +13 -20
- data/lib/ynab/models/transaction_response_data.rb +13 -20
- data/lib/ynab/models/transaction_summary.rb +28 -42
- data/lib/ynab/models/transactions_import_response.rb +13 -20
- data/lib/ynab/models/transactions_import_response_data.rb +13 -20
- data/lib/ynab/models/transactions_response.rb +13 -20
- data/lib/ynab/models/transactions_response_data.rb +13 -20
- data/lib/ynab/models/user.rb +13 -20
- data/lib/ynab/models/user_response.rb +13 -20
- data/lib/ynab/models/user_response_data.rb +13 -20
- data/lib/ynab/version.rb +1 -1
- data/lib/ynab.rb +13 -12
- data/open_api_spec.yaml +464 -343
- data/ynab.gemspec +4 -3
- metadata +53 -31
@@ -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.70.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.70.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
|
@@ -311,13 +318,9 @@ module YNAB
|
|
311
318
|
return false if @date.nil?
|
312
319
|
return false if @amount.nil?
|
313
320
|
return false if @cleared.nil?
|
314
|
-
cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
|
315
|
-
return false unless cleared_validator.valid?(@cleared)
|
316
321
|
return false if @approved.nil?
|
317
|
-
flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
|
318
|
-
return false unless flag_color_validator.valid?(@flag_color)
|
319
322
|
return false if @account_id.nil?
|
320
|
-
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"])
|
321
324
|
return false unless debt_transaction_type_validator.valid?(@debt_transaction_type)
|
322
325
|
return false if @deleted.nil?
|
323
326
|
return false if @type.nil?
|
@@ -327,18 +330,6 @@ module YNAB
|
|
327
330
|
true
|
328
331
|
end
|
329
332
|
|
330
|
-
# Custom attribute writer method checking allowed values (enum).
|
331
|
-
# @param [Object] cleared Object to be assigned
|
332
|
-
def cleared=(cleared)
|
333
|
-
@cleared = cleared
|
334
|
-
end
|
335
|
-
|
336
|
-
# Custom attribute writer method checking allowed values (enum).
|
337
|
-
# @param [Object] flag_color Object to be assigned
|
338
|
-
def flag_color=(flag_color)
|
339
|
-
@flag_color = flag_color
|
340
|
-
end
|
341
|
-
|
342
333
|
# Custom attribute writer method checking allowed values (enum).
|
343
334
|
# @param [Object] debt_transaction_type Object to be assigned
|
344
335
|
def debt_transaction_type=(debt_transaction_type)
|
@@ -363,6 +354,7 @@ module YNAB
|
|
363
354
|
cleared == o.cleared &&
|
364
355
|
approved == o.approved &&
|
365
356
|
flag_color == o.flag_color &&
|
357
|
+
flag_name == o.flag_name &&
|
366
358
|
account_id == o.account_id &&
|
367
359
|
payee_id == o.payee_id &&
|
368
360
|
category_id == o.category_id &&
|
@@ -390,44 +382,37 @@ module YNAB
|
|
390
382
|
# Calculates hash code according to all attributes.
|
391
383
|
# @return [Integer] Hash code
|
392
384
|
def hash
|
393
|
-
[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
|
394
386
|
end
|
395
387
|
|
396
388
|
# Builds the object from hash
|
397
389
|
# @param [Hash] attributes Model attributes in the form of hash
|
398
390
|
# @return [Object] Returns the model itself
|
399
391
|
def self.build_from_hash(attributes)
|
400
|
-
new.build_from_hash(attributes)
|
401
|
-
end
|
402
|
-
|
403
|
-
# Builds the object from hash
|
404
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
405
|
-
# @return [Object] Returns the model itself
|
406
|
-
def build_from_hash(attributes)
|
407
392
|
return nil unless attributes.is_a?(Hash)
|
408
393
|
attributes = attributes.transform_keys(&:to_sym)
|
409
|
-
|
410
|
-
|
411
|
-
|
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
|
412
398
|
elsif type =~ /\AArray<(.*)>/i
|
413
399
|
# check to ensure the input is an array given that the attribute
|
414
400
|
# is documented as an array but the input is not
|
415
|
-
if attributes[
|
416
|
-
|
401
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
402
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
417
403
|
end
|
418
|
-
elsif !attributes[
|
419
|
-
|
404
|
+
elsif !attributes[attribute_map[key]].nil?
|
405
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
420
406
|
end
|
421
407
|
end
|
422
|
-
|
423
|
-
self
|
408
|
+
new(transformed_hash)
|
424
409
|
end
|
425
410
|
|
426
411
|
# Deserializes the data based on type
|
427
412
|
# @param string type Data type
|
428
413
|
# @param string value Value to be deserialized
|
429
414
|
# @return [Object] Deserialized data
|
430
|
-
def _deserialize(type, value)
|
415
|
+
def self._deserialize(type, value)
|
431
416
|
case type.to_sym
|
432
417
|
when :Time
|
433
418
|
Time.parse(value)
|
@@ -462,7 +447,7 @@ module YNAB
|
|
462
447
|
else # model
|
463
448
|
# models (e.g. Pet) or oneOf
|
464
449
|
klass = YNAB.const_get(type)
|
465
|
-
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)
|
466
451
|
end
|
467
452
|
end
|
468
453
|
|
@@ -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.70.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
|
|
@@ -100,37 +100,30 @@ module YNAB
|
|
100
100
|
# @param [Hash] attributes Model attributes in the form of hash
|
101
101
|
# @return [Object] Returns the model itself
|
102
102
|
def self.build_from_hash(attributes)
|
103
|
-
new.build_from_hash(attributes)
|
104
|
-
end
|
105
|
-
|
106
|
-
# Builds the object from hash
|
107
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
-
# @return [Object] Returns the model itself
|
109
|
-
def build_from_hash(attributes)
|
110
103
|
return nil unless attributes.is_a?(Hash)
|
111
104
|
attributes = attributes.transform_keys(&:to_sym)
|
112
|
-
|
113
|
-
|
114
|
-
|
105
|
+
transformed_hash = {}
|
106
|
+
openapi_types.each_pair do |key, type|
|
107
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
108
|
+
transformed_hash["#{key}"] = nil
|
115
109
|
elsif type =~ /\AArray<(.*)>/i
|
116
110
|
# check to ensure the input is an array given that the attribute
|
117
111
|
# is documented as an array but the input is not
|
118
|
-
if attributes[
|
119
|
-
|
112
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
113
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
120
114
|
end
|
121
|
-
elsif !attributes[
|
122
|
-
|
115
|
+
elsif !attributes[attribute_map[key]].nil?
|
116
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
123
117
|
end
|
124
118
|
end
|
125
|
-
|
126
|
-
self
|
119
|
+
new(transformed_hash)
|
127
120
|
end
|
128
121
|
|
129
122
|
# Deserializes the data based on type
|
130
123
|
# @param string type Data type
|
131
124
|
# @param string value Value to be deserialized
|
132
125
|
# @return [Object] Deserialized data
|
133
|
-
def _deserialize(type, value)
|
126
|
+
def self._deserialize(type, value)
|
134
127
|
case type.to_sym
|
135
128
|
when :Time
|
136
129
|
Time.parse(value)
|
@@ -165,7 +158,7 @@ module YNAB
|
|
165
158
|
else # model
|
166
159
|
# models (e.g. Pet) or oneOf
|
167
160
|
klass = YNAB.const_get(type)
|
168
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
161
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
169
162
|
end
|
170
163
|
end
|
171
164
|
|
@@ -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.70.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
|
|
@@ -112,37 +112,30 @@ module YNAB
|
|
112
112
|
# @param [Hash] attributes Model attributes in the form of hash
|
113
113
|
# @return [Object] Returns the model itself
|
114
114
|
def self.build_from_hash(attributes)
|
115
|
-
new.build_from_hash(attributes)
|
116
|
-
end
|
117
|
-
|
118
|
-
# Builds the object from hash
|
119
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
-
# @return [Object] Returns the model itself
|
121
|
-
def build_from_hash(attributes)
|
122
115
|
return nil unless attributes.is_a?(Hash)
|
123
116
|
attributes = attributes.transform_keys(&:to_sym)
|
124
|
-
|
125
|
-
|
126
|
-
|
117
|
+
transformed_hash = {}
|
118
|
+
openapi_types.each_pair do |key, type|
|
119
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
120
|
+
transformed_hash["#{key}"] = nil
|
127
121
|
elsif type =~ /\AArray<(.*)>/i
|
128
122
|
# check to ensure the input is an array given that the attribute
|
129
123
|
# is documented as an array but the input is not
|
130
|
-
if attributes[
|
131
|
-
|
124
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
125
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
132
126
|
end
|
133
|
-
elsif !attributes[
|
134
|
-
|
127
|
+
elsif !attributes[attribute_map[key]].nil?
|
128
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
135
129
|
end
|
136
130
|
end
|
137
|
-
|
138
|
-
self
|
131
|
+
new(transformed_hash)
|
139
132
|
end
|
140
133
|
|
141
134
|
# Deserializes the data based on type
|
142
135
|
# @param string type Data type
|
143
136
|
# @param string value Value to be deserialized
|
144
137
|
# @return [Object] Deserialized data
|
145
|
-
def _deserialize(type, value)
|
138
|
+
def self._deserialize(type, value)
|
146
139
|
case type.to_sym
|
147
140
|
when :Time
|
148
141
|
Time.parse(value)
|
@@ -177,7 +170,7 @@ module YNAB
|
|
177
170
|
else # model
|
178
171
|
# models (e.g. Pet) or oneOf
|
179
172
|
klass = YNAB.const_get(type)
|
180
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
173
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
181
174
|
end
|
182
175
|
end
|
183
176
|
|