ynab 1.15.0 → 1.20.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 +1 -0
- data/lib/ynab.rb +13 -8
- data/lib/ynab/api/accounts_api.rb +65 -7
- data/lib/ynab/api/budgets_api.rb +10 -7
- data/lib/ynab/api/categories_api.rb +15 -15
- data/lib/ynab/api/deprecated_api.rb +3 -3
- data/lib/ynab/api/months_api.rb +7 -7
- data/lib/ynab/api/payee_locations_api.rb +7 -7
- data/lib/ynab/api/payees_api.rb +7 -7
- data/lib/ynab/api/scheduled_transactions_api.rb +7 -7
- data/lib/ynab/api/transactions_api.rb +93 -41
- data/lib/ynab/api/user_api.rb +1 -1
- data/lib/ynab/api_client.rb +3 -2
- data/lib/ynab/configuration.rb +2 -3
- data/lib/ynab/models/account.rb +4 -7
- data/lib/ynab/models/account_response.rb +4 -3
- data/lib/ynab/models/account_response_data.rb +4 -3
- data/lib/ynab/models/accounts_response.rb +4 -3
- data/lib/ynab/models/accounts_response_data.rb +4 -3
- data/lib/ynab/models/budget_detail.rb +4 -3
- data/lib/ynab/models/budget_detail_response.rb +4 -3
- data/lib/ynab/models/budget_detail_response_data.rb +4 -3
- data/lib/ynab/models/budget_settings.rb +4 -3
- data/lib/ynab/models/budget_settings_response.rb +4 -3
- data/lib/ynab/models/budget_settings_response_data.rb +4 -3
- data/lib/ynab/models/budget_summary.rb +20 -7
- data/lib/ynab/models/budget_summary_response.rb +4 -3
- data/lib/ynab/models/budget_summary_response_data.rb +4 -3
- data/lib/ynab/models/bulk_response.rb +4 -3
- data/lib/ynab/models/bulk_response_data.rb +4 -3
- data/lib/ynab/models/bulk_response_data_bulk.rb +5 -4
- data/lib/ynab/models/bulk_transactions.rb +4 -3
- data/lib/ynab/models/categories_response.rb +4 -3
- data/lib/ynab/models/categories_response_data.rb +4 -3
- data/lib/ynab/models/category.rb +6 -9
- data/lib/ynab/models/category_group.rb +4 -3
- data/lib/ynab/models/category_group_with_categories.rb +4 -3
- data/lib/ynab/models/category_response.rb +4 -3
- data/lib/ynab/models/category_response_data.rb +4 -3
- data/lib/ynab/models/currency_format.rb +4 -3
- data/lib/ynab/models/date_format.rb +4 -3
- data/lib/ynab/models/error_detail.rb +4 -3
- data/lib/ynab/models/error_response.rb +4 -3
- data/lib/ynab/models/hybrid_transaction.rb +4 -15
- data/lib/ynab/models/hybrid_transactions_response.rb +4 -3
- data/lib/ynab/models/hybrid_transactions_response_data.rb +4 -3
- data/lib/ynab/models/month_detail.rb +6 -5
- data/lib/ynab/models/month_detail_response.rb +4 -3
- data/lib/ynab/models/month_detail_response_data.rb +4 -3
- data/lib/ynab/models/month_summaries_response.rb +4 -3
- data/lib/ynab/models/month_summaries_response_data.rb +4 -3
- data/lib/ynab/models/month_summary.rb +6 -5
- data/lib/ynab/models/payee.rb +5 -4
- data/lib/ynab/models/payee_location.rb +4 -3
- data/lib/ynab/models/payee_location_response.rb +4 -3
- data/lib/ynab/models/payee_location_response_data.rb +4 -3
- data/lib/ynab/models/payee_locations_response.rb +4 -3
- data/lib/ynab/models/payee_locations_response_data.rb +4 -3
- data/lib/ynab/models/payee_response.rb +4 -3
- data/lib/ynab/models/payee_response_data.rb +4 -3
- data/lib/ynab/models/payees_response.rb +4 -3
- data/lib/ynab/models/payees_response_data.rb +4 -3
- data/lib/ynab/models/save_account.rb +250 -0
- data/lib/ynab/models/save_account_wrapper.rb +189 -0
- data/lib/ynab/models/save_category_response.rb +4 -3
- data/lib/ynab/models/save_category_response_data.rb +4 -3
- data/lib/ynab/models/save_month_category.rb +4 -3
- data/lib/ynab/models/save_month_category_wrapper.rb +4 -3
- data/lib/ynab/models/save_sub_transaction.rb +259 -0
- data/lib/ynab/models/save_transaction.rb +24 -19
- data/lib/ynab/models/save_transaction_wrapper.rb +4 -3
- data/lib/ynab/models/save_transactions_response.rb +4 -3
- data/lib/ynab/models/save_transactions_response_data.rb +5 -4
- data/lib/ynab/models/save_transactions_wrapper.rb +4 -3
- data/lib/ynab/models/scheduled_sub_transaction.rb +4 -3
- data/lib/ynab/models/scheduled_transaction_detail.rb +4 -11
- data/lib/ynab/models/scheduled_transaction_response.rb +4 -3
- data/lib/ynab/models/scheduled_transaction_response_data.rb +4 -3
- data/lib/ynab/models/scheduled_transaction_summary.rb +4 -11
- data/lib/ynab/models/scheduled_transactions_response.rb +4 -3
- data/lib/ynab/models/scheduled_transactions_response_data.rb +4 -3
- data/lib/ynab/models/sub_transaction.rb +33 -4
- data/lib/ynab/models/transaction_detail.rb +4 -11
- data/lib/ynab/models/transaction_response.rb +4 -3
- data/lib/ynab/models/transaction_response_data.rb +4 -3
- data/lib/ynab/models/transaction_summary.rb +4 -11
- data/lib/ynab/models/transactions_import_response.rb +189 -0
- data/lib/ynab/models/transactions_import_response_data.rb +192 -0
- data/lib/ynab/models/transactions_response.rb +4 -3
- data/lib/ynab/models/transactions_response_data.rb +4 -3
- data/lib/ynab/models/update_transaction.rb +18 -27
- data/lib/ynab/models/update_transactions_wrapper.rb +4 -3
- data/lib/ynab/models/user.rb +4 -3
- data/lib/ynab/models/user_response.rb +4 -3
- data/lib/ynab/models/user_response_data.rb +4 -3
- data/lib/ynab/version.rb +1 -1
- data/spec/api/accounts_spec.rb +19 -10
- data/spec/api/budgets_spec.rb +4 -4
- data/spec/api/categories_spec.rb +5 -5
- data/spec/api/months_spec.rb +4 -4
- data/spec/api/payee_locations_spec.rb +4 -4
- data/spec/api/payees_spec.rb +4 -4
- data/spec/api/scheduled_transactions_spec.rb +4 -4
- data/spec/api/transactions_spec.rb +23 -13
- data/spec/fixtures/vcr_cassettes/create_account.yml +51 -0
- data/spec/fixtures/vcr_cassettes/import_transactions.yml +50 -0
- data/spec/models/transaction_detail_spec.rb +11 -0
- metadata +26 -15
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.15
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -80,7 +80,6 @@ module YNAB
|
|
80
80
|
def hash
|
81
81
|
[data].hash
|
82
82
|
end
|
83
|
-
|
84
83
|
# Builds the object from hash
|
85
84
|
# @param [Hash] attributes Model attributes in the form of hash
|
86
85
|
# @return [Object] Returns the model itself
|
@@ -88,7 +87,7 @@ module YNAB
|
|
88
87
|
return nil unless attributes.is_a?(Hash)
|
89
88
|
self.class.swagger_types.each_pair do |key, type|
|
90
89
|
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the
|
90
|
+
# check to ensure the input is an array given that the attribute
|
92
91
|
# is documented as an array but the input is not
|
93
92
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
93
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -184,5 +183,7 @@ module YNAB
|
|
184
183
|
value
|
185
184
|
end
|
186
185
|
end
|
186
|
+
|
187
187
|
end
|
188
|
+
|
188
189
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.15
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -97,7 +97,6 @@ module YNAB
|
|
97
97
|
def hash
|
98
98
|
[scheduled_transactions, server_knowledge].hash
|
99
99
|
end
|
100
|
-
|
101
100
|
# Builds the object from hash
|
102
101
|
# @param [Hash] attributes Model attributes in the form of hash
|
103
102
|
# @return [Object] Returns the model itself
|
@@ -105,7 +104,7 @@ module YNAB
|
|
105
104
|
return nil unless attributes.is_a?(Hash)
|
106
105
|
self.class.swagger_types.each_pair do |key, type|
|
107
106
|
if type =~ /\AArray<(.*)>/i
|
108
|
-
# check to ensure the input is an array given that the
|
107
|
+
# check to ensure the input is an array given that the attribute
|
109
108
|
# is documented as an array but the input is not
|
110
109
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
111
110
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -201,5 +200,7 @@ module YNAB
|
|
201
200
|
value
|
202
201
|
end
|
203
202
|
end
|
203
|
+
|
204
204
|
end
|
205
|
+
|
205
206
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.15
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -25,11 +25,18 @@ module YNAB
|
|
25
25
|
|
26
26
|
attr_accessor :payee_id
|
27
27
|
|
28
|
+
attr_accessor :payee_name
|
29
|
+
|
28
30
|
attr_accessor :category_id
|
29
31
|
|
32
|
+
attr_accessor :category_name
|
33
|
+
|
30
34
|
# If a transfer, the account_id which the subtransaction transfers to
|
31
35
|
attr_accessor :transfer_account_id
|
32
36
|
|
37
|
+
# If a transfer, the id of transaction on the other side of the transfer
|
38
|
+
attr_accessor :transfer_transaction_id
|
39
|
+
|
33
40
|
# Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests.
|
34
41
|
attr_accessor :deleted
|
35
42
|
|
@@ -41,8 +48,11 @@ module YNAB
|
|
41
48
|
:'amount' => :'amount',
|
42
49
|
:'memo' => :'memo',
|
43
50
|
:'payee_id' => :'payee_id',
|
51
|
+
:'payee_name' => :'payee_name',
|
44
52
|
:'category_id' => :'category_id',
|
53
|
+
:'category_name' => :'category_name',
|
45
54
|
:'transfer_account_id' => :'transfer_account_id',
|
55
|
+
:'transfer_transaction_id' => :'transfer_transaction_id',
|
46
56
|
:'deleted' => :'deleted'
|
47
57
|
}
|
48
58
|
end
|
@@ -55,8 +65,11 @@ module YNAB
|
|
55
65
|
:'amount' => :'Integer',
|
56
66
|
:'memo' => :'String',
|
57
67
|
:'payee_id' => :'String',
|
68
|
+
:'payee_name' => :'String',
|
58
69
|
:'category_id' => :'String',
|
70
|
+
:'category_name' => :'String',
|
59
71
|
:'transfer_account_id' => :'String',
|
72
|
+
:'transfer_transaction_id' => :'String',
|
60
73
|
:'deleted' => :'BOOLEAN'
|
61
74
|
}
|
62
75
|
end
|
@@ -89,14 +102,26 @@ module YNAB
|
|
89
102
|
self.payee_id = attributes[:'payee_id']
|
90
103
|
end
|
91
104
|
|
105
|
+
if attributes.has_key?(:'payee_name')
|
106
|
+
self.payee_name = attributes[:'payee_name']
|
107
|
+
end
|
108
|
+
|
92
109
|
if attributes.has_key?(:'category_id')
|
93
110
|
self.category_id = attributes[:'category_id']
|
94
111
|
end
|
95
112
|
|
113
|
+
if attributes.has_key?(:'category_name')
|
114
|
+
self.category_name = attributes[:'category_name']
|
115
|
+
end
|
116
|
+
|
96
117
|
if attributes.has_key?(:'transfer_account_id')
|
97
118
|
self.transfer_account_id = attributes[:'transfer_account_id']
|
98
119
|
end
|
99
120
|
|
121
|
+
if attributes.has_key?(:'transfer_transaction_id')
|
122
|
+
self.transfer_transaction_id = attributes[:'transfer_transaction_id']
|
123
|
+
end
|
124
|
+
|
100
125
|
if attributes.has_key?(:'deleted')
|
101
126
|
self.deleted = attributes[:'deleted']
|
102
127
|
end
|
@@ -145,8 +170,11 @@ module YNAB
|
|
145
170
|
amount == o.amount &&
|
146
171
|
memo == o.memo &&
|
147
172
|
payee_id == o.payee_id &&
|
173
|
+
payee_name == o.payee_name &&
|
148
174
|
category_id == o.category_id &&
|
175
|
+
category_name == o.category_name &&
|
149
176
|
transfer_account_id == o.transfer_account_id &&
|
177
|
+
transfer_transaction_id == o.transfer_transaction_id &&
|
150
178
|
deleted == o.deleted
|
151
179
|
end
|
152
180
|
|
@@ -159,9 +187,8 @@ module YNAB
|
|
159
187
|
# Calculates hash code according to all attributes.
|
160
188
|
# @return [Fixnum] Hash code
|
161
189
|
def hash
|
162
|
-
[id, transaction_id, amount, memo, payee_id, category_id, transfer_account_id, deleted].hash
|
190
|
+
[id, transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, transfer_transaction_id, deleted].hash
|
163
191
|
end
|
164
|
-
|
165
192
|
# Builds the object from hash
|
166
193
|
# @param [Hash] attributes Model attributes in the form of hash
|
167
194
|
# @return [Object] Returns the model itself
|
@@ -169,7 +196,7 @@ module YNAB
|
|
169
196
|
return nil unless attributes.is_a?(Hash)
|
170
197
|
self.class.swagger_types.each_pair do |key, type|
|
171
198
|
if type =~ /\AArray<(.*)>/i
|
172
|
-
# check to ensure the input is an array given that the
|
199
|
+
# check to ensure the input is an array given that the attribute
|
173
200
|
# is documented as an array but the input is not
|
174
201
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
175
202
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -265,5 +292,7 @@ module YNAB
|
|
265
292
|
value
|
266
293
|
end
|
267
294
|
end
|
295
|
+
|
268
296
|
end
|
297
|
+
|
269
298
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.15
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -287,20 +287,12 @@ module YNAB
|
|
287
287
|
# Custom attribute writer method checking allowed values (enum).
|
288
288
|
# @param [Object] cleared Object to be assigned
|
289
289
|
def cleared=(cleared)
|
290
|
-
validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
|
291
|
-
unless validator.valid?(cleared)
|
292
|
-
fail ArgumentError, 'invalid value for "cleared", must be one of #{validator.allowable_values}.'
|
293
|
-
end
|
294
290
|
@cleared = cleared
|
295
291
|
end
|
296
292
|
|
297
293
|
# Custom attribute writer method checking allowed values (enum).
|
298
294
|
# @param [Object] flag_color Object to be assigned
|
299
295
|
def flag_color=(flag_color)
|
300
|
-
validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
|
301
|
-
unless validator.valid?(flag_color)
|
302
|
-
fail ArgumentError, 'invalid value for "flag_color", must be one of #{validator.allowable_values}.'
|
303
|
-
end
|
304
296
|
@flag_color = flag_color
|
305
297
|
end
|
306
298
|
|
@@ -341,7 +333,6 @@ module YNAB
|
|
341
333
|
def hash
|
342
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
|
343
335
|
end
|
344
|
-
|
345
336
|
# Builds the object from hash
|
346
337
|
# @param [Hash] attributes Model attributes in the form of hash
|
347
338
|
# @return [Object] Returns the model itself
|
@@ -349,7 +340,7 @@ module YNAB
|
|
349
340
|
return nil unless attributes.is_a?(Hash)
|
350
341
|
self.class.swagger_types.each_pair do |key, type|
|
351
342
|
if type =~ /\AArray<(.*)>/i
|
352
|
-
# check to ensure the input is an array given that the
|
343
|
+
# check to ensure the input is an array given that the attribute
|
353
344
|
# is documented as an array but the input is not
|
354
345
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
355
346
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -445,5 +436,7 @@ module YNAB
|
|
445
436
|
value
|
446
437
|
end
|
447
438
|
end
|
439
|
+
|
448
440
|
end
|
441
|
+
|
449
442
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.15
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -80,7 +80,6 @@ module YNAB
|
|
80
80
|
def hash
|
81
81
|
[data].hash
|
82
82
|
end
|
83
|
-
|
84
83
|
# Builds the object from hash
|
85
84
|
# @param [Hash] attributes Model attributes in the form of hash
|
86
85
|
# @return [Object] Returns the model itself
|
@@ -88,7 +87,7 @@ module YNAB
|
|
88
87
|
return nil unless attributes.is_a?(Hash)
|
89
88
|
self.class.swagger_types.each_pair do |key, type|
|
90
89
|
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the
|
90
|
+
# check to ensure the input is an array given that the attribute
|
92
91
|
# is documented as an array but the input is not
|
93
92
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
93
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -184,5 +183,7 @@ module YNAB
|
|
184
183
|
value
|
185
184
|
end
|
186
185
|
end
|
186
|
+
|
187
187
|
end
|
188
|
+
|
188
189
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.15
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -80,7 +80,6 @@ module YNAB
|
|
80
80
|
def hash
|
81
81
|
[transaction].hash
|
82
82
|
end
|
83
|
-
|
84
83
|
# Builds the object from hash
|
85
84
|
# @param [Hash] attributes Model attributes in the form of hash
|
86
85
|
# @return [Object] Returns the model itself
|
@@ -88,7 +87,7 @@ module YNAB
|
|
88
87
|
return nil unless attributes.is_a?(Hash)
|
89
88
|
self.class.swagger_types.each_pair do |key, type|
|
90
89
|
if type =~ /\AArray<(.*)>/i
|
91
|
-
# check to ensure the input is an array given that the
|
90
|
+
# check to ensure the input is an array given that the attribute
|
92
91
|
# is documented as an array but the input is not
|
93
92
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
93
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -184,5 +183,7 @@ module YNAB
|
|
184
183
|
value
|
185
184
|
end
|
186
185
|
end
|
186
|
+
|
187
187
|
end
|
188
|
+
|
188
189
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.4.
|
9
|
+
Swagger Codegen version: 2.4.15
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -242,20 +242,12 @@ module YNAB
|
|
242
242
|
# Custom attribute writer method checking allowed values (enum).
|
243
243
|
# @param [Object] cleared Object to be assigned
|
244
244
|
def cleared=(cleared)
|
245
|
-
validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
|
246
|
-
unless validator.valid?(cleared)
|
247
|
-
fail ArgumentError, 'invalid value for "cleared", must be one of #{validator.allowable_values}.'
|
248
|
-
end
|
249
245
|
@cleared = cleared
|
250
246
|
end
|
251
247
|
|
252
248
|
# Custom attribute writer method checking allowed values (enum).
|
253
249
|
# @param [Object] flag_color Object to be assigned
|
254
250
|
def flag_color=(flag_color)
|
255
|
-
validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
|
256
|
-
unless validator.valid?(flag_color)
|
257
|
-
fail ArgumentError, 'invalid value for "flag_color", must be one of #{validator.allowable_values}.'
|
258
|
-
end
|
259
251
|
@flag_color = flag_color
|
260
252
|
end
|
261
253
|
|
@@ -292,7 +284,6 @@ module YNAB
|
|
292
284
|
def hash
|
293
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
|
294
286
|
end
|
295
|
-
|
296
287
|
# Builds the object from hash
|
297
288
|
# @param [Hash] attributes Model attributes in the form of hash
|
298
289
|
# @return [Object] Returns the model itself
|
@@ -300,7 +291,7 @@ module YNAB
|
|
300
291
|
return nil unless attributes.is_a?(Hash)
|
301
292
|
self.class.swagger_types.each_pair do |key, type|
|
302
293
|
if type =~ /\AArray<(.*)>/i
|
303
|
-
# check to ensure the input is an array given that the
|
294
|
+
# check to ensure the input is an array given that the attribute
|
304
295
|
# is documented as an array but the input is not
|
305
296
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
306
297
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -396,5 +387,7 @@ module YNAB
|
|
396
387
|
value
|
397
388
|
end
|
398
389
|
end
|
390
|
+
|
399
391
|
end
|
392
|
+
|
400
393
|
end
|
@@ -0,0 +1,189 @@
|
|
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.15
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module YNAB
|
16
|
+
class TransactionsImportResponse
|
17
|
+
attr_accessor :data
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'data' => :'data'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attribute type mapping.
|
27
|
+
def self.swagger_types
|
28
|
+
{
|
29
|
+
:'data' => :'TransactionsImportResponseData'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
return unless attributes.is_a?(Hash)
|
37
|
+
|
38
|
+
# convert string to symbol for hash key
|
39
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
40
|
+
|
41
|
+
if attributes.has_key?(:'data')
|
42
|
+
self.data = attributes[:'data']
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
47
|
+
# @return Array for valid properties with the reasons
|
48
|
+
def list_invalid_properties
|
49
|
+
invalid_properties = Array.new
|
50
|
+
if @data.nil?
|
51
|
+
invalid_properties.push('invalid value for "data", data cannot be nil.')
|
52
|
+
end
|
53
|
+
|
54
|
+
invalid_properties
|
55
|
+
end
|
56
|
+
|
57
|
+
# Check to see if the all the properties in the model are valid
|
58
|
+
# @return true if the model is valid
|
59
|
+
def valid?
|
60
|
+
return false if @data.nil?
|
61
|
+
true
|
62
|
+
end
|
63
|
+
|
64
|
+
# Checks equality by comparing each attribute.
|
65
|
+
# @param [Object] Object to be compared
|
66
|
+
def ==(o)
|
67
|
+
return true if self.equal?(o)
|
68
|
+
self.class == o.class &&
|
69
|
+
data == o.data
|
70
|
+
end
|
71
|
+
|
72
|
+
# @see the `==` method
|
73
|
+
# @param [Object] Object to be compared
|
74
|
+
def eql?(o)
|
75
|
+
self == o
|
76
|
+
end
|
77
|
+
|
78
|
+
# Calculates hash code according to all attributes.
|
79
|
+
# @return [Fixnum] Hash code
|
80
|
+
def hash
|
81
|
+
[data].hash
|
82
|
+
end
|
83
|
+
# Builds the object from hash
|
84
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
85
|
+
# @return [Object] Returns the model itself
|
86
|
+
def build_from_hash(attributes)
|
87
|
+
return nil unless attributes.is_a?(Hash)
|
88
|
+
self.class.swagger_types.each_pair do |key, type|
|
89
|
+
if type =~ /\AArray<(.*)>/i
|
90
|
+
# check to ensure the input is an array given that the attribute
|
91
|
+
# is documented as an array but the input is not
|
92
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
93
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
94
|
+
end
|
95
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
96
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
97
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
98
|
+
end
|
99
|
+
|
100
|
+
self
|
101
|
+
end
|
102
|
+
|
103
|
+
# Deserializes the data based on type
|
104
|
+
# @param string type Data type
|
105
|
+
# @param string value Value to be deserialized
|
106
|
+
# @return [Object] Deserialized data
|
107
|
+
def _deserialize(type, value)
|
108
|
+
case type.to_sym
|
109
|
+
when :DateTime
|
110
|
+
DateTime.parse(value)
|
111
|
+
when :Date
|
112
|
+
Date.parse(value)
|
113
|
+
when :String
|
114
|
+
value.to_s
|
115
|
+
when :Integer
|
116
|
+
value.to_i
|
117
|
+
when :Float
|
118
|
+
value.to_f
|
119
|
+
when :BOOLEAN
|
120
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
121
|
+
true
|
122
|
+
else
|
123
|
+
false
|
124
|
+
end
|
125
|
+
when :Object
|
126
|
+
# generic object (usually a Hash), return directly
|
127
|
+
value
|
128
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
129
|
+
inner_type = Regexp.last_match[:inner_type]
|
130
|
+
value.map { |v| _deserialize(inner_type, v) }
|
131
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
132
|
+
k_type = Regexp.last_match[:k_type]
|
133
|
+
v_type = Regexp.last_match[:v_type]
|
134
|
+
{}.tap do |hash|
|
135
|
+
value.each do |k, v|
|
136
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
else # model
|
140
|
+
temp_model = YNAB.const_get(type).new
|
141
|
+
temp_model.build_from_hash(value)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns the string representation of the object
|
146
|
+
# @return [String] String presentation of the object
|
147
|
+
def to_s
|
148
|
+
to_hash.to_s
|
149
|
+
end
|
150
|
+
|
151
|
+
# to_body is an alias to to_hash (backward compatibility)
|
152
|
+
# @return [Hash] Returns the object in the form of hash
|
153
|
+
def to_body
|
154
|
+
to_hash
|
155
|
+
end
|
156
|
+
|
157
|
+
# Returns the object in the form of hash
|
158
|
+
# @return [Hash] Returns the object in the form of hash
|
159
|
+
def to_hash
|
160
|
+
hash = {}
|
161
|
+
self.class.attribute_map.each_pair do |attr, param|
|
162
|
+
value = self.send(attr)
|
163
|
+
next if value.nil?
|
164
|
+
hash[param] = _to_hash(value)
|
165
|
+
end
|
166
|
+
hash
|
167
|
+
end
|
168
|
+
|
169
|
+
# Outputs non-array value in the form of hash
|
170
|
+
# For object, use to_hash. Otherwise, just return the value
|
171
|
+
# @param [Object] value Any valid value
|
172
|
+
# @return [Hash] Returns the value in the form of hash
|
173
|
+
def _to_hash(value)
|
174
|
+
if value.is_a?(Array)
|
175
|
+
value.compact.map { |v| _to_hash(v) }
|
176
|
+
elsif value.is_a?(Hash)
|
177
|
+
{}.tap do |hash|
|
178
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
179
|
+
end
|
180
|
+
elsif value.respond_to? :to_hash
|
181
|
+
value.to_hash
|
182
|
+
else
|
183
|
+
value
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|