ynab 1.23.0 → 1.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -6
- data/lib/ynab/api/transactions_api.rb +58 -0
- data/lib/ynab/models/hybrid_transaction.rb +52 -2
- data/lib/ynab/models/patch_month_category_wrapper.rb +189 -0
- data/lib/ynab/models/patch_transactions_wrapper.rb +191 -0
- data/lib/ynab/models/post_account_wrapper.rb +189 -0
- data/lib/ynab/models/post_transactions_wrapper.rb +195 -0
- data/lib/ynab/models/put_transaction_wrapper.rb +189 -0
- data/lib/ynab/models/save_transaction.rb +0 -15
- data/lib/ynab/models/save_transaction_with_id.rb +387 -0
- data/lib/ynab/models/save_transaction_with_optional_fields.rb +378 -0
- data/lib/ynab/models/transaction_detail.rb +52 -2
- data/lib/ynab/models/transaction_summary.rb +52 -2
- data/lib/ynab/version.rb +1 -1
- data/lib/ynab.rb +8 -7
- metadata +40 -33
@@ -0,0 +1,378 @@
|
|
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.youneedabudget.com
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module YNAB
|
16
|
+
class SaveTransactionWithOptionalFields
|
17
|
+
attr_accessor :account_id
|
18
|
+
|
19
|
+
# 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.
|
20
|
+
attr_accessor :date
|
21
|
+
|
22
|
+
# The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored.
|
23
|
+
attr_accessor :amount
|
24
|
+
|
25
|
+
# 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.
|
26
|
+
attr_accessor :payee_id
|
27
|
+
|
28
|
+
# 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.
|
29
|
+
attr_accessor :payee_name
|
30
|
+
|
31
|
+
# 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.
|
32
|
+
attr_accessor :category_id
|
33
|
+
|
34
|
+
attr_accessor :memo
|
35
|
+
|
36
|
+
# The cleared status of the transaction
|
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
|
+
# The transaction flag
|
43
|
+
attr_accessor :flag_color
|
44
|
+
|
45
|
+
# If specified, the new transaction will be assigned this `import_id` and considered \"imported\". We will also attempt to match this imported transaction to an existing \"user-entered\" transation on the same account, with the same amount, and with a date +/-10 days from the imported transaction date.<br><br>Transactions imported through File Based Import or Direct Import (not through the API) are assigned an import_id in the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. Using a consistent format will prevent duplicates through Direct Import and File Based Import.<br><br>If import_id is omitted or specified as null, the transaction will be treated as a \"user-entered\" transaction. As such, it will be eligible to be matched against transactions later being imported (via DI, FBI, or API).
|
46
|
+
attr_accessor :import_id
|
47
|
+
|
48
|
+
# An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
|
49
|
+
attr_accessor :subtransactions
|
50
|
+
|
51
|
+
class EnumAttributeValidator
|
52
|
+
attr_reader :datatype
|
53
|
+
attr_reader :allowable_values
|
54
|
+
|
55
|
+
def initialize(datatype, allowable_values)
|
56
|
+
@allowable_values = allowable_values.map do |value|
|
57
|
+
case datatype.to_s
|
58
|
+
when /Integer/i
|
59
|
+
value.to_i
|
60
|
+
when /Float/i
|
61
|
+
value.to_f
|
62
|
+
else
|
63
|
+
value
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def valid?(value)
|
69
|
+
!value || allowable_values.include?(value)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
74
|
+
def self.attribute_map
|
75
|
+
{
|
76
|
+
:'account_id' => :'account_id',
|
77
|
+
:'date' => :'date',
|
78
|
+
:'amount' => :'amount',
|
79
|
+
:'payee_id' => :'payee_id',
|
80
|
+
:'payee_name' => :'payee_name',
|
81
|
+
:'category_id' => :'category_id',
|
82
|
+
:'memo' => :'memo',
|
83
|
+
:'cleared' => :'cleared',
|
84
|
+
:'approved' => :'approved',
|
85
|
+
:'flag_color' => :'flag_color',
|
86
|
+
:'import_id' => :'import_id',
|
87
|
+
:'subtransactions' => :'subtransactions'
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
# Attribute type mapping.
|
92
|
+
def self.swagger_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' => :'String',
|
102
|
+
:'approved' => :'BOOLEAN',
|
103
|
+
:'flag_color' => :'String',
|
104
|
+
:'import_id' => :'String',
|
105
|
+
:'subtransactions' => :'Array<SaveSubTransaction>'
|
106
|
+
}
|
107
|
+
end
|
108
|
+
|
109
|
+
# Initializes the object
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
111
|
+
def initialize(attributes = {})
|
112
|
+
return unless attributes.is_a?(Hash)
|
113
|
+
|
114
|
+
# convert string to symbol for hash key
|
115
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
116
|
+
|
117
|
+
if attributes.has_key?(:'account_id')
|
118
|
+
self.account_id = attributes[:'account_id']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'date')
|
122
|
+
self.date = attributes[:'date']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'amount')
|
126
|
+
self.amount = attributes[:'amount']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'payee_id')
|
130
|
+
self.payee_id = attributes[:'payee_id']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.has_key?(:'payee_name')
|
134
|
+
self.payee_name = attributes[:'payee_name']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.has_key?(:'category_id')
|
138
|
+
self.category_id = attributes[:'category_id']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.has_key?(:'memo')
|
142
|
+
self.memo = attributes[:'memo']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.has_key?(:'cleared')
|
146
|
+
self.cleared = attributes[:'cleared']
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.has_key?(:'approved')
|
150
|
+
self.approved = attributes[:'approved']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.has_key?(:'flag_color')
|
154
|
+
self.flag_color = attributes[:'flag_color']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.has_key?(:'import_id')
|
158
|
+
self.import_id = attributes[:'import_id']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.has_key?(:'subtransactions')
|
162
|
+
if (value = attributes[:'subtransactions']).is_a?(Array)
|
163
|
+
self.subtransactions = value
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
169
|
+
# @return Array for valid properties with the reasons
|
170
|
+
def list_invalid_properties
|
171
|
+
invalid_properties = Array.new
|
172
|
+
if !@payee_name.nil? && @payee_name.to_s.length > 50
|
173
|
+
invalid_properties.push('invalid value for "payee_name", the character length must be smaller than or equal to 50.')
|
174
|
+
end
|
175
|
+
|
176
|
+
if !@memo.nil? && @memo.to_s.length > 200
|
177
|
+
invalid_properties.push('invalid value for "memo", the character length must be smaller than or equal to 200.')
|
178
|
+
end
|
179
|
+
|
180
|
+
if !@import_id.nil? && @import_id.to_s.length > 36
|
181
|
+
invalid_properties.push('invalid value for "import_id", the character length must be smaller than or equal to 36.')
|
182
|
+
end
|
183
|
+
|
184
|
+
invalid_properties
|
185
|
+
end
|
186
|
+
|
187
|
+
# Check to see if the all the properties in the model are valid
|
188
|
+
# @return true if the model is valid
|
189
|
+
def valid?
|
190
|
+
return false if !@payee_name.nil? && @payee_name.to_s.length > 50
|
191
|
+
return false if !@memo.nil? && @memo.to_s.length > 200
|
192
|
+
cleared_validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
|
193
|
+
return false unless cleared_validator.valid?(@cleared)
|
194
|
+
flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
|
195
|
+
return false unless flag_color_validator.valid?(@flag_color)
|
196
|
+
return false if !@import_id.nil? && @import_id.to_s.length > 36
|
197
|
+
true
|
198
|
+
end
|
199
|
+
|
200
|
+
# Custom attribute writer method with validation
|
201
|
+
# @param [Object] payee_name Value to be assigned
|
202
|
+
def payee_name=(payee_name)
|
203
|
+
if !payee_name.nil? && payee_name.to_s.length > 50
|
204
|
+
fail ArgumentError, 'invalid value for "payee_name", the character length must be smaller than or equal to 50.'
|
205
|
+
end
|
206
|
+
|
207
|
+
@payee_name = payee_name
|
208
|
+
end
|
209
|
+
|
210
|
+
# Custom attribute writer method with validation
|
211
|
+
# @param [Object] memo Value to be assigned
|
212
|
+
def memo=(memo)
|
213
|
+
if !memo.nil? && memo.to_s.length > 200
|
214
|
+
fail ArgumentError, 'invalid value for "memo", the character length must be smaller than or equal to 200.'
|
215
|
+
end
|
216
|
+
|
217
|
+
@memo = memo
|
218
|
+
end
|
219
|
+
|
220
|
+
# Custom attribute writer method checking allowed values (enum).
|
221
|
+
# @param [Object] cleared Object to be assigned
|
222
|
+
def cleared=(cleared)
|
223
|
+
@cleared = cleared
|
224
|
+
end
|
225
|
+
|
226
|
+
# Custom attribute writer method checking allowed values (enum).
|
227
|
+
# @param [Object] flag_color Object to be assigned
|
228
|
+
def flag_color=(flag_color)
|
229
|
+
@flag_color = flag_color
|
230
|
+
end
|
231
|
+
|
232
|
+
# Custom attribute writer method with validation
|
233
|
+
# @param [Object] import_id Value to be assigned
|
234
|
+
def import_id=(import_id)
|
235
|
+
if !import_id.nil? && import_id.to_s.length > 36
|
236
|
+
fail ArgumentError, 'invalid value for "import_id", the character length must be smaller than or equal to 36.'
|
237
|
+
end
|
238
|
+
|
239
|
+
@import_id = import_id
|
240
|
+
end
|
241
|
+
|
242
|
+
# Checks equality by comparing each attribute.
|
243
|
+
# @param [Object] Object to be compared
|
244
|
+
def ==(o)
|
245
|
+
return true if self.equal?(o)
|
246
|
+
self.class == o.class &&
|
247
|
+
account_id == o.account_id &&
|
248
|
+
date == o.date &&
|
249
|
+
amount == o.amount &&
|
250
|
+
payee_id == o.payee_id &&
|
251
|
+
payee_name == o.payee_name &&
|
252
|
+
category_id == o.category_id &&
|
253
|
+
memo == o.memo &&
|
254
|
+
cleared == o.cleared &&
|
255
|
+
approved == o.approved &&
|
256
|
+
flag_color == o.flag_color &&
|
257
|
+
import_id == o.import_id &&
|
258
|
+
subtransactions == o.subtransactions
|
259
|
+
end
|
260
|
+
|
261
|
+
# @see the `==` method
|
262
|
+
# @param [Object] Object to be compared
|
263
|
+
def eql?(o)
|
264
|
+
self == o
|
265
|
+
end
|
266
|
+
|
267
|
+
# Calculates hash code according to all attributes.
|
268
|
+
# @return [Fixnum] Hash code
|
269
|
+
def hash
|
270
|
+
[account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions].hash
|
271
|
+
end
|
272
|
+
# Builds the object from hash
|
273
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
274
|
+
# @return [Object] Returns the model itself
|
275
|
+
def build_from_hash(attributes)
|
276
|
+
return nil unless attributes.is_a?(Hash)
|
277
|
+
self.class.swagger_types.each_pair do |key, type|
|
278
|
+
if type =~ /\AArray<(.*)>/i
|
279
|
+
# check to ensure the input is an array given that the attribute
|
280
|
+
# is documented as an array but the input is not
|
281
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
282
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
283
|
+
end
|
284
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
285
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
286
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
287
|
+
end
|
288
|
+
|
289
|
+
self
|
290
|
+
end
|
291
|
+
|
292
|
+
# Deserializes the data based on type
|
293
|
+
# @param string type Data type
|
294
|
+
# @param string value Value to be deserialized
|
295
|
+
# @return [Object] Deserialized data
|
296
|
+
def _deserialize(type, value)
|
297
|
+
case type.to_sym
|
298
|
+
when :DateTime
|
299
|
+
DateTime.parse(value)
|
300
|
+
when :Date
|
301
|
+
Date.parse(value)
|
302
|
+
when :String
|
303
|
+
value.to_s
|
304
|
+
when :Integer
|
305
|
+
value.to_i
|
306
|
+
when :Float
|
307
|
+
value.to_f
|
308
|
+
when :BOOLEAN
|
309
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
310
|
+
true
|
311
|
+
else
|
312
|
+
false
|
313
|
+
end
|
314
|
+
when :Object
|
315
|
+
# generic object (usually a Hash), return directly
|
316
|
+
value
|
317
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
318
|
+
inner_type = Regexp.last_match[:inner_type]
|
319
|
+
value.map { |v| _deserialize(inner_type, v) }
|
320
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
321
|
+
k_type = Regexp.last_match[:k_type]
|
322
|
+
v_type = Regexp.last_match[:v_type]
|
323
|
+
{}.tap do |hash|
|
324
|
+
value.each do |k, v|
|
325
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
else # model
|
329
|
+
temp_model = YNAB.const_get(type).new
|
330
|
+
temp_model.build_from_hash(value)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
# Returns the string representation of the object
|
335
|
+
# @return [String] String presentation of the object
|
336
|
+
def to_s
|
337
|
+
to_hash.to_s
|
338
|
+
end
|
339
|
+
|
340
|
+
# to_body is an alias to to_hash (backward compatibility)
|
341
|
+
# @return [Hash] Returns the object in the form of hash
|
342
|
+
def to_body
|
343
|
+
to_hash
|
344
|
+
end
|
345
|
+
|
346
|
+
# Returns the object in the form of hash
|
347
|
+
# @return [Hash] Returns the object in the form of hash
|
348
|
+
def to_hash
|
349
|
+
hash = {}
|
350
|
+
self.class.attribute_map.each_pair do |attr, param|
|
351
|
+
value = self.send(attr)
|
352
|
+
next if value.nil?
|
353
|
+
hash[param] = _to_hash(value)
|
354
|
+
end
|
355
|
+
hash
|
356
|
+
end
|
357
|
+
|
358
|
+
# Outputs non-array value in the form of hash
|
359
|
+
# For object, use to_hash. Otherwise, just return the value
|
360
|
+
# @param [Object] value Any valid value
|
361
|
+
# @return [Hash] Returns the value in the form of hash
|
362
|
+
def _to_hash(value)
|
363
|
+
if value.is_a?(Array)
|
364
|
+
value.compact.map { |v| _to_hash(v) }
|
365
|
+
elsif value.is_a?(Hash)
|
366
|
+
{}.tap do |hash|
|
367
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
368
|
+
end
|
369
|
+
elsif value.respond_to? :to_hash
|
370
|
+
value.to_hash
|
371
|
+
else
|
372
|
+
value
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
end
|
377
|
+
|
378
|
+
end
|
@@ -48,9 +48,15 @@ module YNAB
|
|
48
48
|
# If transaction is matched, the id of the matched transaction
|
49
49
|
attr_accessor :matched_transaction_id
|
50
50
|
|
51
|
-
# If the
|
51
|
+
# If the transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'.
|
52
52
|
attr_accessor :import_id
|
53
53
|
|
54
|
+
# If the transaction was imported, the payee name that was used when importing and before applying any payee rename rules
|
55
|
+
attr_accessor :import_payee_name
|
56
|
+
|
57
|
+
# If the transaction was imported, the original payee name as it appeared on the statement
|
58
|
+
attr_accessor :import_payee_name_original
|
59
|
+
|
54
60
|
# Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.
|
55
61
|
attr_accessor :deleted
|
56
62
|
|
@@ -102,6 +108,8 @@ module YNAB
|
|
102
108
|
:'transfer_transaction_id' => :'transfer_transaction_id',
|
103
109
|
:'matched_transaction_id' => :'matched_transaction_id',
|
104
110
|
:'import_id' => :'import_id',
|
111
|
+
:'import_payee_name' => :'import_payee_name',
|
112
|
+
:'import_payee_name_original' => :'import_payee_name_original',
|
105
113
|
:'deleted' => :'deleted',
|
106
114
|
:'account_name' => :'account_name',
|
107
115
|
:'payee_name' => :'payee_name',
|
@@ -127,6 +135,8 @@ module YNAB
|
|
127
135
|
:'transfer_transaction_id' => :'String',
|
128
136
|
:'matched_transaction_id' => :'String',
|
129
137
|
:'import_id' => :'String',
|
138
|
+
:'import_payee_name' => :'String',
|
139
|
+
:'import_payee_name_original' => :'String',
|
130
140
|
:'deleted' => :'BOOLEAN',
|
131
141
|
:'account_name' => :'String',
|
132
142
|
:'payee_name' => :'String',
|
@@ -199,6 +209,14 @@ module YNAB
|
|
199
209
|
self.import_id = attributes[:'import_id']
|
200
210
|
end
|
201
211
|
|
212
|
+
if attributes.has_key?(:'import_payee_name')
|
213
|
+
self.import_payee_name = attributes[:'import_payee_name']
|
214
|
+
end
|
215
|
+
|
216
|
+
if attributes.has_key?(:'import_payee_name_original')
|
217
|
+
self.import_payee_name_original = attributes[:'import_payee_name_original']
|
218
|
+
end
|
219
|
+
|
202
220
|
if attributes.has_key?(:'deleted')
|
203
221
|
self.deleted = attributes[:'deleted']
|
204
222
|
end
|
@@ -250,6 +268,14 @@ module YNAB
|
|
250
268
|
invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
|
251
269
|
end
|
252
270
|
|
271
|
+
if !@import_payee_name.nil? && @import_payee_name.to_s.length > 200
|
272
|
+
invalid_properties.push('invalid value for "import_payee_name", the character length must be smaller than or equal to 200.')
|
273
|
+
end
|
274
|
+
|
275
|
+
if !@import_payee_name_original.nil? && @import_payee_name_original.to_s.length > 200
|
276
|
+
invalid_properties.push('invalid value for "import_payee_name_original", the character length must be smaller than or equal to 200.')
|
277
|
+
end
|
278
|
+
|
253
279
|
if @deleted.nil?
|
254
280
|
invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
|
255
281
|
end
|
@@ -278,6 +304,8 @@ module YNAB
|
|
278
304
|
flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
|
279
305
|
return false unless flag_color_validator.valid?(@flag_color)
|
280
306
|
return false if @account_id.nil?
|
307
|
+
return false if !@import_payee_name.nil? && @import_payee_name.to_s.length > 200
|
308
|
+
return false if !@import_payee_name_original.nil? && @import_payee_name_original.to_s.length > 200
|
281
309
|
return false if @deleted.nil?
|
282
310
|
return false if @account_name.nil?
|
283
311
|
return false if @subtransactions.nil?
|
@@ -296,6 +324,26 @@ module YNAB
|
|
296
324
|
@flag_color = flag_color
|
297
325
|
end
|
298
326
|
|
327
|
+
# Custom attribute writer method with validation
|
328
|
+
# @param [Object] import_payee_name Value to be assigned
|
329
|
+
def import_payee_name=(import_payee_name)
|
330
|
+
if !import_payee_name.nil? && import_payee_name.to_s.length > 200
|
331
|
+
fail ArgumentError, 'invalid value for "import_payee_name", the character length must be smaller than or equal to 200.'
|
332
|
+
end
|
333
|
+
|
334
|
+
@import_payee_name = import_payee_name
|
335
|
+
end
|
336
|
+
|
337
|
+
# Custom attribute writer method with validation
|
338
|
+
# @param [Object] import_payee_name_original Value to be assigned
|
339
|
+
def import_payee_name_original=(import_payee_name_original)
|
340
|
+
if !import_payee_name_original.nil? && import_payee_name_original.to_s.length > 200
|
341
|
+
fail ArgumentError, 'invalid value for "import_payee_name_original", the character length must be smaller than or equal to 200.'
|
342
|
+
end
|
343
|
+
|
344
|
+
@import_payee_name_original = import_payee_name_original
|
345
|
+
end
|
346
|
+
|
299
347
|
# Checks equality by comparing each attribute.
|
300
348
|
# @param [Object] Object to be compared
|
301
349
|
def ==(o)
|
@@ -315,6 +363,8 @@ module YNAB
|
|
315
363
|
transfer_transaction_id == o.transfer_transaction_id &&
|
316
364
|
matched_transaction_id == o.matched_transaction_id &&
|
317
365
|
import_id == o.import_id &&
|
366
|
+
import_payee_name == o.import_payee_name &&
|
367
|
+
import_payee_name_original == o.import_payee_name_original &&
|
318
368
|
deleted == o.deleted &&
|
319
369
|
account_name == o.account_name &&
|
320
370
|
payee_name == o.payee_name &&
|
@@ -331,7 +381,7 @@ module YNAB
|
|
331
381
|
# Calculates hash code according to all attributes.
|
332
382
|
# @return [Fixnum] Hash code
|
333
383
|
def hash
|
334
|
-
[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, deleted, account_name, payee_name, category_name, subtransactions].hash
|
384
|
+
[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, deleted, account_name, payee_name, category_name, subtransactions].hash
|
335
385
|
end
|
336
386
|
# Builds the object from hash
|
337
387
|
# @param [Hash] attributes Model attributes in the form of hash
|
@@ -48,9 +48,15 @@ module YNAB
|
|
48
48
|
# If transaction is matched, the id of the matched transaction
|
49
49
|
attr_accessor :matched_transaction_id
|
50
50
|
|
51
|
-
# If the
|
51
|
+
# If the transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'.
|
52
52
|
attr_accessor :import_id
|
53
53
|
|
54
|
+
# If the transaction was imported, the payee name that was used when importing and before applying any payee rename rules
|
55
|
+
attr_accessor :import_payee_name
|
56
|
+
|
57
|
+
# If the transaction was imported, the original payee name as it appeared on the statement
|
58
|
+
attr_accessor :import_payee_name_original
|
59
|
+
|
54
60
|
# Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.
|
55
61
|
attr_accessor :deleted
|
56
62
|
|
@@ -93,6 +99,8 @@ module YNAB
|
|
93
99
|
:'transfer_transaction_id' => :'transfer_transaction_id',
|
94
100
|
:'matched_transaction_id' => :'matched_transaction_id',
|
95
101
|
:'import_id' => :'import_id',
|
102
|
+
:'import_payee_name' => :'import_payee_name',
|
103
|
+
:'import_payee_name_original' => :'import_payee_name_original',
|
96
104
|
:'deleted' => :'deleted'
|
97
105
|
}
|
98
106
|
end
|
@@ -114,6 +122,8 @@ module YNAB
|
|
114
122
|
:'transfer_transaction_id' => :'String',
|
115
123
|
:'matched_transaction_id' => :'String',
|
116
124
|
:'import_id' => :'String',
|
125
|
+
:'import_payee_name' => :'String',
|
126
|
+
:'import_payee_name_original' => :'String',
|
117
127
|
:'deleted' => :'BOOLEAN'
|
118
128
|
}
|
119
129
|
end
|
@@ -182,6 +192,14 @@ module YNAB
|
|
182
192
|
self.import_id = attributes[:'import_id']
|
183
193
|
end
|
184
194
|
|
195
|
+
if attributes.has_key?(:'import_payee_name')
|
196
|
+
self.import_payee_name = attributes[:'import_payee_name']
|
197
|
+
end
|
198
|
+
|
199
|
+
if attributes.has_key?(:'import_payee_name_original')
|
200
|
+
self.import_payee_name_original = attributes[:'import_payee_name_original']
|
201
|
+
end
|
202
|
+
|
185
203
|
if attributes.has_key?(:'deleted')
|
186
204
|
self.deleted = attributes[:'deleted']
|
187
205
|
end
|
@@ -215,6 +233,14 @@ module YNAB
|
|
215
233
|
invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
|
216
234
|
end
|
217
235
|
|
236
|
+
if !@import_payee_name.nil? && @import_payee_name.to_s.length > 200
|
237
|
+
invalid_properties.push('invalid value for "import_payee_name", the character length must be smaller than or equal to 200.')
|
238
|
+
end
|
239
|
+
|
240
|
+
if !@import_payee_name_original.nil? && @import_payee_name_original.to_s.length > 200
|
241
|
+
invalid_properties.push('invalid value for "import_payee_name_original", the character length must be smaller than or equal to 200.')
|
242
|
+
end
|
243
|
+
|
218
244
|
if @deleted.nil?
|
219
245
|
invalid_properties.push('invalid value for "deleted", deleted cannot be nil.')
|
220
246
|
end
|
@@ -235,6 +261,8 @@ module YNAB
|
|
235
261
|
flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
|
236
262
|
return false unless flag_color_validator.valid?(@flag_color)
|
237
263
|
return false if @account_id.nil?
|
264
|
+
return false if !@import_payee_name.nil? && @import_payee_name.to_s.length > 200
|
265
|
+
return false if !@import_payee_name_original.nil? && @import_payee_name_original.to_s.length > 200
|
238
266
|
return false if @deleted.nil?
|
239
267
|
true
|
240
268
|
end
|
@@ -251,6 +279,26 @@ module YNAB
|
|
251
279
|
@flag_color = flag_color
|
252
280
|
end
|
253
281
|
|
282
|
+
# Custom attribute writer method with validation
|
283
|
+
# @param [Object] import_payee_name Value to be assigned
|
284
|
+
def import_payee_name=(import_payee_name)
|
285
|
+
if !import_payee_name.nil? && import_payee_name.to_s.length > 200
|
286
|
+
fail ArgumentError, 'invalid value for "import_payee_name", the character length must be smaller than or equal to 200.'
|
287
|
+
end
|
288
|
+
|
289
|
+
@import_payee_name = import_payee_name
|
290
|
+
end
|
291
|
+
|
292
|
+
# Custom attribute writer method with validation
|
293
|
+
# @param [Object] import_payee_name_original Value to be assigned
|
294
|
+
def import_payee_name_original=(import_payee_name_original)
|
295
|
+
if !import_payee_name_original.nil? && import_payee_name_original.to_s.length > 200
|
296
|
+
fail ArgumentError, 'invalid value for "import_payee_name_original", the character length must be smaller than or equal to 200.'
|
297
|
+
end
|
298
|
+
|
299
|
+
@import_payee_name_original = import_payee_name_original
|
300
|
+
end
|
301
|
+
|
254
302
|
# Checks equality by comparing each attribute.
|
255
303
|
# @param [Object] Object to be compared
|
256
304
|
def ==(o)
|
@@ -270,6 +318,8 @@ module YNAB
|
|
270
318
|
transfer_transaction_id == o.transfer_transaction_id &&
|
271
319
|
matched_transaction_id == o.matched_transaction_id &&
|
272
320
|
import_id == o.import_id &&
|
321
|
+
import_payee_name == o.import_payee_name &&
|
322
|
+
import_payee_name_original == o.import_payee_name_original &&
|
273
323
|
deleted == o.deleted
|
274
324
|
end
|
275
325
|
|
@@ -282,7 +332,7 @@ module YNAB
|
|
282
332
|
# Calculates hash code according to all attributes.
|
283
333
|
# @return [Fixnum] Hash code
|
284
334
|
def hash
|
285
|
-
[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, deleted].hash
|
335
|
+
[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, deleted].hash
|
286
336
|
end
|
287
337
|
# Builds the object from hash
|
288
338
|
# @param [Hash] attributes Model attributes in the form of hash
|
data/lib/ynab/version.rb
CHANGED
data/lib/ynab.rb
CHANGED
@@ -52,6 +52,8 @@ require 'ynab/models/month_detail_response_data'
|
|
52
52
|
require 'ynab/models/month_summaries_response'
|
53
53
|
require 'ynab/models/month_summaries_response_data'
|
54
54
|
require 'ynab/models/month_summary'
|
55
|
+
require 'ynab/models/patch_month_category_wrapper'
|
56
|
+
require 'ynab/models/patch_transactions_wrapper'
|
55
57
|
require 'ynab/models/payee'
|
56
58
|
require 'ynab/models/payee_location'
|
57
59
|
require 'ynab/models/payee_location_response'
|
@@ -62,18 +64,17 @@ require 'ynab/models/payee_response'
|
|
62
64
|
require 'ynab/models/payee_response_data'
|
63
65
|
require 'ynab/models/payees_response'
|
64
66
|
require 'ynab/models/payees_response_data'
|
67
|
+
require 'ynab/models/post_account_wrapper'
|
68
|
+
require 'ynab/models/post_transactions_wrapper'
|
69
|
+
require 'ynab/models/put_transaction_wrapper'
|
65
70
|
require 'ynab/models/save_account'
|
66
|
-
require 'ynab/models/save_account_wrapper'
|
67
71
|
require 'ynab/models/save_category_response'
|
68
72
|
require 'ynab/models/save_category_response_data'
|
69
73
|
require 'ynab/models/save_month_category'
|
70
|
-
require 'ynab/models/save_month_category_wrapper'
|
71
74
|
require 'ynab/models/save_sub_transaction'
|
72
|
-
require 'ynab/models/
|
73
|
-
require 'ynab/models/save_transaction_wrapper'
|
75
|
+
require 'ynab/models/save_transaction_with_optional_fields'
|
74
76
|
require 'ynab/models/save_transactions_response'
|
75
77
|
require 'ynab/models/save_transactions_response_data'
|
76
|
-
require 'ynab/models/save_transactions_wrapper'
|
77
78
|
require 'ynab/models/scheduled_sub_transaction'
|
78
79
|
require 'ynab/models/scheduled_transaction_response'
|
79
80
|
require 'ynab/models/scheduled_transaction_response_data'
|
@@ -88,7 +89,6 @@ require 'ynab/models/transactions_import_response'
|
|
88
89
|
require 'ynab/models/transactions_import_response_data'
|
89
90
|
require 'ynab/models/transactions_response'
|
90
91
|
require 'ynab/models/transactions_response_data'
|
91
|
-
require 'ynab/models/update_transactions_wrapper'
|
92
92
|
require 'ynab/models/user'
|
93
93
|
require 'ynab/models/user_response'
|
94
94
|
require 'ynab/models/user_response_data'
|
@@ -96,9 +96,10 @@ require 'ynab/models/budget_detail'
|
|
96
96
|
require 'ynab/models/category_group_with_categories'
|
97
97
|
require 'ynab/models/hybrid_transaction'
|
98
98
|
require 'ynab/models/month_detail'
|
99
|
+
require 'ynab/models/save_transaction'
|
100
|
+
require 'ynab/models/save_transaction_with_id'
|
99
101
|
require 'ynab/models/scheduled_transaction_detail'
|
100
102
|
require 'ynab/models/transaction_detail'
|
101
|
-
require 'ynab/models/update_transaction'
|
102
103
|
|
103
104
|
# APIs
|
104
105
|
require 'ynab/api/accounts_api'
|